Skip to content

APP-6884 - Add-auto-promote-stages - #103

Merged
asafgabai merged 4 commits into
jfrog:mainfrom
danielreJfrog:APP-6884-add-auto-promote-stages
Sep 17, 2026
Merged

asafgabai merged 4 commits into
jfrog:mainfrom
danielreJfrog:APP-6884-add-auto-promote-stages

Conversation

@danielreJfrog

Copy link
Copy Markdown
Contributor

Summary

  • Add --auto-promote-stages to app-create and app-update so CLI can set ordered lifecycle stages on create/update.
  • Empty --auto-promote-stages on update sends [] to turn auto-promotion off; omitting the flag leaves current stages unchanged.
  • Cover flags, spec JSON, table output ordering, and e2e create/update/clear paths.

Test plan

  • go test ./... and go vet ./...
  • jf apptrust app-create my-app --project=default --auto-promote-stages="DEV;PROD"
  • jf apptrust app-update my-app --auto-promote-stages="DEV;PROD" then --auto-promote-stages=""
  • Create from --spec with auto_promote_stages
  • Confirm --spec cannot be combined with --auto-promote-stages

Made with Cursor

@asafgabai asafgabai added the safe to test Approve running end-to-end tests on a pull request label Sep 16, 2026
@github-actions github-actions Bot removed the safe to test Approve running end-to-end tests on a pull request label Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

64 tests  ±0   57 ✅ ±0   5m 24s ⏱️ -1s
 2 suites ±0    7 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 64e25b7. ± Comparison against base commit 4b31e48.

- If --application-name is omitted, the application-key is used as the display name.
- --labels uses semicolon separators (not commas) and key=value pairs.
- --monitor-policy takes 'type=<type>[, value=<n>]'. 'value' is required (positive integer) when type is "time_frame_in_months" or "version_count", and must be omitted when type is "none".
- --auto-promote-stages uses semicolon separators and preserves the supplied stage order.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter that the flag preserves the supplied stage order. I think this whole line can be removed.

- --labels replaces the full label set; --add-labels and --remove-labels modify incrementally.
- --user-owners / --group-owners take a semicolon-separated list and send exactly the owners you specify; there are no incremental add/remove-owner flags (unlike --add-labels / --remove-labels for labels).
- --monitor-policy takes 'type=<type>[, value=<n>]'. 'value' is required (positive integer) when type is "time_frame_in_months" or "version_count", and must be omitted when type is "none". When --monitor-policy is not provided, the current policy is left unchanged.
- --auto-promote-stages uses semicolon separators and preserves the supplied stage order. Pass an empty value to disable auto-promotion; omit the flag to leave the current stages unchanged.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of values doesn't matter:

and preserves the supplied stage order

Comment thread apptrust/commands/flags.go Outdated
UserOwnersFlag: components.NewStringFlag(UserOwnersFlag, "semicolon-separated (;) list of user owners in the form of \"user1;user2;...\" (wrapped by quotes).", func(f *components.StringFlag) { f.Mandatory = false }),
GroupOwnersFlag: components.NewStringFlag(GroupOwnersFlag, "semicolon-separated (;) list of group owners in the form of \"group1;group2;...\" (wrapped by quotes).", func(f *components.StringFlag) { f.Mandatory = false }),
MonitorPolicyFlag: components.NewStringFlag(MonitorPolicyFlag, "Defines how long application versions remain monitored, in the form of 'type=<type>[, value=<n>]'. Supported types: "+coreutils.ListToText(model.MonitorPolicyTypeValues)+". For '"+model.MonitorPolicyTypeTimeframe+"' or '"+model.MonitorPolicyTypeVersionCount+"', 'value' is the number of months or versions to keep monitoring (a positive integer). For '"+model.MonitorPolicyTypeNone+"', monitoring is disabled and 'value' must be omitted.", func(f *components.StringFlag) { f.Mandatory = false }),
AutoPromoteStagesFlag: components.NewStringFlag(AutoPromoteStagesFlag, "Semicolon-separated (;) lifecycle stages through which new application versions are automatically promoted. Pass an empty value to disable auto-promotion.", func(f *components.StringFlag) { f.Mandatory = false }),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep it consistent with existing flags, I suggest deleting this part:

Pass an empty value to disable auto-promotion.

Comment thread apptrust/commands/flags_test.go Outdated
"github.com/stretchr/testify/assert"
)

func TestApplicationCommandsIncludeAutoPromoteStagesFlag(t *testing.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a weak test and it's inconsistent. I suggest removing it.

@@ -7,6 +7,7 @@ import (

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the PR description you says the PR includes E2E but I can't find it. Is it planned to be added separately?

Comment thread apptrust/model/app_descriptor_test.go Outdated
assert.NotContains(t, string(payload), "auto_promote_stages")
})

t.Run("preserves configured order", func(t *testing.T) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case can be removed

@asafgabai
asafgabai merged commit d7783ac into jfrog:main Sep 17, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants