Skip to content

Conversation

@ariefrahmansyah
Copy link

Signed-off-by: Arief Rahmansyah [email protected]

@ariefrahmansyah
Copy link
Author

#1709

@ariefrahmansyah
Copy link
Author

ariefrahmansyah commented Oct 23, 2019

The output will be like this:

level=info ts=2019-10-23T13:03:02.776071Z caller=main.go:72 msg="Starting Cortex" version="(version=0.3.0, branch=master, revision=b80d1f615fc7ed1c331d98f9228fb0e30f6a3b9a)"

Notes:

  1. GIT_BRANCH instead of /tools/image-tag@master, because image-tag produces branch_name-git_revision[-WIP] while we only need branch name.

  2. I keep VERSION file. I agree that the VERSION file value is often not in sync with the commit. But we still can refer to it, since it's must be bumped for every release to keep it in sync.

@bboreham
Copy link
Contributor

GIT_BRANCH instead of /tools/image-tag@master, because image-tag produces branch_name-git_revision[-WIP] while we only need branch name.

To me, the WIP part can be very interesting.
40 chars of revision is not; 12 or 16 is plenty.

@bboreham
Copy link
Contributor

bboreham commented Nov 4, 2019

Am I reading this right: you now have short commit sha in the 'branch' field, and long sha in 'revision' ?

Is this what anyone wants?

VERSION := $(shell cat VERSION)
GIT_BRANCH := $(shell ./tools/image-tag)
GIT_REVISION := $(shell git rev-parse HEAD)
GO_LDFLAGS := -X github.com/prometheus/common/version.Version=$(VERSION) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that this will break in Go 1.14, which will use vendor directory by default, if present and go.mod specifies go 1.14. Vendored dependencies need to be specified as github.com/cortexproject/cortex/vendor/github.com/prometheus/common/version :-(

I think easiest solution to handle both scenarios is to have simple build.go in the Cortex project, that will then set Prometheus values in init method.

@pracucci
Copy link
Contributor

@ariefrahmansyah Are you still interested into this PR? If so, I would suggest you to rebase master and reiterate based on the received feedback.

@pracucci
Copy link
Contributor

pracucci commented Feb 7, 2020

I'm going to close this PR due to inactivity. Feel free to reopen it in case you're still interested into working on this.

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.

4 participants