From e8ff45d8abaebbad5c7d2dcec8d0824c399770ab Mon Sep 17 00:00:00 2001 From: Hamid Ghaf <83242695+hghaf099@users.noreply.github.com> Date: Fri, 29 Apr 2022 12:28:43 -0400 Subject: [PATCH] Upgrade CircleCI machine image (#15215) * Upgrade CircleCI machine image * setting the path for ci-verify * create GOPATH/bin This is because CI failed with cp: cannot create regular file '/home/circleci/go/bin/': Not a directory * Update .circleci/config/jobs/pre-flight-checks.yml Co-authored-by: Tom Proctor * updating config.yml * source BASH_ENV Co-authored-by: Tom Proctor --- .circleci/config.yml | 18 ++++++++++++++---- .circleci/config/commands/setup-go.yml | 1 + .circleci/config/executors/@executors.yml | 3 ++- .circleci/config/jobs/pre-flight-checks.yml | 7 ++++++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index acf48e30d7..eb65033e42 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -99,7 +99,8 @@ jobs: make test-ui-browserstack name: Run Browserstack Tests build-go-dev: - machine: true + machine: + image: ubuntu-2004:202201-02 shell: /usr/bin/env bash -euo pipefail -c working_directory: /home/circleci/go/src/github.com/hashicorp/vault steps: @@ -113,6 +114,7 @@ jobs: rm -f "go${GO_VERSION}.linux-amd64.tar.gz" GOPATH="/home/circleci/go" mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; } + mkdir $GOPATH/bin 2>/dev/null || { sudo mkdir $GOPATH/bin && sudo chmod 777 $GOPATH/bin; } echo "export GOPATH='$GOPATH'" >> "$BASH_ENV" echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV" echo "export GOPROXY=off" >> "$BASH_ENV" @@ -346,7 +348,8 @@ jobs: - CIRCLECI_CLI_VERSION: 0.1.5546 - GO_TAGS: '' fmt: - machine: true + machine: + image: ubuntu-2004:202201-02 shell: /usr/bin/env bash -euo pipefail -c working_directory: /home/circleci/go/src/github.com/hashicorp/vault steps: @@ -360,6 +363,7 @@ jobs: rm -f "go${GO_VERSION}.linux-amd64.tar.gz" GOPATH="/home/circleci/go" mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; } + mkdir $GOPATH/bin 2>/dev/null || { sudo mkdir $GOPATH/bin && sudo chmod 777 $GOPATH/bin; } echo "export GOPATH='$GOPATH'" >> "$BASH_ENV" echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV" echo "export GOPROXY=https://proxy.golang.org,direct" >> "$BASH_ENV" @@ -782,7 +786,8 @@ jobs: command: "# Alpine images can't run the make file due to a bash requirement. Run\n# semgrep explicitly here. \nexport PATH=\"$HOME/.local/bin:$PATH\" \nsemgrep --error --include '*.go' --exclude 'vendor' -f tools/semgrep/ci .\n" name: Run Semgrep Rules pre-flight-checks: - machine: true + machine: + image: ubuntu-2004:202201-02 shell: /usr/bin/env bash -euo pipefail -c working_directory: /home/circleci/go/src/github.com/hashicorp/vault steps: @@ -796,6 +801,7 @@ jobs: rm -f "go${GO_VERSION}.linux-amd64.tar.gz" GOPATH="/home/circleci/go" mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; } + mkdir $GOPATH/bin 2>/dev/null || { sudo mkdir $GOPATH/bin && sudo chmod 777 $GOPATH/bin; } echo "export GOPATH='$GOPATH'" >> "$BASH_ENV" echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV" echo "export GOPROXY=https://proxy.golang.org,direct" >> "$BASH_ENV" @@ -826,7 +832,11 @@ jobs: BASE: https://github.com/CircleCI-Public/circleci-cli/releases/download name: Install CircleCI CLI - run: - command: make ci-verify + command: | + set -x + . $BASH_ENV + make ci-verify + name: Verify CircleCI - add_ssh_keys: fingerprints: - 0e:03:77:f4:e2:c3:56:c2:53:6a:03:e1:31:91:2f:06 diff --git a/.circleci/config/commands/setup-go.yml b/.circleci/config/commands/setup-go.yml index a06d2f1099..715c4d6f4d 100644 --- a/.circleci/config/commands/setup-go.yml +++ b/.circleci/config/commands/setup-go.yml @@ -24,6 +24,7 @@ steps: rm -f "go${GO_VERSION}.linux-amd64.tar.gz" GOPATH="/home/circleci/go" mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; } + mkdir $GOPATH/bin 2>/dev/null || { sudo mkdir $GOPATH/bin && sudo chmod 777 $GOPATH/bin; } echo "export GOPATH='$GOPATH'" >> "$BASH_ENV" echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV" echo "export GOPROXY=<>" >> "$BASH_ENV" diff --git a/.circleci/config/executors/@executors.yml b/.circleci/config/executors/@executors.yml index cbf6da1002..5b03007bdc 100644 --- a/.circleci/config/executors/@executors.yml +++ b/.circleci/config/executors/@executors.yml @@ -1,5 +1,6 @@ go-machine: - machine: true + machine: + image: ubuntu-2004:202201-02 shell: /usr/bin/env bash -euo pipefail -c environment: CIRCLECI_CLI_VERSION: 0.1.5546 # Pin CircleCI CLI to patch version (ex: 1.2.3) diff --git a/.circleci/config/jobs/pre-flight-checks.yml b/.circleci/config/jobs/pre-flight-checks.yml index f639bbd57e..347a6a7def 100644 --- a/.circleci/config/jobs/pre-flight-checks.yml +++ b/.circleci/config/jobs/pre-flight-checks.yml @@ -24,6 +24,11 @@ steps: . $BASH_ENV which circleci circleci version - - run: make ci-verify + - run: + name: Verify CircleCI + command: | + set -x + . $BASH_ENV + make ci-verify - configure-git - refresh_go_mod_cache