Skip to content

Fit staging Cloud Run tag within the 46-char combined limit#3730

Merged
anth-volk merged 1 commit into
masterfrom
fix/staging-cloud-run-tag-length
Jul 6, 2026
Merged

Fit staging Cloud Run tag within the 46-char combined limit#3730
anth-volk merged 1 commit into
masterfrom
fix/staging-cloud-run-tag-length

Conversation

@anth-volk

Copy link
Copy Markdown
Collaborator

Fixes #3729

Summary

The first post-merge deploy after #3720 failed at Deploy staging Cloud Run candidate (run 28809472052): Cloud Run rejects deploys where traffic tag + service name exceed 46 combined characters (they form the tag URL's DNS label). The Stage 1 rename to policyengine-api-staging (24 chars) leaves 22 for the tag, but stage3-staging-<run#>-<sha7> is ≥24 even with a one-digit run number — structurally impossible, every staging deploy fails, and the production promote gates depend on this leg, so master is undeployed until this merges.

Changes

  • push.yml: staging revision tag becomes stg-<run#>-<sha7> (16 chars today, ≤21 at nine-digit run numbers → combined ≤45). The prod tag is untouched — exit gates and traffic-isolation checks key on stage3-prod-*.
  • validate_cloud_run_deploy_env.sh: fail-fast combined-length guard with an explicit message, so this class of error dies in validation rather than at gcloud. Verified against the exact failing combo (reports 51 > 46 and exits 1).

Verification

  • Guard trips on stage3-staging-2401-7110f23 + policyengine-api-staging and passes on the new tag.
  • tests/unit/test_cloud_run_deploy_scripts.py: 30/30 (including the inline-run-block length rule).
  • actionlint: no new findings vs master (one pre-existing SC2046 warning, untouched line).

After merge

This PR's own push cycle doubles as the Stage 1 exit-gate observation run (traffic isolation, staging service health, header presence, first-attempt-green Cloud Run deploys, container-start → ready duration for Stage 2).


🤖 Generated with Claude Code

Cloud Run rejects deploys where traffic tag + service name exceed 46
characters (they form the tag URL's DNS label). The Stage 1 service
rename to policyengine-api-staging (24 chars) left 22 for the tag,
but the staging tag template stage3-staging-<run#>-<sha7> is at least
24 — every staging deploy failed at gcloud. Shorten the staging tag to
stg-<run#>-<sha7> (combined <=45 even at 9-digit run numbers; prod
keeps stage3-prod-*, which exit gates key on) and add a fail-fast
combined-length guard to deploy validation.

Fixes #3729

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.82%. Comparing base (0839a96) to head (4908878).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3730   +/-   ##
=======================================
  Coverage   79.82%   79.82%           
=======================================
  Files          70       70           
  Lines        4336     4336           
  Branches      808      808           
=======================================
  Hits         3461     3461           
  Misses        655      655           
  Partials      220      220           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anth-volk anth-volk marked this pull request as ready for review July 6, 2026 17:34
@anth-volk anth-volk merged commit d66570a into master Jul 6, 2026
10 checks passed
@anth-volk anth-volk deleted the fix/staging-cloud-run-tag-length branch July 6, 2026 17:34
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.

Staging Cloud Run deploys fail: tag + service name exceed Cloud Run's 46-char limit

1 participant