diff --git a/go.mod b/go.mod index 92ffe89a6..b10d03472 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/jfrog/build-info-go v1.13.1-0.20260610071651-260ad6720e0d github.com/jfrog/gofrog v1.7.6 github.com/jfrog/jfrog-cli-application v1.0.2-0.20260608074325-4de652aef752 - github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260610074911-82ce7d90edbd + github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260617065038-e7be947840da github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260609101026-df3091b39d06 github.com/jfrog/jfrog-cli-evidence v0.9.5-0.20260601141509-8df6c9a4bc9b github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260601140139-4cefb6add7b7 diff --git a/go.sum b/go.sum index fc437d77c..9873fe6df 100644 --- a/go.sum +++ b/go.sum @@ -406,8 +406,8 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w= github.com/jfrog/jfrog-cli-application v1.0.2-0.20260608074325-4de652aef752 h1:Fcb54+kmZjEuBbGstzerLz37Lk6SutfMF7CxLqgXRlE= github.com/jfrog/jfrog-cli-application v1.0.2-0.20260608074325-4de652aef752/go.mod h1:EeLKgLeJfKcS7671H52bfCgj1xK8wyJJGBRD5a+vJMc= -github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260610074911-82ce7d90edbd h1:1AKWhJehl5Z8X69ibX7Azjt70x2L4PnBdnrGiVzdWxY= -github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260610074911-82ce7d90edbd/go.mod h1:VqV0Bed11HoBlugAEGa3RumbwnDVslEf0gKocTzLs9s= +github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260617065038-e7be947840da h1:BnmMBxYQlJ/WMrVO31q7LumJ5fDLQdIm3MVGNrNDC4w= +github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260617065038-e7be947840da/go.mod h1:VqV0Bed11HoBlugAEGa3RumbwnDVslEf0gKocTzLs9s= github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260609101026-df3091b39d06 h1:A8hWKHyvqzGXfWmh+8lXv3waAkim4xiucBfGhl7ZOeQ= github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260609101026-df3091b39d06/go.mod h1:9R90mhbczGXwW5EGlDs7F08ejQU/xdoDhYHMvzBiqgE= github.com/jfrog/jfrog-cli-evidence v0.9.5-0.20260601141509-8df6c9a4bc9b h1:V0FxnU3xh29y8yJHWymm6rPr1MrjG1DdPQlr3ckImwk= diff --git a/lifecycle_test.go b/lifecycle_test.go index 00e069c21..7d58a229b 100644 --- a/lifecycle_test.go +++ b/lifecycle_test.go @@ -491,6 +491,54 @@ func TestPromoteReleaseBundleWithPromotionTypeFlag(t *testing.T) { assertStatusCompleted(t, lcManager, tests.LcRbName1, number1, "") } +// TestReleaseBundleFormatFlag verifies the --format flag output of the lifecycle commands: +// - release-bundle-create --format=json emits a JSON confirmation object. +// - release-bundle-promote --format=table renders a summary table. +// +// The release-bundle-promote --format=json (default) path is already covered by promoteRb. +func TestReleaseBundleFormatFlag(t *testing.T) { + cleanCallback := initLifecycleTest(t, signingKeyOptionalArtifactoryMinVersion) + defer cleanCallback() + lcManager := getLcServiceManager(t) + + deleteBuilds := uploadBuilds(t) + defer deleteBuilds() + + // release-bundle-create --format=json emits a JSON confirmation object. + specFile, err := tests.CreateSpec(tests.LifecycleBuilds12) + assert.NoError(t, err) + createOutput := lcCli.RunCliCmdWithOutput(t, "rbc", tests.LcRbName1, number1, + getOption("spec", specFile), + getOption(cliutils.SigningKey, gpgKeyPairName), + getOption(cliutils.Sync, "true"), + getOption(cliutils.Format, "json")) + defer deleteReleaseBundle(t, lcManager, tests.LcRbName1, number1) + + var created struct { + Name string `json:"release_bundle_name"` + Version string `json:"release_bundle_version"` + Status string `json:"status"` + } + assert.NoError(t, json.Unmarshal([]byte(createOutput), &created)) + assert.Equal(t, tests.LcRbName1, created.Name) + assert.Equal(t, number1, created.Version) + assert.Equal(t, "created", created.Status) + + // release-bundle-promote --format=table renders a summary table. + tableOutput := lcCli.RunCliCmdWithOutput(t, "rbp", tests.LcRbName1, number1, prodEnvironment, + getOption(cliutils.SigningKey, gpgKeyPairName), + getOption(cliutils.IncludeRepos, tests.RtProdRepo1), + "--project=default", + getOption(cliutils.Format, "table")) + // The bundle name column wraps across lines, so assert on stable, non-wrapping + // content: the table title, headers, and the environment value. + assert.Contains(t, tableOutput, "Promotion Result") + assert.Contains(t, tableOutput, "BUNDLE NAME") + assert.Contains(t, tableOutput, "ENVIRONMENT") + assert.Contains(t, tableOutput, prodEnvironment) + assertStatusCompleted(t, lcManager, tests.LcRbName1, number1, "") +} + func TestReleaseBundleCreationWithDraftFlagFromSpec(t *testing.T) { cleanCallback := initLifecycleTest(t, draftBundleArtifactoryMinVersion) defer cleanCallback()