Skip to content

Commit

Permalink
[ENGINE-978] Change revision scheme per ENGINE-970 requirements
Browse files Browse the repository at this point in the history
Signed-off-by: plaurent <[email protected]>
  • Loading branch information
psaintlaurent committed Aug 28, 2024
1 parent 0bf7237 commit f572f87
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion hack/build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ set -e
: "${REVISION=$(./hack/git-meta revision)}"
: "${PRERELEASE=$(./hack/git-meta version | rev | cut -c3- | rev | cut -d'-' -f 2 | grep -E '(^tp|^rc).*')}"
: "${REVISION_NUMBER=1}"
VERSION=$(printf "v%sm%s%s" "$(./hack/git-meta version | rev | cut -c3- | rev | cut -d'-' -f 1 | cut -c2-)" "${REVISION_NUMBER}" "-${PRERELEASE}")

if [ -n "$PRERELEASE" ]; then
PRERELEASE="-$PRERELEASE"
fi

VERSION=$(printf "v%sm%s%s" "$(./hack/git-meta version | rev | cut -c3- | rev | cut -d'-' -f 1 | cut -c2-)" "${REVISION_NUMBER}" "${PRERELEASE}")

: "${CGO_ENABLED=0}"
: "${GO_PKG=github.com/docker/buildx}"
Expand Down
4 changes: 2 additions & 2 deletions tests/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func testVersion(t *testing.T, sb integration.Sandbox) {
// This defaults to something that's still compatible
// with semver.
version := fields[1]
regex, err := regexp.CompilePOSIX("^v[0-9]+.[0-9]+.[0-9]+(m[0-9]+|m[0-9]+-rc[0-9]+|m[0-9]+-tp[0-9]+)$")
require.True(t, err == nil && regex.MatchString(version), "Second field was not valid: %+v", version)
regex := regexp.MustCompilePOSIX("^v[0-9]+.[0-9]+.[0-9]+(m[0-9]+|m[0-9]+-rc[0-9]+|m[0-9]+-tp[0-9]+)$")
require.True(t, regex.MatchString(version), "Second field was not valid: %+v", version)

// Revision should be empty or should look like a git hash.
if len(fields) > 2 && len(fields[2]) > 0 {
Expand Down

0 comments on commit f572f87

Please sign in to comment.