From 5d6acbc9b5860d6d8b8950aae8cab6255352cbe2 Mon Sep 17 00:00:00 2001 From: deansheather Date: Sun, 19 Jun 2022 00:05:34 +0000 Subject: [PATCH 1/5] chore: add debug statements to figure out why version.sh fails --- .github/workflows/release.yaml | 27 ++++++++++++++++++++++++--- scripts/version.sh | 6 +++--- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9f79c4512dd1d..2e72b8751ec16 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,11 +27,35 @@ env: jobs: linux-windows: runs-on: ubuntu-latest + env: + # Necessary for Docker manifest + DOCKER_CLI_EXPERIMENTAL: "enabled" steps: - uses: actions/checkout@v3 with: fetch-depth: 0 + - name: git tags + run: git tags + + - name: git rev-parse --short HEAD + run: git rev-parse --short HEAD + + - name: git describe --tags --abbrev=0 + run: git describe --tags --abbrev=0 + + - name: git describe --always + run: git describe --always + + - name: git log + run: "git log | head -n100" + + - name: ./scripts/version.sh + run: ./scripts/version.sh + + - name: exit early + run: exit 1 + - uses: actions/setup-go@v3 with: go-version: "~1.18" @@ -210,9 +234,6 @@ jobs: needs: - linux-windows - darwin - env: - # Necessary for Docker manifest - DOCKER_CLI_EXPERIMENTAL: "enabled" steps: - uses: actions/checkout@v3 with: diff --git a/scripts/version.sh b/scripts/version.sh index d924117fe9640..7b1093daf5617 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -10,7 +10,7 @@ # If $CODER_RELEASE is not set, the returned version will always be a dev # version. -set -euo pipefail +set -euxo pipefail # shellcheck source=scripts/lib.sh source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" cdroot @@ -28,12 +28,12 @@ if [[ "${CODER_RELEASE:-}" == *t* ]]; then if [[ "$last_tag" != "$(git describe --always)" ]]; then # make won't exit on $(shell cmd) failures, so we have to kill it :( if [[ "$(ps -o comm= "$PPID" || true)" == *make* ]]; then - log "ERROR: version.sh attemped to generate a dev version string when CODER_RELEASE was set" + log "ERROR: version.sh: the current commit is not tagged" kill "$PPID" || true exit 1 fi - error "version.sh attemped to generate a dev version string when CODER_RELEASE was set" + error "version.sh: the current commit is not tagged" fi else version+="-devel+$(git rev-parse --short HEAD)" From f49dfde0dde9ba0ff6c3e2404b1d321a56c50eb0 Mon Sep 17 00:00:00 2001 From: deansheather Date: Sun, 19 Jun 2022 00:07:39 +0000 Subject: [PATCH 2/5] fixup! chore: add debug statements to figure out why version.sh fails --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2e72b8751ec16..c9d2a26bcb8f2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,8 +35,8 @@ jobs: with: fetch-depth: 0 - - name: git tags - run: git tags + - name: git tag + run: git tag - name: git rev-parse --short HEAD run: git rev-parse --short HEAD From 382e5389d19c557ff34852923b4a513fdf8e1dd2 Mon Sep 17 00:00:00 2001 From: deansheather Date: Sun, 19 Jun 2022 00:15:08 +0000 Subject: [PATCH 3/5] fixup! chore: add debug statements to figure out why version.sh fails --- .github/workflows/release.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c9d2a26bcb8f2..c1d34b6a23d12 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -35,6 +35,14 @@ jobs: with: fetch-depth: 0 + # If the event that triggered the build was an annotated tag (which our + # tags are supposed to be), actions/checkout has a bug where the tag in + # question is only a lightweight tag and not a full annotated tag. This + # command seems to fix it. + # https://github.com/actions/checkout/issues/290 + - name: Fetch git tags + run: git fetch --tags --force + - name: git tag run: git tag @@ -157,6 +165,14 @@ jobs: with: fetch-depth: 0 + # If the event that triggered the build was an annotated tag (which our + # tags are supposed to be), actions/checkout has a bug where the tag in + # question is only a lightweight tag and not a full annotated tag. This + # command seems to fix it. + # https://github.com/actions/checkout/issues/290 + - name: Fetch git tags + run: git fetch --tags --force + - uses: actions/setup-go@v3 with: go-version: "~1.18" @@ -239,6 +255,14 @@ jobs: with: fetch-depth: 0 + # If the event that triggered the build was an annotated tag (which our + # tags are supposed to be), actions/checkout has a bug where the tag in + # question is only a lightweight tag and not a full annotated tag. This + # command seems to fix it. + # https://github.com/actions/checkout/issues/290 + - name: Fetch git tags + run: git fetch --tags --force + - name: Docker Login uses: docker/login-action@v2 with: From 899ce9545b826a1b8d51d294dd376863b16716fb Mon Sep 17 00:00:00 2001 From: deansheather Date: Sun, 19 Jun 2022 00:16:56 +0000 Subject: [PATCH 4/5] fix: run git fetch --tags --force during release --- .github/workflows/release.yaml | 21 --------------------- scripts/version.sh | 2 +- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index c1d34b6a23d12..a6e9e5612d4e0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -43,27 +43,6 @@ jobs: - name: Fetch git tags run: git fetch --tags --force - - name: git tag - run: git tag - - - name: git rev-parse --short HEAD - run: git rev-parse --short HEAD - - - name: git describe --tags --abbrev=0 - run: git describe --tags --abbrev=0 - - - name: git describe --always - run: git describe --always - - - name: git log - run: "git log | head -n100" - - - name: ./scripts/version.sh - run: ./scripts/version.sh - - - name: exit early - run: exit 1 - - uses: actions/setup-go@v3 with: go-version: "~1.18" diff --git a/scripts/version.sh b/scripts/version.sh index 7b1093daf5617..c3d2c52d12bda 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -10,7 +10,7 @@ # If $CODER_RELEASE is not set, the returned version will always be a dev # version. -set -euxo pipefail +set -euo pipefail # shellcheck source=scripts/lib.sh source "$(dirname "${BASH_SOURCE[0]}")/lib.sh" cdroot From 41b274652ad988ca89ff43a4e2ac8dde97b2dc5b Mon Sep 17 00:00:00 2001 From: deansheather Date: Sun, 19 Jun 2022 00:21:17 +0000 Subject: [PATCH 5/5] fixup! fix: run git fetch --tags --force during release --- scripts/version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/version.sh b/scripts/version.sh index c3d2c52d12bda..220da35328a27 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -28,12 +28,12 @@ if [[ "${CODER_RELEASE:-}" == *t* ]]; then if [[ "$last_tag" != "$(git describe --always)" ]]; then # make won't exit on $(shell cmd) failures, so we have to kill it :( if [[ "$(ps -o comm= "$PPID" || true)" == *make* ]]; then - log "ERROR: version.sh: the current commit is not tagged" + log "ERROR: version.sh: the current commit is not tagged with an annotated tag" kill "$PPID" || true exit 1 fi - error "version.sh: the current commit is not tagged" + error "version.sh: the current commit is not tagged with an annotated tag" fi else version+="-devel+$(git rev-parse --short HEAD)"