Skip to content

feat(variable): [QOV-2445] add --override-if-exists to env create commands - #747

Merged
Guimove merged 3 commits into
mainfrom
feat/env-create-override-if-exists
Oct 30, 2026
Merged

Guimove merged 3 commits into
mainfrom
feat/env-create-override-if-exists

Conversation

@Guimove

@Guimove Guimove commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Jira: QOV-2445

Related changes:

Adds --override-if-exists to env create for application, container, cronjob, lifecycle, helm and environment. When set, the CLI sends override_if_exists: true on POST /variable (Qovery/qovery-openapi-spec#1237). If the key already exists at a higher scope (project or environment), q-core creates an override of it instead of returning 409. Project env create doesn't get the flag, since nothing sits above a project. The field is only sent when the flag is set, so default requests are unchanged.

CreateVariable errors now include the detail of the API's problem response. Before, a 409 printed only 409 Conflict. Now it shows q-core's message naming the scope that holds the key.

Blocked on the client bump. This needs go get -u github.com/qovery/qovery-client-go once Qovery/qovery-openapi-spec#1237 merges and the Go client is regenerated. CI fails until then (SetOverrideIfExists is undefined in the published client).

Tested: generated the Go client from the spec PR with openapi-generator 7.6.0 (the CI version), pointed go.mod at it with a temporary replace (not committed), then ran go build ./..., go vet -tags testing ./... and go test ./cmd/ ./utils/ (270 passed). Checked the --help output for application and environment.


Summary by cubic

Adds --override-if-exists to the application, container, cronjob, lifecycle, helm, and environment env create commands so that when the key already exists at a higher scope, the CLI sends override_if_exists: true and q-core creates an override instead of returning 409. The field is only sent when the flag is set; the project env create command is unchanged since nothing sits above a project. Variable and external secret creation errors now include the API's problem detail, so a 409 names the scope that already holds the key instead of showing only 409 Conflict.

Bumps github.com/qovery/qovery-client-go to a version that exposes SetOverrideIfExists.

Written for commit c17c683. Summary will update on new commits.

View guided diff Turn on auto-fix

@Guimove
Guimove marked this pull request as ready for review October 22, 2026 09:58

@cubic-dev-ai cubic-dev-ai Bot left a comment •

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.

All reported issues were addressed across 10 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread utils/env_var.go Resolved
@Guimove Guimove changed the title feat(variable): add --override-if-exists to env create commands feat(variable): [QOV-2445] add --override-if-exists to env create commands Oct 22, 2026
Application, container, cronjob, lifecycle, helm and environment
env create commands get a --override-if-exists flag that sets
override_if_exists on POST /variable: when the key already exists at a
higher scope, q-core creates an override instead of returning 409.

CreateVariable errors now include the API's problem detail instead of
the bare status line, so a 409 says which scope holds the key.
@Guimove
Guimove force-pushed the feat/env-create-override-if-exists branch from 44d95e0 to 86dab45 Compare October 30, 2026 09:54
@Guimove
Guimove merged commit 234bb7a into main Oct 30, 2026
7 checks passed
@Guimove
Guimove deleted the feat/env-create-override-if-exists branch October 30, 2026 14:54
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