Skip to content

fix(deploy-cloudrun): preserve sidecar containers on deploy#414

Merged
Omicron7 merged 2 commits into
mainfrom
fix/deploy-cloudrun-preserve-sidecars
Jun 30, 2026
Merged

fix(deploy-cloudrun): preserve sidecar containers on deploy#414
Omicron7 merged 2 commits into
mainfrom
fix/deploy-cloudrun-preserve-sidecars

Conversation

@Omicron7

@Omicron7 Omicron7 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Problem

actions/deploy-cloudrun updated each service by grabbing template.containers[0], setting its image/env, and calling updateService with just that one container — which sends template.containers: [one] with updateMask: ["template.containers"], replacing the entire container list. So any sidecar is dropped on every deploy, and when the app declares depends_on the sidecar, the carried-over depends_on references a missing container → Cloud Run rejects the update → the deploy fails.

This blocks the Datadog Agent sidecar that gcp/cloudrun/app adds when datadog_apm = true (cru-terraform-modules#667).

Fix

Update only the app container's image/env and pass the full container list through, so sidecars survive:

  • App container = the one running this project's image (the imageUri repo) or, before the first build, the ingress container (the one with a port).
  • Single-container services are unchanged — fully backward-compatible.
  • updateService now takes the full containers array.

Verification

npm run lint, npm run build (9 actions), and npm test (29 passing) pass. dist/ not committed — build-dist.yml rebuilds it on merge.

Release

Bumped package.json (+ lockfile) to 1.7.1. On merge, build-dist.yml rebuilds dist/ and moves the rolling v1 tag (and v1.7.1) to the new commit, so @v1 consumers (bills, etc.) pick up the fix. (The Check Release Label workflow is a vendored import from another team — not part of this repo's release path — so no patch label is needed.)

Rollout note

Needs to be merged (→ v1 moves) before a bills stage deploy runs with the sidecar (cru-terraform#11096), or that deploy drops/fails on the agent.

🤖 Generated with Claude Code

The deploy collapsed each service to template.containers[0] and replaced the
whole container list with it (updateMask: template.containers), so any sidecar
was dropped on every deploy — and the deploy failed outright when the app
declared depends_on the sidecar (the carried-over depends_on referenced a
container that was no longer in the list). This breaks the Datadog Agent sidecar
the gcp/cloudrun/app module adds when datadog_apm = true.

Update only the app container's image/env and pass the full container list
through, so sidecars survive. The app container is the one running this
project's image (the imageUri repo) or the ingress container (the one with a
port) before the first build; single-container services keep today's behavior.
updateService now takes the full containers array. lint/build/tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Release the deploy-cloudrun sidecar-preservation fix. build-dist.yml reads
package.json on merge to main and moves the rolling v1 tag (and v1.7.1) to the
new commit, so @v1 consumers (bills, etc.) pick up the fix.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Omicron7 Omicron7 merged commit f988acb into main Jun 30, 2026
2 checks passed
@Omicron7 Omicron7 deleted the fix/deploy-cloudrun-preserve-sidecars branch June 30, 2026 19:39
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