Skip to content

Commit

Permalink
Revert "chore(tools): Cache rework for CircleCI (influxdata#14156)"
Browse files Browse the repository at this point in the history
This reverts commit 4413991.
  • Loading branch information
powersj committed Dec 15, 2023
1 parent e48b72f commit a2d44ff
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 96 deletions.
79 changes: 24 additions & 55 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,15 @@ commands:
default: "gotestsum"
cache_version:
type: string
default: "v1"
default: "v2"
goversion:
type: string
default: 1.21.5
steps:
- check-changed-files-or-halt
- when:
condition:
equal: [ windows, << parameters.os >> ]
steps:
- run:
name: Remove Go and MinGW to avoid clashes after upgrade during cache restore
command: |
rm -rf '/c/Program Files/Go'
rm -rf '/c/ProgramData/chocolatey/lib/mingw'
- when:
condition:
equal: [ darwin, << parameters.os >> ]
steps:
- run:
name: Ensure go directory is empty and have proper permissions before cache restore
command: |
sudo rm -rf '/usr/local/Cellar/go'
sudo mkdir -p '/usr/local/Cellar/go'
sudo chown -R $(id -u):$(id -g) '/usr/local/Cellar/go'
- restore_cache:
name: "Restore binaries from cache"
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- when:
condition:
equal: [ linux, << parameters.os >> ]
Expand All @@ -80,11 +61,10 @@ commands:
condition:
equal: [ windows, << parameters.os >> ]
steps:
- run: rm -rf '/c/Program Files/Go'
- run: choco feature enable -n allowGlobalConfirmation
- run: git config --system core.longpaths true
- run: 'sh ./scripts/installgo_windows.sh'
- run: 'sh ./scripts/installmingw_windows.sh'
- run: choco install make
- run: choco install mingw --version=12.2.0.03042023
- run: go env
- run: go install github.com/golangci/golangci-lint/cmd/[email protected]
- when:
Expand Down Expand Up @@ -123,18 +103,8 @@ commands:
equal: [ "386", << parameters.arch >> ]
steps:
- run: echo 'export RACE="-race"' >> $BASH_ENV
- when:
condition:
equal: [ windows, << parameters.os >> ]
steps:
- run: |
export PATH="/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin:$PATH"
GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short -cover -coverprofile=coverage.out ./...
- unless:
condition:
equal: [ windows, << parameters.os >> ]
steps:
- run: GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short -cover -coverprofile=coverage.out ./...
- run: |
GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short -cover -coverprofile=coverage.out ./...
- when:
condition:
and:
Expand All @@ -157,7 +127,7 @@ commands:
steps:
- save_cache:
name: 'Saving binaries to cache'
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '/go/src/github.com/influxdata/telegraf/gotestsum'
- when:
Expand All @@ -166,7 +136,7 @@ commands:
steps:
- save_cache:
name: 'Saving binaries to cache'
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~/go/src/github.com/influxdata/telegraf/gotestsum'
- '/usr/local/Cellar/go'
Expand All @@ -178,11 +148,10 @@ commands:
steps:
- save_cache:
name: 'Saving binaries to cache'
key: go-bins-<< parameters.cache_version >>-<< parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: << parameters.os >>-<< parameters.arch >>-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~\project\gotestsum.exe'
- 'C:\Program Files\Go'
- 'C:\ProgramData\chocolatey\lib\mingw'
package-build:
parameters:
type:
Expand Down Expand Up @@ -232,12 +201,12 @@ jobs:
default: 1.21.5
cache_version:
type: string
default: "v1"
default: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: linux-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- check-changed-files-or-halt
- run: ./scripts/make_docs.sh
- run: 'make deps'
Expand All @@ -247,7 +216,7 @@ jobs:
- test-go
- save_cache:
name: "Save Go caches"
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: linux-amd64-go<< parameters.goversion >>-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '/go/pkg/mod'
- '~/.cache/golangci-lint'
Expand All @@ -264,12 +233,12 @@ jobs:
default: 1.21.5
cache_version:
type: string
default: "v1"
default: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: go-caches-<< parameters.cache_version >>-linux-386-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: linux-386-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- check-changed-files-or-halt
- run: 'GOARCH=386 make deps'
- run: 'GOARCH=386 make tidy'
Expand All @@ -278,7 +247,7 @@ jobs:
arch: "386"
- save_cache:
name: "Save Go caches"
key: go-caches-<< parameters.cache_version >>-linux-386-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: linux-386-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '/go/pkg/mod'
- '~/.cache/golangci-lint'
Expand All @@ -301,18 +270,18 @@ jobs:
default: 1.21.5
cache_version:
type: string
default: "v1"
default: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: go-caches-<< parameters.cache_version >>-darwin-arm64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: darwin-arm64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- test-go:
os: darwin
arch: arm64
- save_cache:
name: "Save Go caches"
key: go-caches-<< parameters.cache_version >>-darwin-arm64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: darwin-arm64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~/go/pkg/mod'
- '~/Library/Caches/golangci-lint'
Expand All @@ -324,7 +293,7 @@ jobs:
default: 1.21.5
cache_version:
type: string
default: "v1"
default: "v2"
executor:
name: win/default
shell: bash.exe
Expand All @@ -333,13 +302,13 @@ jobs:
- checkout
- restore_cache:
name: "Restore Go caches"
key: go-caches-<< parameters.cache_version >>-windows-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: windows-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- test-go:
os: windows
gotestsum: "gotestsum.exe"
- save_cache:
name: "Save Go caches"
key: go-caches-<< parameters.cache_version >>-windows-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: windows-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '~\go\pkg\mod'
- '~\AppData\Local\golangci-lint'
Expand All @@ -353,18 +322,18 @@ jobs:
default: 1.21.5
cache_version:
type: string
default: "v1"
default: "v2"
steps:
- checkout
- restore_cache:
name: "Restore Go caches"
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: linux-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
- check-changed-files-or-halt
- run: 'make build_tools'
- run: './tools/license_checker/license_checker -whitelist ./tools/license_checker/data/whitelist'
- save_cache:
name: "Save Go caches"
key: go-caches-<< parameters.cache_version >>-linux-amd64-go<< parameters.goversion >>-{{ checksum "go.sum" }}
key: linux-amd64-go<< parameters.goversion >>-cache-<< parameters.cache_version >>-{{ checksum "go.sum" }}
paths:
- '/go/pkg/mod'
- '~/.cache/golangci-lint'
Expand Down
8 changes: 4 additions & 4 deletions scripts/installgo_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ setup_go () {

sudo rm -rfv /usr/local/go
sudo tar -C /usr/local -xzf go${GO_VERSION}.${GO_ARCH}.tar.gz

echo "$PATH"
which go
go version
}

