-
Notifications
You must be signed in to change notification settings - Fork 39.7k
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
gitVersion results in inconsistent string values #99376
Comments
@imjasonh: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Thanks for the report. Moving to kubernetes/kubernetes where this source comes from. There's not a lot we can do for past releases, but I'd be in favor of switching to %H going forward. Reproducibility of source archives is important. |
/sig release |
/kind bug |
Thanks for taking this on @liggitt !! 🎉 |
@liggitt @neolit123 since we don't actually use |
and before that it was cri-o/cri-o#4820 and before that containers/podman#9355, so everywhere |
@jonyhy96 @afbjorklund I have created kubernetes/publishing-bot#285 to stop including the |
Ref. ko-build/ko#315 (comment)
pkg/version/base.go includes:
This
$Format:%h$
directive, activated bygit archive
and the.gitattributes
containing the linebase.go export-subst
, results in file contents served by GitHub Archives that can change in unexpected ways. For example, the length of the commit SHA can expand over time as there are collisions.This non-determinism can lead to surprises, such as ko-build/ko#315, where a client-go dependency resulted in unexpectedly different tar hashes, which was detected when a new version of the ko binary was being added to Homebrew.
tl;dr: though the client-go dependency itself didn't change for ko, later runs of
git archive
(via GitHub Archives) resulted in different contents for thegitVersion
string to avoid a new collision for the previous prefix length, which cascaded into different content SHAs and shady-looking binary SHAs.I'm not sure, but after reading docs I believe you could naively solve this by replacing
$Format:%h$
with$Format:%H$
so thegitVersion
string includes the full commit hash instead of the abbreviated one.I have no idea if anything depends on
gitVersion
being a shorter string, but presumably things are fine with it having been a variable-length string so 🤷♂️ . Given enough time/collisions, I suppose theoretically%h
will slow grow to be equal to%H
, but I don't think that will happen during any of our lifetimes 👴cc @Bo98
The text was updated successfully, but these errors were encountered: