Add force flag to delete commands for project, environment, and component#440
Add force flag to delete commands for project, environment, and component#440anjankow wants to merge 4 commits into
Conversation
…ponent When --force is passed, the DELETE request includes skip_hooks=true as a query parameter, allowing deletion to bypass pre/post hooks.
1bb4449 to
c708e38
Compare
| for _, component := range components { | ||
| _, err = m.DeleteComponent(org, project, env, component) | ||
| for _, component := range args { | ||
| _, err = m.DeleteComponent(org, project, env, component, force) |
There was a problem hiding this comment.
Keep the middleware closer to the api, so create skip_hooks / ignore_config_file_err so cmd can use both behaviour, make the --force fill both for now.
| return err | ||
| } | ||
|
|
||
| force, err := cyargs.GetForce(cmd) |
There was a problem hiding this comment.
Re-thinked about the flags and:
Naming for DELETE component flags
• --skip-hooks — maps 1:1 to skip_hooks on the API. Keeps “we’re bypassing pipeline hooks” explicit in runbooks and audits.
• --allow-config-failure — maps to ignore_config_file_err. “Config” matches how ops talk about it (config lives in the git-backed product repo), and “failure” reads better than “ignore … err” without leaking low-level wording.
• --force — convenience only: equivalent to passing both --skip-hooks and --allow-config-failure. Same behavior as two flags; docs should spell out that --force is sugar so nobody assumes it’s a separate third mode.
Rationale: hooks vs “repo/config didn’t update cleanly” are different risks, so we keep two real flags for precise use, and --force for the break-glass “just delete it” path.
Per reviewer feedback: - Middleware now accepts two independent bools (skipHooks, ignoreConfigFilesErr) so callers can set each API param individually, keeping the middleware close to the API surface. - Three CLI flags on delete project/environment/component: --skip-hooks → skip_hooks=true --allow-config-failure → ignore_config_files_err=true --force → sugar for both flags combined
When
--forceis passed, the DELETE request includesskip_hooks=trueas a query parameter, allowing deletion to bypass hooks.