-
Notifications
You must be signed in to change notification settings - Fork 244
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
fix: Download bundle without specifying tag #4474
Conversation
Hi @A-725-K. Thanks for your PR. I'm waiting for a crc-org member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
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.
Looks good to me, thanks for contributing this fix!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfergeau 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 |
New changes are detected. LGTM label has been removed. |
@anjannath rebased and pushed! Thanks for notifying me! |
@A-725-K There is still conflict around /rebase |
The "latest" tag is not supported, therefore it is necessary to stop with an error in case it is not provided when using the -b flag command line flag. Add unit tests to reproduce the bug and verify the fix. Closes issue crc-org#4470
@praveenkumar thank you for reviewing it! Rebased and pushed again! |
@A-725-K: The following test failed, say
Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
The "latest" tag is not supported, therefore it is necessary to stop with an error in case it is not provided when using the -b flag command line flag.
Add unit tests to reproduce the bug and verify the fix.
Closes issue #4470
Fixes: Issue #4470
Solution/Idea
Before, in the
GetBundleNameFromURI
function, theimageAndTag
array was trying to access its second element without ensuring that the length is at least 2 causing a crash in case the-b
command line option was used to specify a bundle from a container image repository (using thedocker://
scheme) without a tag. I have added a check to prevent the program from crashing, returning an error to the user since the "latest" tag is not an option.Proposed changes
In
GetBundleNameFromURI
function:imageAndTag
arrayimageAndTag[0]
andimageAndTag[1]
respectivelyTesting
Added unit tests to reproduce the bug and validate the fix proposed.
Check the
TestGetBundleNameFromURI
function in thepkg/crc/machine/bundle/metadata_test.go
file.Running
crc setup -b docker://quay.io/crcont/openshift-bundle
should now return an error message instead of crashing.