Repository navigation
fix(db,ci): make migration 0119 online-safe and bound production migrations #7671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,9 @@ jobs: | |
| name: Deploy Database Migrations | ||
| runs-on: ubuntu-latest | ||
| environment: production | ||
| concurrency: | ||
| group: production-database-migrations | ||
| cancel-in-progress: false | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
|
|
@@ -38,7 +41,18 @@ jobs: | |
| env: | ||
| DATABASE_URL: ${{ secrets.DATABASE_URL_UNPOOLED }} | ||
| DATABASE_URL_UNPOOLED: ${{ secrets.DATABASE_URL_UNPOOLED }} | ||
| run: bun drizzle-kit migrate | ||
| # drizzle applies every pending migration in one transaction, so a | ||
| # migration that queues for a lock blocks all traffic behind it. | ||
| PGOPTIONS: -c lock_timeout=5s -c statement_timeout=60s | ||
| # Losing a lock race rolls back cleanly, so only that is retried. | ||
| run: | | ||
| for attempt in 1 2 3 4 5 6 7 8; do | ||
| if bun drizzle-kit migrate 2>&1 | tee migrate.log; then exit 0; fi | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Preserve the migration command exit status.
Proposed fix # Losing a lock race rolls back cleanly, so only that is retried.
run: |
+ set -o pipefail
for attempt in 1 2 3 4 5; do
if bun drizzle-kit migrate 2>&1 | tee migrate.log; then exit 0; fi🧰 Tools🪛 zizmor (1.30.0)[warning] 1-788: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) [warning] 12-55: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block (excessive-permissions) 🤖 Prompt for AI Agents |
||
| grep -qE "deadlock detected|lock timeout" migrate.log || exit 1 | ||
| echo "::warning::Migration lost a lock race (attempt $attempt), retrying" | ||
| sleep $((attempt * 5)) | ||
| done | ||
| exit 1 | ||
|
|
||
| deploy-api: | ||
| name: Deploy API to Vercel | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 5672
🌐 Web query:
GitHub Actions concurrency at most one pending run queue max syntax official documentation💡 Result:
<search_synthesis>
In GitHub Actions, the concurrency behavior for pending runs is controlled by the
queueproperty within theconcurrencyblock [1][2][3]. By default, GitHub Actions usesqueue: single, which allows at most one pending run in a concurrency group [1][2][3]. When a new run is queued and another is already pending, the existing pending run is canceled and replaced by the new one [1][2][3]. To allow more than one pending run, you can use thequeue: maxconfiguration [1][2][3]. This setting allows up to 100 jobs or workflow runs to wait in the concurrency group [1][2][3][4]. Once the queue reaches this limit, any additional incoming runs are canceled [1][2][3]. Important constraints and syntax details: - Thequeue: maxconfiguration cannot be used in combination withcancel-in-progress: true, as they represent conflicting behaviors for handling in-progress runs [1][2][3]. Attempting to use both will result in a workflow validation error [1][2]. - Thequeueproperty is optional; if omitted, it defaults tosingle[1][2][3]. - This feature was updated in May 2026 to support larger queues, allowing for sequential processing of up to 100 queued runs [5]. Example syntax: concurrency: group: my-concurrency-group queue: max cancel-in-progress: false</search_synthesis>
<source_evidence>
Citations:
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 26938
🏁 Script executed:
Repository: superset-sh/superset
Length of output: 3430
🌐 Web query:
official actions/checkout v4 checkout default ref SHA that triggered workflow workflow_dispatch selected ref💡 Result:
<search_synthesis>
When using actions/checkout@v4, the default behavior for the ref input is to automatically checkout the reference or SHA that triggered the workflow [1][2]. For a workflow_dispatch event, when you select a specific branch or tag in the GitHub Actions UI, that selected reference becomes the trigger for the workflow [1][2]. Consequently, actions/checkout@v4 will default to checking out that specific reference (the branch or tag you selected) [1][2]. Key technical details regarding this behavior: 1. Default Ref Resolution: If the ref input is not explicitly provided in your workflow YAML, the action defaults to the reference or SHA associated with the event that triggered the workflow [1][2]. 2. Fetching Behavior: By default, the action fetches only a single commit—the specific SHA of the ref that triggered the workflow [1][3][4]. This is an optimization to improve performance [4]. 3. Detached HEAD: When checking out a specific SHA or a tag, the repository is typically checked out in a detached HEAD state [1][3]. 4. Workflow Dispatch Specifics: Because the workflow_dispatch event allows you to choose a ref (branch or tag) at runtime, the action correctly identifies this selected ref as the trigger and checks it out accordingly [1][2]. If you need to ensure a specific commit is checked out regardless of the trigger, or if you need to fetch more history, you can explicitly set the ref input (e.g., ref: ${{ github.sha }}) or adjust the fetch-depth input [1][5].
</search_synthesis>
<source_evidence>
Citations:
Preserve manually dispatched migration revisions.
For successive pushes to
main, a later checkout contains earlier migration files, anddrizzle-kit migrateapplies all pending migrations. The pending-run replacement does not skip those migrations.However,
workflow_dispatchcan target a branch or tag that a latermainrun does not contain. Replacing that pending run can leave its migrations unapplied. If production dispatches can target such revisions, preserve the pending runs:Suggested change
concurrency: group: production-database-migrations cancel-in-progress: false + queue: maxGitHub supports
queue: maxwith up to 100 pending runs.📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.30.0)
[warning] 1-780: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
[warning] 12-47: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block
(excessive-permissions)
🤖 Prompt for AI Agents