-
-
Notifications
You must be signed in to change notification settings - Fork 226
feat: add branch-based versioning for PR AMI builds #1910
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
base: develop
Are you sure you want to change the base?
Conversation
be51860 to
4b0d2d2
Compare
4b0d2d2 to
6817c84
Compare
* feat: add branch-based versioning for PR AMI builds Manually create unique Postgres version names in branch often leads to version conflicts with the base branch versions. These conflicts force developers to deal with manual conflict resolution and unnecessary rebuilds. To address this, this change implement automatic branch-based versioning for AMI builds triggered via workflow_dispatch on non-develop and non-release branches. The branch name is sanitized and appended to the Postgres version string. Example: Branch 'multi-version-ext/pg-partman' produces postgres version 'multi-version-ext-pg-partman' * feat: add notice message for published AMI version Display the published postgres AMI version using GitHub Actions `::notice` annotation. * feat: run actionlint on GitHub Actions workflows Starting to lint GitHub Actions workflows with actionlint. * fix: generate a unique AMI version GitHub run_id is appended to the version suffix to ensure uniqueness. It also enables to track the AMI back to the specific workflow run that created it using url like: https://github.com/supabase/postgres/actions/runs/<run_id>
…d bin flake version workflows Once the AMI release workflow completes, it now triggers the pg_upgrade_scripts and pg_upgrade_bin flake version publishing workflows. This ensures that the necessary upgrade tools are published in sync with new PostgreSQL releases with the correct versioning.
6817c84 to
9c5d03e
Compare
WalkthroughRestructures AMI release workflow into a two-stage Packer pipeline, centralizes generation/consumption of Changes
Sequence DiagramsequenceDiagram
participant GH as GitHub Actions
participant Prep as Prepare Job
participant PackerA as Packer Stage 1
participant PackerB as Packer Stage 2
participant S3 as S3/Catalog
participant Notify as Slack/Notice
participant Down as Downstream Workflows
GH->>Prep: set EXECUTION_ID\nset POSTGRES_MAJOR_VERSION\n(optional) accept postgresVersion input
Prep->>Prep: generate common-nix.vars.pkr.hcl
Prep->>PackerA: init & build AMI (uses common-nix.vars.pkr.hcl, EXECUTION_ID)
PackerA->>PackerB: handoff artifacts/metadata
PackerB->>PackerB: init & build AMI (uses EXECUTION_ID, PG version)
PackerB->>Prep: emit generated version (from common-nix.vars.pkr.hcl)
Prep->>S3: publish artifacts & update catalog (include version)
Prep->>Notify: send Slack/notice with published version
Prep->>Down: trigger downstream workflows with computed version
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @.github/workflows/ami-release-nix.yml:
- Around line 214-227: The two GH CLI invocations in the steps named "Trigger
pg_upgrade_scripts workflow" and "Trigger pg_upgrade_bin flake version workflow"
omit an explicit ref so they may run on the repo default branch; update both gh
workflow run commands to include the current commit ref (e.g. add --ref "${{
github.sha }}" or --ref "${{ github.ref }}" to the command) so the downstream
workflows run on the same ref/commit as the AMI build.
Add --ref parameter to gh workflow run commands to prevent downstream workflows from running on default branch instead of current commit/branch, avoiding mismatched artifacts. Resolves CodeRabbit comment in PR #1910.
Improvement of #1902 (reverted in #1905).
Manually create unique Postgres version names in branch often leads to version conflicts with the base branch versions. These conflicts force developers to deal with manual conflict resolution and unnecessary rebuilds.
To address this, this change implement automatic branch-based versioning for AMI builds triggered via workflow_dispatch on non-develop and non-release branches. The branch name is sanitized and appended to the Postgres version string.
We also publish pg_upgrade scripts and bin flake version right after the AMI release workflow completes.
Example: Branch 'multi-version-ext/pg-partman' produces postgres version 'multi-version-ext-pg-partman'
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.