Skip to content

Add force flag to delete commands for project, environment, and component#440

Open
anjankow wants to merge 4 commits into
developfrom
aj-prod-737-add-force-flag-to-cli
Open

Add force flag to delete commands for project, environment, and component#440
anjankow wants to merge 4 commits into
developfrom
aj-prod-737-add-force-flag-to-cli

Conversation

@anjankow
Copy link
Copy Markdown

When --force is passed, the DELETE request includes skip_hooks=true as a query parameter, allowing deletion to bypass hooks.

@anjankow anjankow self-assigned this May 15, 2026
@anjankow anjankow requested a review from fhacloid May 15, 2026 11:09
anjankow added 3 commits May 15, 2026 13:33
…ponent

When --force is passed, the DELETE request includes skip_hooks=true as a
query parameter, allowing deletion to bypass pre/post hooks.
@anjankow anjankow force-pushed the aj-prod-737-add-force-flag-to-cli branch from 1bb4449 to c708e38 Compare May 15, 2026 11:33
Comment thread cmd/cycloid/components/delete.go Outdated
for _, component := range components {
_, err = m.DeleteComponent(org, project, env, component)
for _, component := range args {
_, err = m.DeleteComponent(org, project, env, component, force)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
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