From f39c95f78fd7a3adb2dcaa2016c06208e1a873f2 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 8 Jun 2022 13:23:59 -0400 Subject: [PATCH 1/4] append GitHub run_id as build number suffix for smoketest versions --- .github/workflows/main.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7db4b257c..f1e31e664 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -143,10 +143,13 @@ jobs: $(go env GOPATH)/bin/ziti-ci tag -v -f version $(go env GOPATH)/bin/ziti-ci publish-to-github - - name: Get Ziti Version + # only ziti-ci computed version for release branches and {version}-{run_id} for non-release branches + - name: Compute the Ziti Version String for CI Jobs id: get_version env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REF: ${{ github.ref }} + GITHUB_RUN_ID: ${{ github.run_id }} run: | ZITI_VERSION="$($(go env GOPATH)/bin/ziti-ci -q get-current-version)" # drop the leading 'v', if any @@ -155,8 +158,13 @@ jobs: # fail the job because we could not obtain the current version from ziti-ci echo "ERROR: ZITI_VERSION=${ZITI_VERSION}" exit 1 + elif ! [[ "${GITHUB_REF}" =~ ^refs/heads/release-v ]] + # Set output parameters for release branches + echo "DEBUG: ZITI_VERSION=${ZITI_VERSION}" + echo ::set-output name=ziti-version::${ZITI_VERSION} else - # Set output parameters. + # Append build / run number for non-release refs + ZITI_VERSION="${ZITI_VERSION}-${GITHUB_RUN_ID}" echo "DEBUG: ZITI_VERSION=${ZITI_VERSION}" echo ::set-output name=ziti-version::${ZITI_VERSION} fi From 500672662262541841c045b702e9664118de4d86 Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 8 Jun 2022 13:30:46 -0400 Subject: [PATCH 2/4] invert conditional --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f1e31e664..420f12cc8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -158,7 +158,7 @@ jobs: # fail the job because we could not obtain the current version from ziti-ci echo "ERROR: ZITI_VERSION=${ZITI_VERSION}" exit 1 - elif ! [[ "${GITHUB_REF}" =~ ^refs/heads/release-v ]] + elif [[ "${GITHUB_REF}" =~ ^refs/heads/release-v ]] # Set output parameters for release branches echo "DEBUG: ZITI_VERSION=${ZITI_VERSION}" echo ::set-output name=ziti-version::${ZITI_VERSION} From d0f5eb76d474127e793daa805a752f268654eb2d Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 8 Jun 2022 13:46:03 -0400 Subject: [PATCH 3/4] fix bash syntax --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 420f12cc8..f17bc2c78 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -158,7 +158,7 @@ jobs: # fail the job because we could not obtain the current version from ziti-ci echo "ERROR: ZITI_VERSION=${ZITI_VERSION}" exit 1 - elif [[ "${GITHUB_REF}" =~ ^refs/heads/release-v ]] + elif [[ "${GITHUB_REF}" =~ ^refs/heads/release-v ]]; then # Set output parameters for release branches echo "DEBUG: ZITI_VERSION=${ZITI_VERSION}" echo ::set-output name=ziti-version::${ZITI_VERSION} From 65da4bfbfc4ee0e88b0a88078b42a2380165d64b Mon Sep 17 00:00:00 2001 From: Kenneth Bingham Date: Wed, 8 Jun 2022 14:04:26 -0400 Subject: [PATCH 4/4] also omit CI version suffix if branch == main --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f17bc2c78..e42e5f36f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -158,7 +158,7 @@ jobs: # fail the job because we could not obtain the current version from ziti-ci echo "ERROR: ZITI_VERSION=${ZITI_VERSION}" exit 1 - elif [[ "${GITHUB_REF}" =~ ^refs/heads/release-v ]]; then + elif [[ "${GITHUB_REF}" =~ ^refs/heads/(release-v|main/) ]]; then # Set output parameters for release branches echo "DEBUG: ZITI_VERSION=${ZITI_VERSION}" echo ::set-output name=ziti-version::${ZITI_VERSION}