Skip to content

Commit fe84e31

Browse files
fix: repair CI migration and release smoke checks
1 parent 4b5cb84 commit fe84e31

5 files changed

Lines changed: 29 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ jobs:
102102
env:
103103
API_AUTH_TOKEN: ci-release-token
104104
BOOTSTRAP_ADMIN_TOKEN: ci-bootstrap-admin-token
105-
SECRET_KEY: ci-release-secret
106105
CREDENTIAL_ENCRYPTION_KEY: MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=
107106
COMPOSE_PROJECT_NAME: opencli-admin-ci
108107
steps:
@@ -111,6 +110,9 @@ jobs:
111110
with:
112111
persist-credentials: false
113112

113+
- name: Generate ephemeral test secret
114+
run: echo "SECRET_KEY=$(openssl rand -hex 32)" >> "$GITHUB_ENV"
115+
114116
- name: Validate Compose
115117
run: docker compose --env-file .env.docker.example -f docker-compose.yml -f docker-compose.build.yml config --quiet
116118

@@ -259,7 +261,7 @@ jobs:
259261
# rot (dropped columns with no re-add, wrong op order, etc.).
260262
- name: alembic downgrade/upgrade smoke test
261263
run: |
262-
alembic downgrade -1
264+
alembic downgrade p3q4r5s6t7u8
263265
alembic upgrade head
264266
265267
- name: Native intelligence and event spine PostgreSQL conformance

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ jobs:
164164
env:
165165
API_AUTH_TOKEN: ci-release-token
166166
BOOTSTRAP_ADMIN_TOKEN: ci-bootstrap-admin-token
167-
SECRET_KEY: ci-release-secret
168167
CREDENTIAL_ENCRYPTION_KEY: MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=
169168
COMPOSE_PROJECT_NAME: opencli-admin-release-${{ github.run_id }}-${{ github.run_attempt }}
170169
DOCKER_IMAGE_NAMESPACE: ${{ github.repository_owner }}
@@ -183,6 +182,9 @@ jobs:
183182
with:
184183
python-version: "3.13"
185184

185+
- name: Generate ephemeral test secret
186+
run: echo "SECRET_KEY=$(openssl rand -hex 32)" >> "$GITHUB_ENV"
187+
186188
- name: Log in to GHCR
187189
uses: docker/login-action@v3
188190
with:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ services:
437437
environment:
438438
ODP_QUERY_HOST: 0.0.0.0
439439
ODP_QUERY_PORT: 8042
440-
ODP_QUERY_DATABASE_URL: postgresql://${POSTGRES_USER:-opencli}:${POSTGRES_PASSWORD:-opencli_secret}@postgres:5432/${POSTGRES_DB:-opencli_admin}
440+
ODP_QUERY_DATABASE_URL: postgresql://${POSTGRES_USER:-opencli}:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env or run scripts/install.sh}@postgres:5432/${POSTGRES_DB:-opencli_admin}
441441
ODP_QUERY_ADMIN_CREDENTIAL: ${ODP_QUERY_ADMIN_CREDENTIAL:-}
442442
ODP_QUERY_CURSOR_SECRET: ${ODP_QUERY_CURSOR_SECRET:-}
443443
RUST_LOG: info,odp_query=debug

tests/unit/test_migration_heads.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import sqlite3
23
from pathlib import Path
34
from tempfile import TemporaryDirectory
@@ -16,6 +17,18 @@ def test_alembic_has_one_head():
1617
assert ScriptDirectory.from_config(config).get_heads() == ["q4r5s6t7u8v9"]
1718

1819

20+
def test_ci_downgrade_target_is_unambiguous():
21+
workflow = Path(".github/workflows/ci.yml").read_text(encoding="utf-8")
22+
target = re.search(r"alembic downgrade (\S+)", workflow)
23+
assert target is not None
24+
25+
config = Config()
26+
config.set_main_option("script_location", "backend/migrations")
27+
script = ScriptDirectory.from_config(config)
28+
29+
assert script._downgrade_revs(target.group(1), tuple(script.get_heads()))
30+
31+
1932
def test_upgrade_head_creates_identity_and_operations_tables(monkeypatch):
2033
with TemporaryDirectory() as directory:
2134
database = Path(directory) / "migration.db"

tests/unit/test_public_release_contract.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ def test_source_and_release_smokes_gate_daemon_recovery_before_release() -> None
338338
def test_public_release_keeps_existing_security_and_packaging_guards() -> None:
339339
workflow = source(".github/workflows/ci.yml")
340340
release_workflow = source(".github/workflows/release.yml")
341+
compose = source("docker-compose.yml")
341342
windows_installer = source("scripts/install.ps1")
342343
unix_installer = source("scripts/install.sh")
343344

@@ -357,3 +358,10 @@ def test_public_release_keeps_existing_security_and_packaging_guards() -> None:
357358
assert "packages: write" in release_workflow
358359
assert "id-token: write" not in release_workflow
359360
assert "Source Recovery Smoke" in workflow
361+
ephemeral_secret = 'echo "SECRET_KEY=$(openssl rand -hex 32)" >> "$GITHUB_ENV"'
362+
assert ephemeral_secret in workflow
363+
assert ephemeral_secret in release_workflow
364+
assert "ci-release-secret" not in workflow
365+
assert "ci-release-secret" not in release_workflow
366+
assert "ODP_QUERY_DATABASE_URL" in compose
367+
assert "${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD" in compose

0 commit comments

Comments
 (0)