JGC-492 - Add --format flag for release-bundle-create, promote, and distribute#488
Open
ehl-jf wants to merge 3 commits into
Open
JGC-492 - Add --format flag for release-bundle-create, promote, and distribute#488ehl-jf wants to merge 3 commits into
ehl-jf wants to merge 3 commits into
Conversation
reshmifrog
requested changes
Jun 12, 2026
| return rbc | ||
| } | ||
|
|
||
| func (rbc *ReleaseBundleCreateCommand) SetOutputFormat(f coreformat.OutputFormat) *ReleaseBundleCreateCommand { |
Contributor
There was a problem hiding this comment.
instead of using a single letter f we can rename it as format
| } | ||
|
|
||
| if sourceTypes != nil && isSingleSourceType(sourceTypes) { | ||
| var runErr error |
Contributor
There was a problem hiding this comment.
what is runErr can we use a better name for this?
| if rbc.outputFormat != coreformat.Json { | ||
| return nil | ||
| } | ||
| return printEchoJson(rbc.releaseBundleName, rbc.releaseBundleVersion, "created") |
Contributor
There was a problem hiding this comment.
use a const for "created"
| } | ||
|
|
||
| func (rbd *ReleaseBundleDistributeCommand) SetOutputFormat(f coreformat.OutputFormat) *ReleaseBundleDistributeCommand { | ||
| rbd.outputFormat = f |
Contributor
There was a problem hiding this comment.
here as well use a better name instead of using f
| if rbd.outputFormat != coreformat.Json { | ||
| return nil | ||
| } | ||
| return printEchoJson(rbd.releaseBundleName, rbd.releaseBundleVersion, "distributed") |
Contributor
There was a problem hiding this comment.
use a const for "distributed".
|
|
||
| // --- promote --- | ||
|
|
||
| func TestPromotePrintOutput_Json(t *testing.T) { |
Contributor
There was a problem hiding this comment.
Also please add e2e in jfrog-cli.
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.
Summary
Adds
--formatflag support to the three lifecycle Release Bundle V2 commands:jf release-bundle-promote(rbp) —--format json(default, backward-compat) and--format table. Table renders a single-row summary withREPOSITORY KEY,BUNDLE NAME,VERSION,ENVIRONMENT, andCREATEDcolumns.jf release-bundle-create(rbc) —--format jsononly (Pattern B / echo). No flag = silent (backward-compat). Emits{ release_bundle_name, release_bundle_version, status: "created" }on success.jf release-bundle-distribute(rbd) —--format jsononly (Pattern B / echo). No flag = silent (backward-compat). Emits{ release_bundle_name, release_bundle_version, status: "distributed" }on success.Changes
lifecycle/cli.go— AddedSupportedFormatsto the three command definitions; wiredc.GetOutputFormat()+.SetOutputFormat()in thecreate(),promote(), anddistribute()action handlers; addedcoreformatimport.lifecycle/commands/promote.go— AddedoutputFormatfield,SetOutputFormat()setter,printOutput()dispatcher (json default / table), andprintPromoteTable()helper usingcoreutils.PrintTable.lifecycle/commands/distribute.go— AddedoutputFormatfield,SetOutputFormat()setter, andprintDistributeOutput()echo-json helper.lifecycle/commands/createcommon.go— AddedoutputFormatfield,SetOutputFormat()setter, andprintCreateOutput()echo-json helper; refactoredRun()to collect the create error at a single exit point before callingprintCreateOutput().lifecycle/commands/format_output_test.go(new) — 15 unit tests covering the json path, no-format backward-compat path, table path (for promote), content correctness, and setter behaviour for all three commands.Backward compatibility
All three commands retain their existing behaviour when
--formatis not specified:rbpcontinues to emit the full promotion JSON response.rbcandrbdcontinue to produce no output.