Skip to content

[Bug]: Simple Alembic Migrations to Staging Not Working #244

@petercarbsmith

Description

@petercarbsmith

Pre-flight checklist

  • I have searched the existing issues
  • I have read the contributing guidelines

Describe the bug

After merging a pull request into main that includes a new Alembic migration, the staging database does not consistently update to the latest revision. Even after the GitHub Actions "Build and Push" and "Deploy Staging" workflows report success, the database remains at the previous version.

Manual attempts to trigger the migration using pixi run cloud-migrate fail with an Image not found error, suggesting a synchronization delay between GitHub Container Registry (GHCR) and the Google Artifact Registry proxy (ghcr-proxy).

The issue was temporarily resolved by running the migration locally via the Cloud SQL Auth Proxy:

pixi run -e deployment cloud-sql-proxy biocirv-470318:us-west1:biocirv-staging --port 5434
export DATABASE_URL="postgresql://biocirv_user:PASSWORD@127.0.0.1:5434/biocirv-staging"
pixi run migrate

This suggests the root cause is the lag in the image availability/syncing within the GCP environment immediately following a build.

Steps to reproduce

Merge a PR containing a new Alembic migration file (e.g., alembic/versions/60b08397200f_...py) into the main branch.
Wait for the Build and Push Docker Images workflow to complete successfully.
Wait for the Deploy Staging workflow to complete.
Verify the database version in staging (remains at the old revision).
Attempt to force the migration with the specific short SHA:
IMAGE_TAG=f15160a pixi run cloud-migrate

Observe the gcloud error: Image ... not found.

Expected behavior

Merging to main should trigger a build and a deployment that successfully executes alembic upgrade head on the Cloud Run migration job using the newly built image.

Relevant log output / screenshots

X Updating job... Image 'us-west1-docker.pkg.dev/biocirv-470318/ghcr-proxy/sustainability-software-lab/ca-biositing/pipeline:f15160a' not found.
ERROR: (gcloud.run.jobs.update) Image 'us-west1-docker.pkg.dev/biocirv-470318/ghcr-proxy/sustainability-software-lab/ca-biositing/pipeline:f15160a' not found.

Software version

v0.1.0

Environment

macOS

Other environment details

Using ghcr-proxy in Google Artifact Registry to pull images from GHCR.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions