pkg icon indicating copy to clipboard operation
pkg copied to clipboard

changeset: allow override the revision through ldflags

Open vdemeester opened this issue 3 years ago • 5 comments

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

NONE

vdemeester avatar Sep 28 '22 13:09 vdemeester

Codecov Report

Base: 81.29% // Head: 81.29% // Increases project coverage by +0.00% :tada:

Coverage data is based on head (5a282d8) compared to base (6d71868). Patch coverage: 100.00% of modified lines in pull request are covered.

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           
Impacted Files Coverage Δ
changeset/commit.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Sep 28 '22 14:09 codecov[bot]

/test unit-tests

vdemeester avatar Sep 28 '22 14:09 vdemeester

Do we still need this if we go with https://github.com/tektoncd/pipeline/pull/5573 ?

imjasonh avatar Sep 28 '22 16:09 imjasonh

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 🙃.

vdemeester avatar Sep 28 '22 16:09 vdemeester

So what's the ld flag to set rev ?

dprotaso avatar Nov 01 '22 17:11 dprotaso

@dprotaso it would be something like

go build -ldflags="-X 'knative.dev/pkg/changeset.rev={the-commit-sha-or-something}'"

vdemeester avatar Nov 02 '22 15:11 vdemeester

/lgtm /approve

dprotaso avatar Nov 02 '22 19:11 dprotaso

[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 /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

knative-prow[bot] avatar Nov 02 '22 19:11 knative-prow[bot]

/retest

dprotaso avatar Nov 02 '22 20:11 dprotaso