diff --git a/.circleci/config.yml b/.circleci/config.yml index a2ff5173a..dd58e764f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ executors: working_directory: '/go/src/github.com/influxdata/telegraf' resource_class: large docker: - - image: 'quay.io/influxdb/telegraf-ci:1.20' + - image: 'quay.io/influxdb/telegraf-ci:1.20.1' environment: GOFLAGS: -p=4 mac: diff --git a/Makefile b/Makefile index 36c5a9d20..c618446e4 100644 --- a/Makefile +++ b/Makefile @@ -241,8 +241,8 @@ plugins/parsers/influx/machine.go: plugins/parsers/influx/machine.go.rl .PHONY: ci ci: - docker build -t quay.io/influxdb/telegraf-ci:1.20 - < scripts/ci.docker - docker push quay.io/influxdb/telegraf-ci:1.20 + docker build -t quay.io/influxdb/telegraf-ci:1.20.1 - < scripts/ci.docker + docker push quay.io/influxdb/telegraf-ci:1.20.1 .PHONY: install install: $(buildbin) diff --git a/go.mod b/go.mod index e4cc0e3f5..6f824f6dd 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/influxdata/telegraf -go 1.19 +go 1.20 require ( cloud.google.com/go/bigquery v1.45.0 diff --git a/internal/internal_test.go b/internal/internal_test.go index 239645a81..d8ff21d12 100644 --- a/internal/internal_test.go +++ b/internal/internal_test.go @@ -708,7 +708,7 @@ func TestParseTimestampInvalid(t *testing.T) { name: "layout not matching time", format: "rfc3339", timestamp: "09.07.2019 00:11:00", - expected: "cannot parse \"09.07.2019 00:11:00\" as \"2006\"", + expected: "parsing time \"09.07.2019 00:11:00\" as \"2006-01-02T15:04:05Z07:00\": cannot parse", }, { name: "unix wrong type", diff --git a/scripts/ci.docker b/scripts/ci.docker index 0c700664e..d86041982 100644 --- a/scripts/ci.docker +++ b/scripts/ci.docker @@ -1,4 +1,4 @@ -FROM golang:1.20 +FROM golang:1.20.1 RUN chmod -R 755 "$GOPATH" diff --git a/scripts/installgo_linux.sh b/scripts/installgo_linux.sh index 0d1479128..1115ca157 100644 --- a/scripts/installgo_linux.sh +++ b/scripts/installgo_linux.sh @@ -2,10 +2,10 @@ set -eux -GO_VERSION="1.20" +GO_VERSION="1.20.1" GO_ARCH="linux-amd64" # from https://golang.org/dl -GO_VERSION_SHA="5a9ebcc65c1cce56e0d2dc616aff4c4cedcfbda8cc6f0288cc08cda3b18dcbf1" +GO_VERSION_SHA="000a5b1fca4f75895f78befeb2eecf10bfff3c428597f3f1e69133b63b911b02" # Download Go and verify Go tarball setup_go () { diff --git a/scripts/installgo_mac.sh b/scripts/installgo_mac.sh index c55645eee..906ad3c7a 100644 --- a/scripts/installgo_mac.sh +++ b/scripts/installgo_mac.sh @@ -3,9 +3,9 @@ set -eux ARCH=$(uname -m) -GO_VERSION="1.20" -GO_VERSION_SHA_arm64="32864d6fe888714ca7b421b5997269c7f6349d7e2675c3a399133e521787608b" # from https://golang.org/dl -GO_VERSION_SHA_amd64="777025500f62d14bb5a4923072cd97431887961d24de08433a60c2fe1120531d" # from https://golang.org/dl +GO_VERSION="1.20.1" +GO_VERSION_SHA_arm64="f1a8e06c7f1ba1c008313577f3f58132eb166a41ceb95ce6e9af30bc5a3efca4" # from https://golang.org/dl +GO_VERSION_SHA_amd64="a300a45e801ab459f3008aae5bb9efbe9a6de9bcd12388f5ca9bbd14f70236de" # from https://golang.org/dl if [ "$ARCH" = 'arm64' ]; then GO_ARCH="darwin-arm64" diff --git a/scripts/installgo_windows.sh b/scripts/installgo_windows.sh index 798374ad3..e90712fff 100644 --- a/scripts/installgo_windows.sh +++ b/scripts/installgo_windows.sh @@ -2,7 +2,7 @@ set -eux -GO_VERSION="1.20" +GO_VERSION="1.20.1" setup_go () { choco upgrade golang --allow-downgrade --version=${GO_VERSION} diff --git a/tools/update_goversion/main.go b/tools/update_goversion/main.go index e77439526..b83420e41 100644 --- a/tools/update_goversion/main.go +++ b/tools/update_goversion/main.go @@ -9,6 +9,7 @@ import ( "regexp" "strings" + "github.com/coreos/go-semver/semver" "golang.org/x/net/html" ) @@ -43,6 +44,12 @@ func removeZeroPatch(version string) string { return version } +// removePatch cleans version from "1.20.1" to "1.20" (think go.mod entry) +func removePatch(version string) string { + verInfo := semver.New(version) + return fmt.Sprintf("%d.%d", verInfo.Major, verInfo.Minor) +} + // findHash will search the downloads table for the hashes matching the artifacts list func findHashes(body io.Reader, version string) (map[string]string, error) { version = removeZeroPatch(version) @@ -107,6 +114,10 @@ func findHashes(body io.Reader, version string) (map[string]string, error) { // Reached end of table if tokenType == html.EndTagToken && htmlTokens.Token().Data == "table" { + if len(hashes) == 0 { + return nil, fmt.Errorf("could not find version %q on downloads page", version) + } + return nil, fmt.Errorf("only found %d hashes expected %d: %v", len(hashes), len(artifacts), hashes) } } @@ -130,13 +141,15 @@ func main() { if strings.HasPrefix(version, "v") { version = strings.TrimLeft(version, "v") } - zeroPatchVersion := removeZeroPatch(version) hashes, err := getHashes(version) if err != nil { - log.Panic(err) + log.Fatal(err) } + zeroPatchVersion := removeZeroPatch(version) + noPatchVersion := removePatch(version) + files := []FileInfo{ { FileName: ".circleci/config.yml", @@ -146,7 +159,12 @@ func main() { { FileName: ".github/workflows/golangci-lint.yml", Regex: `(go-version).*`, - Replace: fmt.Sprintf("$1: '%s'", zeroPatchVersion), + Replace: fmt.Sprintf("$1: '%s'", noPatchVersion), + }, + { + FileName: "go.mod", + Regex: `(go)\s(\d.\d*)`, + Replace: fmt.Sprintf("$1 %s", noPatchVersion), }, { FileName: "Makefile",