Repository navigation
feat(gitops): add bulk sync, cancel operation, resource actions, repo credentials and cluster links - #506
feat(gitops): add bulk sync, cancel operation, resource actions, repo credentials and cluster links#506BlueLabelscotch wants to merge 4 commits into
Conversation
| method: POST | ||
| path: /gitops/api/v1/applications/bulk/sync | ||
| body_params: | ||
| applicationTargets: 'map(flags.target, {{"agentIdentifier": split(#, "/")[0], "applicationName": split(#, "/")[1]}})' |
There was a problem hiding this comment.
bulk_sync accepts a malformed target like agent/app/extra and silently syncs agent/app, including pruning if requested. A target with no slash makes the expression fail, and the body builder then drops applicationTargets for the entire batch instead of reporting the bad target.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| handler_type: endpoint | ||
| endpoint: | ||
| method: DELETE | ||
| path: /gitops/api/v1/agents/{{ctx.idParts[0]}}/applications/{{ctx.idParts[1]}}/operation |
There was a problem hiding this comment.
buildCtx strips account. and org. before populating ctx.idParts for multi-level nouns, so cancel_operation sends a bare agent ID where the API requires a scope-prefixed one. Other locations where this applies: pkg/spec/gitops.spec.yaml:1530 (run_resource_action), :1576 (get gitops_repocred), and :1593 (delete gitops_repocred).
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| searchTerm: 'flags.search != "" ? flags.search : nil' | ||
| agentIdentifier: 'flags.agent != "" ? flags.agent : nil' | ||
| paging: | ||
| paging_strategy: flat_list |
There was a problem hiding this comment.
list gitops_repocred treats the paginated /repocreds endpoint as a flat list, so the CLI stops after the first server page even with --all. If more credentials match than the server returns in that page, --count also reports only the first page's length.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| page_size_param: size | ||
| page_size_default: 50 | ||
| page_size_max: 100 | ||
| total_expr: it.data.totalItems |
There was a problem hiding this comment.
The MCP contract test models /ng/api/gitops/clusters returning its count as data.totalElements, but total_expr only reads data.totalItems. With that response, the CLI's paging code returns an error instead of displaying any links, even on the first page.
Severity: high
🤖 Was this useful? React with 👍 or 👎
|
|
||
| - noun: gitops_clusterlink | ||
| short_desc: "Link between a GitOps cluster and a Harness environment (identifiers are raw, not scope-prefixed)." | ||
| noun_aliases: [gitops_clusterlinks] |
There was a problem hiding this comment.
gitops_clusterlink isn't marked multi-level, so its commands don't expose --level to select the environment's scope. With a project-scoped profile, list/create/delete still send the profile's project for an account- or org-level environment; --scope only selects the cluster's scope.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
83b7ca8 to
17c072b
Compare
|
CLI Grammar Review · session (Harness team members only) · 1f413a7 CLI grammar changes (beta) · Advisory only, FYI, not required changes.
Overall: 🟡 Recommend manual review |
…aths, accept totalElements
|
cosmos review |
| handler_type: endpoint | ||
| endpoint: | ||
| method: DELETE | ||
| path: '/gitops/api/v1/agents/{{ctx.level == "account" ? "account." + ctx.idParts[0] : (ctx.level == "org" ? "org." + ctx.idParts[0] : ctx.idParts[0])}}/applications/{{ctx.idParts[1]}}/operation' |
There was a problem hiding this comment.
With account.<agent> or org.<agent>, cancel_operation restores the agent prefix in the path but ScopedAuth drops projectIdentifier, whereas the MCP operation sends the application’s project separately from the agent ID. This loses the project scope for apps managed by a shared agent, and --level project conflicts with the prefixed ID; the same applies to run_resource_action at pkg/spec/gitops.spec.yaml:1596.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| page_size_default: 50 | ||
| page_size_max: 100 | ||
| total_expr: it.data.totalItems ?? it.data.totalElements ?? 0 | ||
| columns: [name, agent, scope] |
There was a problem hiding this comment.
list gitops_clusterlink shows the API’s scope-prefixed name (for example, account.incluster), but pasting that value into delete gitops_clusterlink makes the CLI interpret the cluster’s prefix as the environment’s scope. An account cluster linked to a project environment therefore produces an account-scoped delete request, or a scope conflict if --level project is explicit.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| "prune": true, | ||
| "sync-option": []string{"CreateNamespace=true"}, | ||
| }} | ||
| got, err := bulkSyncBody(ctx) |
There was a problem hiding this comment.
TestBulkSyncBody only exercises --dry-run when it is off. It would still pass if bulkSyncBody dropped or misnamed dryRun when the flag is set, turning a requested simulation into a live sync.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
Stacked on #505 (base is feat/gitops-reads).
Adds write commands matching the MCP gitops toolset:
execute gitops_application:bulk_sync,:cancel_operation,:run_resource_actionlist/get/delete gitops_repocredlist/create/delete gitops_clusterlinkSpec only.