Skip to content

Add version to CLI and RP image#232

Merged
rynowak merged 1 commit intomainfrom
rynowak/versioning
Apr 15, 2021
Merged

Add version to CLI and RP image#232
rynowak merged 1 commit intomainfrom
rynowak/versioning

Conversation

@rynowak
Copy link
Copy Markdown
Contributor

@rynowak rynowak commented Apr 14, 2021

Fixes: #37

Part of: #231

This change adds version info to our binary builds and our RP image.

Fixes: #37

Part of: #231

This change adds version info to our binary builds and our RP image.
@rynowak
Copy link
Copy Markdown
Contributor Author

rynowak commented Apr 14, 2021

Output looks like:

radius on  rynowak/versioning [!?] via 🐹 v1.16.3 took 7s
➜ ./dist/darwin_amd64/release/rad --version
Release: edge
Version: 8dbe2b0-dirty
Commit: 8dbe2b002cf3a980a084a158abcc5fa8c54203fc

Why 3 things?

  • Release is the semver release version
  • Commit is the full SHA of the git commit
  • Version is the git describe output.

That last one is really handy. It basically is the best description that git can give you. It will include the lastest tag (when we have one), the number of commits since the tag (when we have one) as well as whether the repo was clean or dirty when the build took place (really useful for detecting a mistake or someone using a dev build when they thought it was a release).

@emily-potyraj
Copy link
Copy Markdown
Contributor

Nice! This is going to help QA and bug tracking a lot.

@rynowak rynowak requested a review from kachawla April 14, 2021 21:27
Comment thread Makefile
BINS_OUT_DIR := $(OUT_DIR)/$(GOOS)_$(GOARCH)/$(BUILDTYPE_DIR)
LDFLAGS := "-s -w -X main.version=$(REL_VERSION)"
BASE_PACKAGE_NAME := github.com/Azure/radius
LDFLAGS := "-s -w -X $(BASE_PACKAGE_NAME)/pkg/version.release=$(REL_VERSION) -X $(BASE_PACKAGE_NAME)/pkg/version.commit=$(GIT_COMMIT) -X $(BASE_PACKAGE_NAME)/pkg/version.version=$(GIT_VERSION)"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

-X allows the linker to set the value of a package-level variable so that it can be read later inside the app.

@rynowak rynowak merged commit 06fbc54 into main Apr 15, 2021
@rynowak rynowak deleted the rynowak/versioning branch April 15, 2021 00:19
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.

rad --version

3 participants