feat: 260 refactor database update #1436
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #260
This PR replaces PR #1426 that was reverted in #1431
Refactored the db-update.yml workflows to have 2 completely separate path for running the update directly (or via a release) and running it if the catalog changes.
Now if called with a workflow_call (presumably from one the release workflows) we only update the schema via db-update (which maybe should be renamed db-update-schema, but I wanted to limit the number of changes).
If called from a repository_dispatch, i.e. from the catalog repo, we only update the contents of the DB using the populate script of the same version as what is installed in GCP (or said otherwise we checkout the same version as what is installed on GCP before running populate). This is done for DEV, QA and PROD at the same time.
From Copilot:
This pull request introduces significant improvements to the GitHub Actions workflows for the Mobility Database project. The main changes include modularizing and enhancing the database content update process, adding robust support for resolving API metadata, and improving Slack notification handling for workflow failures. These updates make the workflows more maintainable, reusable, and reliable across environments (dev, QA, prod).
Workflow modularization and enhancements:
.github/workflows/db-update-content.ymlto handle database content updates, secret management, and log artifact uploads, improving separation of concerns and maintainability..github/actions/resolve-api-meta/action.yml, a composite action to robustly resolve the deployed API commit SHA and version from the API's metadata endpoint, handling token exchange and failures gracefully..github/workflows/catalog-update.ymlto orchestrate catalog-driven content updates for dev, QA, and prod environments, using the new resolve-api-meta action and db-update-content workflow, and triggering Slack notifications on failure.Notification improvements:
.github/actions/notify-slack/action.ymlto support a new "test" priority level and refactored the alert message logic for clarity and extensibility. [1] [2] [3]Testing tips:
Some of the workflows can be triggered by hand. Each one has a DRY_RUN parameter.
Tested with this DRY_RUN:
db-update-dev.yml
db-update-qa.yml
db-update-prod.yml
Tested by manually running catalog-update.yml: https://github.com/MobilityData/mobility-feed-api/actions/runs/19084169644
Also tested by launching a full scale QA release: https://github.com/MobilitData/mobility-feed-api/actions/runs/19103854755
Did not test a prod release.
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything