Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/simulation-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import os
import re
import subprocess
import textwrap
import tomllib
Expand Down Expand Up @@ -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")
Expand Down