Skip to content

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

Open
Guimove wants to merge 2 commits into
mainfrom
feat/env-create-override-if-exists
Open

Guimove wants to merge 2 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 a variable whose key already exists at a higher scope 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.

Blocked on a Go client regeneration: CI currently fails until github.com/qovery/qovery-client-go ships the SetOverrideIfExists method.

Written for commit 44d95e0. Summary will update on new commits.

View guided diff Turn on auto-fix

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

1 issue found across 10 files

Confidence score: 5/5

  • In utils/env_var.go, CreateServiceExternalSecret still hides API details, so conflicts don’t show which scope holds the key. Return withAPIErrorDetail(err) for this CreateVariable call.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="utils/env_var.go">

<violation number="1" location="utils/env_var.go:210">
P2: `CreateServiceExternalSecret` still hides the API problem detail, so conflicts from external-secret creation do not identify the scope holding the key. Return `withAPIErrorDetail(err)` for this `CreateVariable` call as well.</violation>
</file>

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

This branch has not been deployed

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