Skip to content

Add --monitor-policy flag to app-create and app-update commands#93

Merged
asafgabai merged 7 commits into
jfrog:mainfrom
danielreJfrog:feature/add-monitor-policy-flag
Jul 23, 2026
Merged

Add --monitor-policy flag to app-create and app-update commands#93
asafgabai merged 7 commits into
jfrog:mainfrom
danielreJfrog:feature/add-monitor-policy-flag

Conversation

@danielreJfrog

Copy link
Copy Markdown
Contributor

Summary

  • Add an optional --monitor-policy flag to jf apptrust app-create and jf apptrust app-update, mapping to the AppTrust monitor_policy configuration on the create/update application requests.
  • The flag takes a structured value "type=<type>[, value=<n>]". Supported types: none, time_frame_in_months, version_count. value must be a positive integer and is required for the enabled types, and must be omitted when type=none.
  • On app-create, omitting the flag leaves monitoring off; on app-update, omitting it leaves the current policy unchanged (omitempty).
  • Extend AppDescriptor model with a MonitorPolicy type/field and validation in populateApplicationFromFlags.

Usage

jf apptrust app-create my-app --project=default --monitor-policy="type=version_count, value=5"
jf apptrust app-update my-app --monitor-policy="type=time_frame_in_months, value=6"
jf apptrust app-update my-app --monitor-policy="type=none"   # disable monitoring

Test plan

  • Added table-driven unit tests for app-create covering all types, missing/invalid/non-positive value, missing type, invalid type, and unknown fields.
  • Added app-update flag-suite cases (with value, type=none, invalid type).
  • go test ./apptrust/commands/application/... passes; no lint errors.

Made with Cursor

Introduce an optional --monitor-policy flag (format: "type=<type>[, value=<n>]")
that maps to the AppTrust monitor_policy configuration on the create and update
application requests. Supported types: none, time_frame_in_months, version_count;
value is required for the enabled types and must be omitted for none.

Co-authored-by: Cursor <cursoragent@cursor.com>
Move the monitor-policy parsing/validation into a utils helper and handle it
inline in populateApplicationFromFlags, matching the other flag fields. Remove
non-conventional comments.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cover version_count and time_frame_in_months on create, and
time_frame_in_months, version_count, and none on update, verifying the
persisted policy via the applications GET endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
@asafgabai asafgabai added the safe to test Approve running end-to-end tests on a pull request label Jul 22, 2026
@github-actions github-actions Bot removed the safe to test Approve running end-to-end tests on a pull request label Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Test Results

0 tests   - 61   0 ✅  - 54   0s ⏱️ - 6m 8s
0 suites  -  2   0 💤  -  7 
0 files    -  1   0 ❌ ± 0 

Results for commit 73893f1. ± Comparison against base commit 6df6041.

♻️ This comment has been updated with latest results.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@asafgabai asafgabai added the safe to test Approve running end-to-end tests on a pull request label Jul 22, 2026
@github-actions github-actions Bot removed the safe to test Approve running end-to-end tests on a pull request label Jul 22, 2026
Comment thread apptrust/commands/application/update_app_cmd_test.go Outdated
Comment thread e2e/utils/e2e_utils.go Outdated
Comment thread e2e/application_test.go Outdated
Comment thread apptrust/commands/application/create_app_cmd_test.go Outdated
Comment thread apptrust/commands/flags.go Outdated
- Reword --monitor-policy flag description for clarity
- Unit-test ParseMonitorPolicyFlag cases in utils_test.go
- Replace dedicated monitor-policy tests with samples in existing create/update tests
- Remove intPtr/IntPtr helpers in favor of local variables

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread apptrust/commands/flags.go Outdated
…licy description

Co-authored-by: Cursor <cursoragent@cursor.com>
@asafgabai
asafgabai merged commit 34eeb81 into jfrog:main Jul 23, 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