diff --git a/.github/workflows/tests-integration-reusable.yml b/.github/workflows/tests-integration-reusable.yml index 4e1ee3cc356..518b866920f 100644 --- a/.github/workflows/tests-integration-reusable.yml +++ b/.github/workflows/tests-integration-reusable.yml @@ -50,6 +50,7 @@ jobs: uses: actions/checkout@v4 with: ref: ${{inputs.gitRef}} + fetch-depth: 0 - name: Checkout cf-acceptance-tests if: ${{ inputs.name == 'cats' }} diff --git a/.github/workflows/tests-integration.yml b/.github/workflows/tests-integration.yml index ed988c0eb31..20e220df18d 100644 --- a/.github/workflows/tests-integration.yml +++ b/.github/workflows/tests-integration.yml @@ -99,6 +99,7 @@ jobs: if: ${{ inputs.run_unit_tests }} with: ref: ${{needs.get-sha.outputs.gitRef}} + fetch-depth: 0 - name: Set Up Go uses: actions/setup-go@v5 if: ${{ inputs.run_unit_tests }} diff --git a/Makefile b/Makefile index fca5f3607dd..8d1dd2ffa69 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ FLAKE_ATTEMPTS ?=5 PACKAGES ?= api actor command types util version integration/helpers LC_ALL = "en_US.UTF-8" +CF_BUILD_VERSION ?= $$(git describe --tags --abbrev=0) CF_BUILD_SHA ?= $$(git rev-parse --short HEAD) CF_BUILD_DATE ?= $$(date -u +"%Y-%m-%d") LD_FLAGS_COMMON=-w -s \ diff --git a/version/version.go b/version/version.go index 47a77f878d5..4878c51b59a 100644 --- a/version/version.go +++ b/version/version.go @@ -1,6 +1,10 @@ package version -import "github.com/blang/semver/v4" +import ( + "strings" + + "github.com/blang/semver/v4" +) const DefaultVersion = "0.0.0-unknown-version" @@ -11,6 +15,8 @@ var ( ) func VersionString() string { + // Remove the "v" prefix from the binary in case it is present + binaryVersion = strings.TrimPrefix(binaryVersion, "v") versionString, err := semver.Make(binaryVersion) if err != nil { versionString = semver.MustParse(DefaultVersion)