-
Notifications
You must be signed in to change notification settings - Fork 200
report correct version when multiple images invoked #327
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
Merged
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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,17 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
function version() { | ||
# get version from image | ||
version=$( \ | ||
oc status | grep '^pod' | \ | ||
sed -n -r -e 's/.*([[:digit:]]+\.[[:digit:]]+(:?\.[[:digit:]])?(:?-[^@]+)?).*/\1/p' \ | ||
) | ||
|
||
# if version not found, fallback to imageID | ||
[ -z "${version}" ] && version=$(oc status | grep '^pod.*runs' | sed -r -e 's/^pod.*runs //') | ||
|
||
# if version still not found, use Unknown | ||
[ -z "${version}" ] && version="Unknown" | ||
|
||
echo ${version} | ||
if [[ ! -z $OS_GIT_VERSION ]] ; then | ||
echo "${OS_GIT_VERSION}" | ||
else | ||
echo "0.0.0-unknown" | ||
fi | ||
} |
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.
OS_GIT_VERSION
is defined only during the building phase. Once built, the env gets unpopulated. What about to inject the env value in https://github.com/openshift/must-gather/blob/master/Dockerfile.rhel7? E.g. re-generating theversion
file from scratch?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 following are embedded into the images during build, and as such are available when the image is run:
You can download the must-gather.tar from one of the jobs on this PR, and see that the
version
file contains: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.
Following https://github.com/openshift/enhancements/blob/master/enhancements/oc/must-gather.md#must-gather-images and the version string
major.minor.micro.qualifier
. I wonder what the expected mapping should be:major=4
,minor=13
,micro=0-202211071433
,qualifier=p0.g63e9a04.assembly.stream-63e9a04
? Compared to https://gcsweb-ci.apps.ci.l2s4.p1.openshiftapps.com/gcs/origin-ci-test/pr-logs/pull/openshift_must-gather/327/pull-ci-openshift-must-gather-master-images/1597782051325480960/artifacts/ci-operator-step-graph.json:We might as well update the version string in
enhancements/oc/must-gather.md
tomajor.minor.micro-qualifier
with major/minor/micro as [0-9]+ so the parts turn intomajor=4
,minor=13
,micro=0
,qualifier=202211071433.p0.g63e9a04.assembly.stream-63e9a04
.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.
@ingvagabund I've updated the enhancement to specify the SemVer format (original intention) used elsewhere in OpenShift (vs. the OSGi-type format specified there originally).
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.
With openshift/enhancements#1294 merged we are good here. @soltysh would you please approve the PR?