Skip to content

Surface deploy parameters (--set / --set-value-file) to exec custom-action and verify containers for Cloud Deploy parity #10128

Description

@bogdannazarenko

Problem

Google Cloud Deploy passes deploy 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):

# 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}\""]
$ 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):

# 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}\""]
$ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions