GoogleContainerTools / GoogleContainerTools/skaffold
Surface deploy parameters (--set / --set-value-file) to exec custom-action and verify containers for Cloud Deploy parity
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
## Problem
[Google Cloud Deploy passes deploy parameters](https://docs.cloud.google.com/deploy/docs/parameters) to its execution environment as environment variables, surfacing them to render, **custom action**, and **verify** containers. Skaffold already accepts deploy parameters via `--set` / `--set-value-file`, but historically they were only used for **manifest templating** and only exposed on a subset of commands (`render`, `filter`, `delete`). As a result:
- `skaffold exec` (custom actions) did **not** inject deploy parameters as environment variables into action containers.
- `skaffold verify` did **not** accept `--set` / `--set-value-file` at all, and never injected deploy parameters into verify containers.
This breaks Cloud Deploy parity. A custom action (e.g. an Alembic database migration) cannot read a Cloud SQL connection URL passed as a deploy parameter, and a post-deploy `verify` smoke test cannot read the deployed Cloud Run service URL that Cloud Deploy injects automatically.
## Expected behavior
`--set` / `--set-value-file` should be available on `deploy`, `dev`, `run`, `exec`, and `verify` (in addition to the existing `render` / `filter` / `delete`). On `exec` and `verify`, the supplied key/value pairs should additionally be injected as environment variables into every custom-action / verify container, with precedence (lowest → highest):
1. `--env-file` (base)
2. `--set-value-file`
3. `--set`
## Current behavior
- `skaffold verify` rejects `--set` / `--set-value-file` (flags are not registered on the command).
- `exec` / `verify` containers receive no deploy parameters as environment variables.
## Reproduction
**Verify (Cloud Run service URL → Playwright smoke test):**
```yaml
# skaffold.yaml
apiVersion: skaffold/v4beta14
kind: Config
metadata:
name: repro
verify:
- name: smoke-test
container:
name: smoke
image: alpine:3.15.4
command: ["/bin/sh", "-c"]
args: ["echo \"smoke test against ${SERVICE_URL}\""]
```
```console
$ skaffold verify --set SERVICE_URL=https://my-service-abc-uc.a.run.app
Error: unknown flag: --set # today
# expected: the container prints "smoke test against https://my-service-abc-uc.a.run.app"
```
**Exec (Cloud SQL URL → Alembic migration):**
```yaml
# skaffold.yaml
apiVersion: skaffold/v4beta14
kind: Config
metadata:
name: repro
customActions:
- name: db-migrate
containers:
- name: alembic
image: alpine:3.15.4
command: ["/bin/sh", "-c"]
args: ["echo \"alembic upgrade head -> ${DATABASE_URL}\""]
```
```console
$ skaffold exec db-migrate --set DATABASE_URL=postgresql+pg8000://user:pass@/app?unix_sock=/cloudsql/PROJECT:REGION:INSTANCE/.s.PGSQL.5432
# today: DATABASE_URL is empty inside the container
# expected: the container prints the full connection URL
```
## Proposed solution / scope
- Expose `--set` / `--set-value-file` on `deploy`, `dev`, `run`, `exec`, and `verify`.
- Inject the merged deploy parameters as environment variables into custom-action containers (`exec`) and verify containers (`verify`), reusing one shared merge helper with the precedence above.
- Add runnable examples (custom-action Cloud SQL/Alembic migration; Playwright `verify` smoke test) and document the behavior on the custom-actions and verify pages.
Contributor guide
Research direction
Start by tracing flag registration for deploy, dev, run, exec, and verify, then follow how environment variables are assembled for custom-action and verify containers. Compare the existing --set and --set-value-file behavior with --env-file precedence; done means both commands accept the flags, containers receive the merged values, and the requested runnable examples and documentation are included.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, google-cloud
- Domain
- cli, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100