-
Notifications
You must be signed in to change notification settings - Fork 331
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
changeset: allow override the revision through ldflags #2601
Conversation
changeset/commit.go
Outdated
// Revision contains the revision of the binary. | ||
// It is exported so that it can be overriden using ldflags. | ||
// By default, it will use 'vcs.revision' property from the embedded build information | ||
// Note: Use changeset.Get() to get it instead of through this variable. |
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.
Can ldflags only set an exported var? Can we just unexport this?
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.
hum that was my initial though (because it's been a long time since I did that…). Let me test it out.
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.
ah seems like it works with unexported, let me update this.
de33196
to
06c6c2c
Compare
The main reason for this is to support cases where the `go build` happens on a non git folder but we want to pass a revision anyway. Signed-off-by: Vincent Demeester <[email protected]>
06c6c2c
to
5a282d8
Compare
Codecov ReportBase: 81.29% // Head: 81.29% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2601 +/- ##
=======================================
Coverage 81.29% 81.29%
=======================================
Files 162 162
Lines 9820 9821 +1
=======================================
+ Hits 7983 7984 +1
Misses 1597 1597
Partials 240 240
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
/test unit-tests |
Do we still need this if we go with tektoncd/pipeline#5573 ? |
Yes, this is unrelated with tektoncd/pipeline#5573 👼🏼. Downstream, we are building tekton (and I guess knative as well), through a cachito cache/proxy, which means, when we build the project, we are not in a git repository (we have the information about it but we are not). Hence proposing this to be able to set the correct revision in that case 🙃. |
So what's the ld flag to set |
@dprotaso it would be something like
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dprotaso, imjasonh, vdemeester The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
Changes
The main reason for this is to support cases where the
go build
happens on a non git folder but we want to pass a revision anyway.Signed-off-by: Vincent Demeester [email protected]
/kind enhancement
/cc @imjasonh @dprotaso
Release Note