feat(variable): [QOV-2445] add --override-if-exists to env create commands
Jira: QOV-2445
Related changes:
- q-core: https://gitlab.com/qovery/backend/q-core/-/merge_requests/4207
- OpenAPI: https://github.com/Qovery/qovery-openapi-spec/pull/1237
- Console: https://github.com/Qovery/console/pull/3141
- CLI: https://github.com/Qovery/qovery-cli/pull/747
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.