From b91025abbb7a59a132c54b7511c09711d69687a1 Mon Sep 17 00:00:00 2001 From: James Blair Date: Thu, 4 May 2023 14:13:39 +1200 Subject: [PATCH] Backport centralising go version for actions workflows. Signed-off-by: James Blair --- .github/workflows/e2e.yaml | 5 ++++- .github/workflows/functional.yaml | 5 ++++- .github/workflows/go-version.yaml | 22 ++++++++++++++++++++++ .github/workflows/grpcproxy.yaml | 5 ++++- .github/workflows/release.yaml | 5 ++++- .github/workflows/tests.yaml | 5 ++++- Makefile | 2 +- scripts/release | 2 +- 8 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/go-version.yaml diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 01f9a742179..1f5be58c509 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -1,8 +1,11 @@ name: E2E on: [push, pull_request] jobs: + goversion: + uses: ./.github/workflows/go-version.yaml test: runs-on: ubuntu-latest + needs: goversion strategy: fail-fast: true matrix: @@ -13,7 +16,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.19.8" + go-version: ${{ needs.goversion.outputs.goversion }} - run: date - env: TARGET: ${{ matrix.target }} diff --git a/.github/workflows/functional.yaml b/.github/workflows/functional.yaml index 60c31e9a562..bd1ae1a95eb 100644 --- a/.github/workflows/functional.yaml +++ b/.github/workflows/functional.yaml @@ -1,8 +1,11 @@ name: functional-tests on: [push, pull_request] jobs: + goversion: + uses: ./.github/workflows/go-version.yaml test: runs-on: ubuntu-latest + needs: goversion strategy: fail-fast: true matrix: @@ -12,7 +15,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.19.8" + go-version: ${{ needs.goversion.outputs.goversion }} - run: date - env: TARGET: ${{ matrix.target }} diff --git a/.github/workflows/go-version.yaml b/.github/workflows/go-version.yaml new file mode 100644 index 00000000000..2bbc423094e --- /dev/null +++ b/.github/workflows/go-version.yaml @@ -0,0 +1,22 @@ +name: Go version setup + +env: + GO_VERSION: "1.19.8" + +on: + workflow_call: + outputs: + goversion: + value: ${{ jobs.version.outputs.goversion }} + +jobs: + version: + name: Set Go version variable for all the workflows + runs-on: ubuntu-latest + outputs: + goversion: ${{ steps.step1.outputs.goversion }} + steps: + - id: step1 + run: | + echo "Go Version: $GO_VERSION" + echo "goversion=$GO_VERSION" >> $GITHUB_OUTPUT diff --git a/.github/workflows/grpcproxy.yaml b/.github/workflows/grpcproxy.yaml index b07301af5d1..0710b7327d5 100644 --- a/.github/workflows/grpcproxy.yaml +++ b/.github/workflows/grpcproxy.yaml @@ -1,8 +1,11 @@ name: grpcProxy-tests on: [push, pull_request] jobs: + goversion: + uses: ./.github/workflows/go-version.yaml test: runs-on: ubuntu-latest + needs: goversion strategy: fail-fast: true matrix: @@ -12,7 +15,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.19.8" + go-version: ${{ needs.goversion.outputs.goversion }} - run: date - env: TARGET: ${{ matrix.target }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 88819cb9e2a..9e3ab006fc6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,13 +1,16 @@ name: Release on: [push, pull_request] jobs: + goversion: + uses: ./.github/workflows/go-version.yaml main: runs-on: ubuntu-latest + needs: goversion steps: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.19.8" + go-version: ${{ needs.goversion.outputs.goversion }} - name: release run: | set -euo pipefail diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 53e67a62b3b..2bde2eedfb0 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,8 +1,11 @@ name: Tests on: [push, pull_request] jobs: + goversion: + uses: ./.github/workflows/go-version.yaml test: runs-on: ubuntu-latest + needs: goversion strategy: fail-fast: false matrix: @@ -18,7 +21,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: "1.19.8" + go-version: ${{ needs.goversion.outputs.goversion }} - run: date - env: TARGET: ${{ matrix.target }} diff --git a/Makefile b/Makefile index 6e982f014aa..3af91a19042 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ docker-remove: -GO_VERSION ?= 1.19.8 +GO_VERSION ?= 1.19.9 ETCD_VERSION ?= $(shell git rev-parse --short HEAD || echo "GitNotFound") TEST_SUFFIX = $(shell date +%s | base64 | head -c 15) diff --git a/scripts/release b/scripts/release index b3a6dd0de5f..0b881073a22 100755 --- a/scripts/release +++ b/scripts/release @@ -112,7 +112,7 @@ main() { # Check go version. log_callout "Check go version" local go_version current_go_version - go_version="go$(grep go-version .github/workflows/tests.yaml | awk '{print $2}' | tr -d '"')" + go_version="go$(grep -oP '(?<=GO_VERSION:\s")[^"]*' .github/workflows/go-version.yaml | tr -d ' ')" current_go_version=$(go version | awk '{ print $3 }') if [[ "${current_go_version}" != "${go_version}" ]]; then log_error "Current go version is ${current_go_version}, but etcd ${RELEASE_VERSION} requires ${go_version} (see .travis.yml)."