-
Notifications
You must be signed in to change notification settings - Fork 32
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 commit hash implementation similar to kuadrantctl to authorino #473
Merged
guicassolato
merged 1 commit into
main
from
471-add-commit-hash-implementation-similar-to-kuadrantctl-to-authorino
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ vendor | |
tmp | ||
target | ||
.scannerwork | ||
build-recent.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
if ! command -v git &>/dev/null | ||
then | ||
echo "git not found..." >&2 | ||
exit 1 | ||
fi | ||
|
||
if output=$(git diff --stat 2>/dev/null) | ||
then | ||
[ -n "$output" ] && echo "true" || echo "false" | ||
else | ||
# Not a git repository | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks like we still have 2 ways to do the same thing more or less. Even though GHA and Makefile both seem to use the git ref, for some reason one does it straightforward and the other uses a file (two files!) in the process.
This GHA workflow (used to build and push the images to registry on pushes to main, releases and for PR testing) uses only the git ref straight away to infer the version info. The Makefile (used locally for dev/testing workflows), on the other hand, reads the version info from
build-recent.yaml
, while still generating this file (from abuild.yaml
"template") before every command, based on the git ref.I see two paths from here to fix this. We need to decide whether
build.yaml
will be the source for the version info or not.OPTION A:
build.yaml
is the source of version info:build.yaml
file locally (this is the base line, but keep reading to see the special case)build.yaml
must be a manual step only performed in preparation for releasesbuild.yaml
with the altered version info inside (i.e. "X.Y.Z"), unlike all other branches (including main) whosebuild.yaml
will always say "latest"build.yaml
build.yaml
without modifying the file. This will be the case mostly of when building from feature branches/PRs, both using the Makefile or via GHA. We probably don't needbuild-recent.yaml
for that.OPTION B:
build.yaml
is NOT the source:IMO, OPTION B looks much simpler. On the flip side, it doesn't give us the traceability, along with the code, about which version info would be stamped when building from that source. However, we're also introducing git shas and the
dirty
flag here. So I tend to think that storing the version info along with the code is not needed.But please let me know what you think @ehearneRedHat @eguzki @didierofrivia
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.
@guicassolato I think
OPTION B
looks to be easier but you would lose the traceability as you mentioned, but there would be less files to look to fix.I will await other responses before implementing.
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.
The
version
info in logs gives high level view of the version being used. Useful to know if some feature should be there or not.For us, developers,
version
is not accurate enough to debug and investigate issues. We want the git sha revision to know exactly the source code revision being run.I leave
version
management up to you guys.My take? version lives in
version.go
. Inmain
branch it isvX.Y.Z-dev
(where vX.Y.Z has not been released yet). Note that it is notlatest
ormain
as it is meaningless. In release branches it isvX.Y.Z
. In RELEASE.md file, there is an additional step to update thisversion.go
file. This is the approach we are taking in other kuadrant projects.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.
@didierofrivia what are your thoughts ?
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.
Going with OPTION B here for simplicity.