-
Notifications
You must be signed in to change notification settings - Fork 49
Migrating all build x commands to Kong
#571
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
Conversation
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
Allows us to do the same checks on tokens requirements, and if api token/org slug are missing in Kong like we do with Cobra
Had to change a few bits here to add the --output flag as it was a bit weird on this one. For some reason it expected --format? Anyway, sorted.
Add some helper functions to well, help... too... I guess?
…g to handle build subcommands now
Contributor
Author
|
Shows a lot as deleted and created rather than moved because I copy pasted the old one, made modifications to it, commited and then deleted the old one so that I have a backup of the original one if I needed it... But everything's moved |
mcncl
approved these changes
Nov 28, 2025
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.
Migrates all
buildsubcommands from Cobra to Kong as part of the CLI modernization effort. This must be part of the same PR, as we'd be breaking all otherbuildsubcommands in the interm if we tried to move them 1-by-1.Meat of the changes
Created
/cmd/build/with Kong versions of all 7 build subcommands:create.go(keptnewalias for backward compatibility)cancel.go,view.go,list.go,download.go,rebuild.go,watch.goEach command has:
Run(kongCtx *kong.Context, globals cli.GlobalFlags) errormethodHelp()method with examplesAdded a global flag interface as this was needed to avoid circular dependencies. Kong commands access
SkipConfirmation()andDisableInput()without importing the main package.ValidateConfigurationfunction created as a Kong version of the Cobra config validation that all migrated commands use, added TODO's where relevant so we can easily use find to delete the Cobra versions once fully migrated.Main.go changes
BuildCmdstruct with all the subcommands we've movedGlobalsstruct that usesGlobalFlagsbuildCobraArgs()to reconstruct global flags when passing them to CobraisHelpRequest()so Kong handlesbuild --helpinstead of CobraGeneral cleanup
pkg/cmd/root/root.gopkg/cmd/build/build.go(not needed anymore)list_test.gotocmd/build/and updated it to work without CobraView.go
For some reason this was using
--formatas a flag, I aligned this with the rest of the cli and made it--output.Testing
I've tested this iteratively as I went along, all commands are working as they were before, no core logic has been changed from any of them, so it all works as expected.
The global flags work with the Cobra commands, and everything is playing nicely as it was before.
All tests passing, moved them over to the new /cmd/build/ folder, had to add some new helper functions to the
list_test.gotest as it was using Cobra there, too.