Repository navigation
kctrl: add flags to run package repository release non-interactively - #1894
Closed
officialasishkumar wants to merge 1 commit into
Closed
officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
Conversation
kctrl package repository release always asks for the repository name and the registry URL, so a CI job has to feed answers on stdin or commit a pkgrepo-build.yml up front. With --yes and no existing file, the empty registry URL default was accepted and the command only failed later, when imgpkg was given an image reference of ":<tag>", having already written a pkgrepo-build.yml with no image. Add --name and --registry-url. A value given through a flag takes precedence over pkgrepo-build.yml and skips its prompt. Values not given are still asked for, so existing interactive use does not change. Also fail early with a clear error when the registry URL ends up empty, before anything is written to disk. Fixes carvel-dev#1276 Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this PR does / why we need it:
kctrl package repository releasealways asks for the repository name and the registry URL, which makes it awkward to use in CI. This adds two flags:pkgrepo-build.ymland skips its prompt. The value is still saved topkgrepo-build.yml, as a prompt answer is.--yesstill accepts the defaults for anything left out.expected registry URL to be specified (hint: use --registry-url flag). Previously--yeswith no URL wrote apkgrepo-build.ymlwith no image, then failed in imgpkg on an image reference of:<tag>.The prompts moved into
configureBasicInformation, so that this logic can be unit tested without kbld or imgpkg.Which issue(s) this PR fixes:
Fixes #1276
Does this PR introduce a user-facing change?
Additional Notes for your reviewer:
The issue also suggested the short forms
-nand-u. I left them out because-nmeans namespace across the other kctrl commands. They are easy to add if you would prefer them.Testing:
release_test.gocover flags only, prompts only, a mix of the two, and the empty registry URL.TestPackageRepositoryReleaseNonInteractivelyruns with no--yesand no stdin, so any prompt would fail it. It passes against a localregistry:2with real kbld and imgpkg, and fails on a binary without this change.--registry-urlwith--yes, flags overriding an existingpkgrepo-build.yml, and a blank registry answer.Not run:
TestPackageRepositoryReleaseInteractively, because it needs a cluster and I did not have one available. I checked the same prompt flow by hand as listed above.Review Checklist:
a link to that PR (not done; the new flags appear in
--help)change
Additional documentation e.g., Proposal, usage docs, etc.: