Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork221
feat: introduce nightly build workflow#1941
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| name: Build Base Image Nightly | ||
| on: | ||
| #schedule: | ||
| # - cron: '0 2 * * *' # 2 AM UTC daily | ||
| workflow_dispatch: | ||
| inputs: | ||
| branch: | ||
| description: 'Branch to build from' | ||
| required: false | ||
| default: 'develop' | ||
| type: string | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| jobs: | ||
| build-base-image: | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404-arm | ||
| timeout-minutes: 150 | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: supabase/postgres/.github/actions/shared-checkout@HEAD | ||
| with: | ||
| ref: ${{ github.event.inputs.branch || 'develop' }} | ||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| role-to-assume: ${{ secrets.DEV_AWS_ROLE }} | ||
| aws-region: "us-east-1" | ||
| output-credentials: true | ||
| role-duration-seconds: 7200 | ||
| - name: Install nix | ||
| uses: cachix/install-nix-action@v27 | ||
| with: | ||
| install_url: https://releases.nixos.org/nix/nix-2.29.1/install | ||
| extra_nix_config: | | ||
| substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com | ||
| trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | ||
| - name: Set execution ID and timestamp | ||
| run: | | ||
| echo "EXECUTION_ID=${{ github.run_id }}-base-nightly" >> $GITHUB_ENV | ||
| echo "BUILD_TIMESTAMP=$(date -u +%Y%m%d-%H%M%S)" >> $GITHUB_ENV | ||
| - name: Build base stage 1 AMI | ||
| env: | ||
| AWS_MAX_ATTEMPTS: 10 | ||
| AWS_RETRY_MODE: adaptive | ||
| run: | | ||
| GIT_SHA=${{ github.sha }} | ||
| nix run github:supabase/postgres/${GIT_SHA}#packer -- init amazon-arm64-nix.pkr.hcl | ||
| nix run github:supabase/postgres/${GIT_SHA}#packer -- build \ | ||
| -var "git-head-version=${GIT_SHA}" \ | ||
| -var "packer-execution-id=${EXECUTION_ID}" \ | ||
| -var-file="development-arm.vars.pkr.hcl" \ | ||
| -var "base-image-nightly=true" \ | ||
| -var "build-timestamp=${BUILD_TIMESTAMP}" \ | ||
| -var "region=us-east-1" \ | ||
| -var 'ami_regions=["us-east-1","ap-southeast-1"]' \ | ||
| amazon-arm64-nix.pkr.hcl | ||
| - name: Slack Notification on Failure | ||
| if: ${{ failure() }} | ||
| uses: rtCamp/action-slack-notify@v2 | ||
| env: | ||
| SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }} | ||
| SLACK_USERNAME: 'gha-failures-notifier' | ||
| SLACK_COLOR: 'danger' | ||
| SLACK_MESSAGE: 'Building base image nightly failed' | ||
| SLACK_FOOTER: '' | ||
| - name: Cleanup resources after build | ||
| if: ${{ always() }} | ||
| run: | | ||
| aws ec2 --region us-east-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region us-east-1 --instance-ids | ||
| - name: Cleanup resources on build cancellation | ||
| if: ${{ cancelled() }} | ||
| run: | | ||
| aws ec2 --region us-east-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${EXECUTION_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -r aws ec2 terminate-instances --region us-east-1 --instance-ids |
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.