Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ami-release-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- develop
- release/*
paths:
- '.github/workflows/ami-release-nix.yml'
- 'common-nix.vars.pkr.hcl'
Expand Down Expand Up @@ -54,7 +55,7 @@ jobs:
run: |
packer init stage2-nix-psql.pkr.hcl
GIT_SHA=${{github.sha}}
packer build -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${GITHUB_RUN_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" stage2-nix-psql.pkr.hcl
packer build -var "git_sha=${GIT_SHA}" -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${GITHUB_RUN_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" stage2-nix-psql.pkr.hcl

- name: Grab release version
id: process_release_version
Expand Down Expand Up @@ -129,6 +130,11 @@ jobs:
SLACK_MESSAGE: 'Building Postgres AMI failed'
SLACK_FOOTER: ''

- name: Cleanup resources on build cancellation
if: ${{ always() }}
run: |
aws ec2 describe-instances --filters "Name=tag:packerExecutionId,Values=${GITHUB_RUN_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -n 1 -I {} aws ec2 terminate-instances --instance-ids {}

- name: Cleanup resources on build cancellation
if: ${{ cancelled() }}
run: |
Expand Down
158 changes: 0 additions & 158 deletions .github/workflows/ami-release.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/dockerhub-release-15-6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- develop
- release/*
paths:
- ".github/workflows/dockerhub-release-15-6.yml"
- "common-nix.vars*"
workflow_dispatch:

jobs:
settings:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
push:
branches:
- develop
- release/*
pull_request:
workflow_dispatch:

permissions:
contents: read
Expand Down Expand Up @@ -56,4 +58,4 @@ jobs:
-e AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} \
base_nix bash -c "./workspace/docker/nix/build_nix.sh"
name: build psql bundle on ${{ matrix.arch }}


Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Publish pg_upgrade_scripts
name: Publish nix pg_upgrade_bin flake version

on:
push:
branches:
- develop
paths:
- '.github/workflows/publish-pgupgrade-scripts.yml'
- 'common.vars.pkr.hcl'
workflow_dispatch:
inputs:
postgresVersion:
Expand All @@ -27,17 +21,19 @@ jobs:
- name: Grab release version
id: process_release_version
run: |
VERSION=$(grep 'postgres-version' common.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
VERSION=$(grep 'postgres-version' common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
VERSION=${{ inputs.postgresVersion }}
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"

- name: Create a tarball containing pg_upgrade scripts
- name: Create a tarball containing the latest nix flake version
working-directory: /tmp/
run: |
mkdir -p /tmp/pg_upgrade_scripts
cp -r ansible/files/admin_api_scripts/pg_upgrade_scripts/* /tmp/pg_upgrade_scripts
tar -czvf /tmp/pg_upgrade_scripts.tar.gz -C /tmp/ pg_upgrade_scripts
mkdir -p ${{ steps.process_release_version.outputs.major_version }}
echo $GITHUB_SHA > ${{ steps.process_release_version.outputs.major_version }}/nix_flake_version
tar -czvf pg_upgrade_bin.tar.gz ${{ steps.process_release_version.outputs.major_version }}

- name: configure aws credentials - staging
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -47,7 +43,7 @@ jobs:

- name: Upload pg_upgrade scripts to s3 staging
run: |
aws s3 cp /tmp/pg_upgrade_scripts.tar.gz s3://${{ secrets.ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/pg_upgrade_scripts.tar.gz
aws s3 cp /tmp/pg_upgrade_bin.tar.gz s3://${{ secrets.ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/20.04.tar.gz

- name: Slack Notification on Failure
if: ${{ failure() }}
Expand All @@ -56,12 +52,12 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }}
SLACK_USERNAME: 'gha-failures-notifier'
SLACK_COLOR: 'danger'
SLACK_MESSAGE: 'Publishing pg_upgrade scripts failed'
SLACK_MESSAGE: 'Publishing pg_upgrade binaries flake version failed'
SLACK_FOOTER: ''

publish-prod:
runs-on: ubuntu-latest
if: github.ref_name == 'develop'
if: github.ref_name == 'develop' || contains( github.ref, 'release' )

steps:
- name: Checkout Repo
Expand All @@ -70,14 +66,19 @@ jobs:
- name: Grab release version
id: process_release_version
run: |
VERSION=$(grep 'postgres-version' common.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
VERSION=$(grep 'postgres-version' common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
if [[ "${{ inputs.postgresVersion }}" != "" ]]; then
VERSION=${{ inputs.postgresVersion }}
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"

- name: Create a tarball containing pg_upgrade scripts
- name: Create a tarball containing the latest nix flake version
working-directory: /tmp/
run: |
mkdir -p /tmp/pg_upgrade_scripts
cp -r ansible/files/admin_api_scripts/pg_upgrade_scripts/* /tmp/pg_upgrade_scripts
tar -czvf /tmp/pg_upgrade_scripts.tar.gz -C /tmp/ pg_upgrade_scripts
mkdir -p ${{ steps.process_release_version.outputs.major_version }}
echo $GITHUB_SHA > ${{ steps.process_release_version.outputs.major_version }}/nix_flake_version
tar -czvf pg_upgrade_bin.tar.gz ${{ steps.process_release_version.outputs.major_version }}

- name: configure aws credentials - prod
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -87,7 +88,7 @@ jobs:

- name: Upload pg_upgrade scripts to s3 prod
run: |
aws s3 cp /tmp/pg_upgrade_scripts.tar.gz s3://${{ secrets.PROD_ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/pg_upgrade_scripts.tar.gz
aws s3 cp /tmp/pg_upgrade_bin.tar.gz s3://${{ secrets.PROD_ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/20.04.tar.gz

- name: Slack Notification on Failure
if: ${{ failure() }}
Expand All @@ -96,5 +97,5 @@ jobs:
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }}
SLACK_USERNAME: 'gha-failures-notifier'
SLACK_COLOR: 'danger'
SLACK_MESSAGE: 'Publishing pg_upgrade scripts failed'
SLACK_MESSAGE: 'Publishing pg_upgrade binaries flake version failed'
SLACK_FOOTER: ''
6 changes: 3 additions & 3 deletions .github/workflows/publish-nix-pgupgrade-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- develop
- sam/nix-and-conventional-ami
- release/*
paths:
- '.github/workflows/publish-pgupgrade-scripts.yml'
- '.github/workflows/publish-nix-pgupgrade-scripts.yml'
- 'common-nix.vars.pkr.hcl'
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:

publish-prod:
runs-on: ubuntu-latest
if: github.ref_name == 'develop'
if: github.ref_name == 'develop' || contains( github.ref, 'release' )

steps:
- name: Checkout Repo
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
POSTGRES_PASSWORD: password
steps:
- uses: actions/checkout@v3
- id: settings
# Remove spaces and quotes to get the raw version string
run: sed -r 's/(\s|\")+//g' common-nix.vars.pkr.hcl >> $GITHUB_OUTPUT

- id: args
uses: mikefarah/yq@master
with:
Expand All @@ -36,23 +40,23 @@ jobs:
with:
load: true
context: .
file: "Dockerfile-156"
target: production
build-args: |
${{ steps.args.outputs.result }}
tags: supabase/postgres:latest
tags: supabase/postgres:${{ steps.settings.outputs.postgres-version }}
cache-from: |
type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
type=gha,scope=${{ github.base_ref }}-latest-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
type=gha,scope=${{ github.ref_name }}-${{ steps.settings.outputs.postgres-version }}-${{ matrix.arch }}
type=gha,scope=${{ github.base_ref }}-${{ steps.settings.outputs.postgres-version }}-${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-${{ steps.settings.outputs.postgres-version }}-${{ matrix.arch }}

- name: Start Postgres
run: |
docker run --rm --pull=never \
-e POSTGRES_PASSWORD=${{ env.POSTGRES_PASSWORD }} \
-p ${{ env.POSTGRES_PORT }}:5432 \
--name supabase_postgres \
-d supabase/postgres:latest

-d supabase/postgres:${{ steps.settings.outputs.postgres-version }}
- name: Install psql
run: |
sudo apt update
Expand Down
Loading
Loading