From 259155f5bd70abc2838623db18a54e32e07c818a Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 28 Jul 2026 20:24:15 +0300 Subject: [PATCH] Fix Cloud Run candidate revision tags --- .github/workflows/simulation-deploy.yml | 4 ++-- .../tests/test_deployment_assets.py | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/simulation-deploy.yml b/.github/workflows/simulation-deploy.yml index 84aa75c58..82f3dd5c9 100644 --- a/.github/workflows/simulation-deploy.yml +++ b/.github/workflows/simulation-deploy.yml @@ -35,7 +35,7 @@ jobs: release_environment: beta modal_environment: staging entrypoint_service: policyengine-simulation-entry-staging - entrypoint_revision_prefix: s + entrypoint_revision_prefix: beta- entrypoint_min_instances: 0 entrypoint_max_instances: 2 promote_entrypoint: false @@ -54,7 +54,7 @@ jobs: release_environment: prod modal_environment: main entrypoint_service: policyengine-simulation-entry - entrypoint_revision_prefix: p + entrypoint_revision_prefix: prod- entrypoint_min_instances: 1 entrypoint_max_instances: 20 promote_entrypoint: true diff --git a/projects/policyengine-simulation-entry/tests/test_deployment_assets.py b/projects/policyengine-simulation-entry/tests/test_deployment_assets.py index 58b96a78a..2de10ed72 100644 --- a/projects/policyengine-simulation-entry/tests/test_deployment_assets.py +++ b/projects/policyengine-simulation-entry/tests/test_deployment_assets.py @@ -1,6 +1,7 @@ from __future__ import annotations import os +import re import subprocess import textwrap import tomllib @@ -96,6 +97,27 @@ def test_deployment_uses_gcloud_workflow_without_terraform(): ).exists() +def test_cloud_run_revision_tags_are_valid_on_the_first_workflow_run(): + deploy_workflow = DEPLOY_WORKFLOW.read_text(encoding="utf-8") + reusable_workflow = REUSABLE_DEPLOY_WORKFLOW.read_text(encoding="utf-8") + prefixes = re.findall( + r"^\s+entrypoint_revision_prefix:\s+(\S+)$", + deploy_workflow, + flags=re.MULTILINE, + ) + + assert ( + "tag=${{ inputs.entrypoint_revision_prefix }}${GITHUB_RUN_NUMBER}" + in reusable_workflow + ) + assert len(prefixes) == 2 + + first_run_tags = [f"{prefix}1" for prefix in prefixes] + for tag in first_run_tags: + assert 3 <= len(tag) <= 63 + assert re.fullmatch(r"[a-z][a-z0-9-]*[a-z0-9]", tag) + + def test_full_stack_promotion_order_is_explicit(): deploy_workflow = DEPLOY_WORKFLOW.read_text(encoding="utf-8") reusable_workflow = REUSABLE_DEPLOY_WORKFLOW.read_text(encoding="utf-8")