Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(version): append commit hash on build via ldflags #342

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

khos2ow
Copy link

@khos2ow khos2ow commented May 29, 2024

This PR follows up the attempts on #301 and #302.

It standardize resonate binary version to:

resonate version v<VERSION>[-<PRE_RELEASE>-<TIMESTAMP>][ COMMIT_HASH] <GOOS>/<GOARCH>

where:

  • VERSION: the release version
  • PRE_RELEASE: can be any arbitrary string, e.g. alpha, beta, rc.1, etc
  • TIMESTAMP: the yyyymmdd of build IF this is not a GA release
  • COMMIT_HASH: short revision IF this is a GA release
  • GOOS: underlying OS this binary built on
  • GOARCH: underlying Architecture this binary built on

This also adds a new version subcommand for convenience and to not give an error on resonate version for folks with muscle memory for it.

Two manual intervention is needed for this workflow:

  1. At the beginning of a release cycle:
    • bump coreVersion in internal/version/version.go to next logical release
    • set prerelease to alpha (or dev, or similar) in internal/version/version.go
  2. At the end of a release cycle (beta, RC, GA):
    • set prerlease to "" in internal/version/version.go for GA, or just leave it as is for the rest

The rest will be calculated, or generated on the fly.

Fixes: #298

@khos2ow
Copy link
Author

khos2ow commented May 29, 2024

@guergabo based on all the discussions on the other two PRs, IMO this will work. Although the nix part has to be checked as I'm not too familiar with nix syntax.

@khos2ow khos2ow force-pushed the version-cmd branch 2 times, most recently from d3a0d22 to 264019d Compare May 29, 2024 17:10
It standardize resonate binary version to:

resonate version v<VERSION>[-<PRE_RELEASE>-<TIMESTAMP>][ COMMIT_HASH] <GOOS>/<GOARCH>

where:

- `VERSION`: the release version
- `PRE_RELEASE`: can be any arbitrary string, e.g. `alpha`, `beta`, `rc.1`, etc
- `TIMESTAMP`: the yyyymmdd of build IF this is not a GA release
- `COMMIT_HASH`: short revision IF this is a GA release
- `GOOS`: underlying OS this binary built on
- `GOARCH`: underlying Architecture this binary built on

This also adds a new `version` subcommand for convenience and to not
give an error on `resonate version` for folks with muscle memory for
it.

Signed-off-by: Khosrow Moossavi <[email protected]>
@@ -34,7 +34,6 @@ jobs:
run: |
# Extract resonate version
RESONATE_VERSION=$(./resonate -v | awk '{print $3}')
RESONATE_VERSION="v${RESONATE_VERSION}"
Copy link
Author

@khos2ow khos2ow May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will solve the workflow, but I'm not aware of any other breaking change that this might introduce in the broader resonate landscape, if any. Because effectively resonate --version will always have a leading v and tailing <os>/<arch>, if move forward with this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add version command
1 participant