-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add git version on build in logs, OTEL metadata and API #873
Conversation
06914d9
to
17a1a19
Compare
c4e5313
to
0cb4986
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 but the code to actually read the env var is missing, no ?
No worries about the unauthenticated endpoint, there is already another one (the liveness one)
There is no env var, it uses a build option that sets a global variable during compilation ( |
Oh, got it. |
0cb4986
to
e932b33
Compare
@@ -9,6 +9,11 @@ import ( | |||
"github.com/checkmarble/marble-backend/utils" | |||
) | |||
|
|||
// Static variable set at compilation-time through linker flags. | |||
// | |||
// $ go build -ldflags '-X main.apiVersion=v0.10.0' . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏
This PR adds an endpoint to retrieve the running version of the API. It is a bit more involved than expected:
dev
git describe --tags
, which will render:v0.36.1
if on a tagv0.36.1-2-g123456
if not (the latest tag, the number of commit since, and the sha of the commit), useful for staging/version
endpoint for the frontend to use@Pascal-Delange, right now the endpoint is unauthenticated, which could be considered a security issue (leaking the version of the software). But we want to display it on the login screen as well, which would require it being unauthenticated. Also, the version would be leaked by the frontend code itself anyway, so it would not be worse. Just pointing it out.
Also @Pascal-Delange, this touches the deploy script (through the
Dockerfile
, so I want to check I did not miss a usage of the initialversion
variable that I changed).