diff --git a/.circleci/config.yml b/.circleci/config.yml index 6a9162aa104cd..ce38bf07f5bb5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -12,7 +12,7 @@ executors: go-1_16: working_directory: '/go/src/github.com/influxdata/telegraf' docker: - - image: 'quay.io/influxdb/telegraf-ci:1.16.1' + - image: 'quay.io/influxdb/telegraf-ci:1.16.2' environment: GOFLAGS: -p=8 mac: @@ -37,14 +37,6 @@ commands: - run: 'GOARCH=<< parameters.goarch >> make check' - run: 'GOARCH=<< parameters.goarch >> make check-deps' - run: 'GOARCH=<< parameters.goarch >> make test' - test-go-mac: - steps: - - checkout - - attach_workspace: - at: '/' - - run: 'make' - - run: 'make check' - - run: 'make test' package: parameters: nightly: @@ -88,31 +80,6 @@ jobs: root: '/go' paths: - '*' - macdeps: - executor: mac - steps: - - checkout - - restore_cache: - key: mac-go-mod-v3-{{ checksum "go.sum" }} - - run: 'brew update' - - run: 'brew install go@1.16' - - run: 'make deps' - - run: 'make tidy' - - save_cache: - name: 'go module cache' - key: mac-go-mod-v3-{{ checksum "go.sum" }} - paths: - - '~/go/pkg/mod' - - '/usr/local/Cellar/go' - - '/usr/local/bin/go' - - '/usr/local/bin/gofmt' - - persist_to_workspace: - root: '/' - paths: - - 'usr/local/bin/go' - - 'usr/local/Cellar/go' - - 'usr/local/bin/gofmt' - - 'Users/distiller/go' test-go-1_15: executor: go-1_15 steps: @@ -131,17 +98,32 @@ jobs: steps: - test-go: goarch: "386" - test-go-darwin: + test-go-mac: executor: mac steps: - - test-go-mac + - checkout + - restore_cache: + key: mac-go-mod-v0-{{ checksum "go.sum" }} + - run: 'sh ./scripts/mac_installgo.sh' + - save_cache: + name: 'Saving cache' + key: mac-go-mod-v0-{{ checksum "go.sum" }} + paths: + - '/usr/local/Cellar/go' + - '/usr/local/bin/go' + - '/usr/local/bin/gofmt' + - run: 'make deps' + - run: 'make tidy' + - run: 'make' + - run: 'make check' + - run: 'make test' test-go-windows: executor: name: win/default shell: powershell.exe steps: - checkout - - run: choco upgrade golang --version=1.15.8 + - run: choco upgrade golang --version=1.16.2 - run: choco install make - run: git config --system core.longpaths true - run: make test-windows @@ -201,10 +183,6 @@ workflows: version: 2 check: jobs: - - 'macdeps': - filters: - tags: - only: /.*/ - 'deps': filters: tags: @@ -233,9 +211,7 @@ workflows: filters: tags: only: /.*/ - - 'test-go-darwin': - requires: - - 'macdeps' + - 'test-go-mac': filters: tags: # only runs on tags if you specify this filter only: /.*/ @@ -246,7 +222,7 @@ workflows: - 'package': requires: - 'test-go-windows' - - 'test-go-darwin' + - 'test-go-mac' - 'test-go-1_15' - 'test-go-1_15-386' - 'test-go-1_16' @@ -254,7 +230,7 @@ workflows: - 'release': requires: - 'test-go-windows' - - 'test-go-darwin' + - 'test-go-mac' - 'test-go-1_15' - 'test-go-1_15-386' - 'test-go-1_16' @@ -279,7 +255,6 @@ workflows: nightly: jobs: - 'deps' - - 'macdeps' - 'test-go-1_15': requires: - 'deps' @@ -292,14 +267,12 @@ workflows: - 'test-go-1_16-386': requires: - 'deps' - - 'test-go-darwin': - requires: - - 'macdeps' + - 'test-go-mac' - 'test-go-windows' - 'nightly': requires: - 'test-go-windows' - - 'test-go-darwin' + - 'test-go-mac' - 'test-go-1_15' - 'test-go-1_15-386' - 'test-go-1_16' diff --git a/Makefile b/Makefile index ca2ed70647eea..992ddb18993f1 100644 --- a/Makefile +++ b/Makefile @@ -185,8 +185,8 @@ ci-1.15: .PHONY: ci-1.16 ci-1.16: - docker build -t quay.io/influxdb/telegraf-ci:1.16.1 - < scripts/ci-1.16.docker - docker push quay.io/influxdb/telegraf-ci:1.16.1 + docker build -t quay.io/influxdb/telegraf-ci:1.16.2 - < scripts/ci-1.16.docker + docker push quay.io/influxdb/telegraf-ci:1.16.2 .PHONY: install install: $(buildbin) diff --git a/scripts/alpine.docker b/scripts/alpine.docker index ecf6c15573ea5..4bd3489bc4463 100644 --- a/scripts/alpine.docker +++ b/scripts/alpine.docker @@ -1,4 +1,4 @@ -FROM golang:1.16.1 as builder +FROM golang:1.16.2 as builder WORKDIR /go/src/github.com/influxdata/telegraf COPY . /go/src/github.com/influxdata/telegraf diff --git a/scripts/buster.docker b/scripts/buster.docker index 465d367f5b482..65e96acb6efad 100644 --- a/scripts/buster.docker +++ b/scripts/buster.docker @@ -1,4 +1,4 @@ -FROM golang:1.16.1-buster as builder +FROM golang:1.16.2-buster as builder WORKDIR /go/src/github.com/influxdata/telegraf COPY . /go/src/github.com/influxdata/telegraf diff --git a/scripts/ci-1.16.docker b/scripts/ci-1.16.docker index a8e05b54600f1..cc316dec00dcd 100644 --- a/scripts/ci-1.16.docker +++ b/scripts/ci-1.16.docker @@ -1,4 +1,4 @@ -FROM golang:1.16.1 +FROM golang:1.16.2 RUN chmod -R 755 "$GOPATH" diff --git a/scripts/mac_installgo.sh b/scripts/mac_installgo.sh new file mode 100644 index 0000000000000..93d674daf2973 --- /dev/null +++ b/scripts/mac_installgo.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +version="1.16.2" +# This path is cachable, while saving directly in /usr/local/ will cause issues restoring the cache +path="/usr/local/Cellar" + +# Download Go directly from tar, the reason we aren't using brew: it is slow to update and we can't pull specific minor versions +setup_go () { + echo "installing go" + curl -OL https://golang.org/dl/go${version}.darwin-amd64.tar.gz --output go${version}.darwin-amd64.tar.gz + sudo rm -rf ${path}/go + sudo tar -C $path -xzf go${version}.darwin-amd64.tar.gz + ln -sf ${path}/go/bin/go /usr/local/bin/go + ln -sf ${path}/go/bin/gofmt /usr/local/bin/gofmt +} + +if command -v go &> /dev/null; then + echo "Go is already installed" + v=`go version | { read _ _ v _; echo ${v#go}; }` + echo "$v is installed, required version is $version" + if [ "$v" != $version ]; then + setup_go + go version + fi +else + setup_go +fi