if command -v go >/dev/null 2>&1; then
Expand All @@ -30,7 +34,3 @@ if command -v go >/dev/null 2>&1; then
else
setup_go
fi

echo "$PATH"
command -v go
go version
5 changes: 1 addition & 4 deletions scripts/installgo_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ if command -v go >/dev/null 2>&1; then
echo "$v is installed, required version is ${GO_VERSION}"
if [ "$v" != ${GO_VERSION} ]; then
setup_go
go version
fi
else
setup_go
fi

echo "$PATH"
command -v go
go version
9 changes: 4 additions & 5 deletions scripts/installgo_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ set -eux
GO_VERSION="1.21.5"

setup_go () {
choco upgrade golang --allow-downgrade --force --version=${GO_VERSION}
rm -rf '/c/Program Files/Go'
choco upgrade golang --allow-downgrade --version=${GO_VERSION}
choco install make
git config --system core.longpaths true
}

Expand All @@ -15,11 +17,8 @@ if command -v go >/dev/null 2>&1; then
echo "$v is installed, required version is ${GO_VERSION}"
if [ "$v" != ${GO_VERSION} ]; then
setup_go
go version
fi
else
setup_go
fi

echo "$PATH"
command -v go
go version
28 changes: 0 additions & 28 deletions scripts/installmingw_windows.sh

This file was deleted.

0 comments on commit a2d44ff

Please sign in to comment.