Skip to content

Commit d064aac

Browse files
committed
Merge branch 'develop' into TheOtherBrian1-patch-1
2 parents d8c6c41 + aadd726 commit d064aac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+8352
-627
lines changed

.github/workflows/ami-release-nix.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- develop
7+
- release/*
78
paths:
89
- '.github/workflows/ami-release-nix.yml'
910
- 'common-nix.vars.pkr.hcl'
@@ -54,7 +55,7 @@ jobs:
5455
run: |
5556
packer init stage2-nix-psql.pkr.hcl
5657
GIT_SHA=${{github.sha}}
57-
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
58+
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
5859
5960
- name: Grab release version
6061
id: process_release_version
@@ -129,6 +130,11 @@ jobs:
129130
SLACK_MESSAGE: 'Building Postgres AMI failed'
130131
SLACK_FOOTER: ''
131132

133+
- name: Cleanup resources on build cancellation
134+
if: ${{ always() }}
135+
run: |
136+
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 {}
137+
132138
- name: Cleanup resources on build cancellation
133139
if: ${{ cancelled() }}
134140
run: |

.github/workflows/ami-release.yml

Lines changed: 0 additions & 158 deletions
This file was deleted.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Release 15.6 on Dockerhub
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- release/*
8+
paths:
9+
- ".github/workflows/dockerhub-release-15-6.yml"
10+
- "common-nix.vars*"
11+
workflow_dispatch:
12+
13+
jobs:
14+
settings:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
docker_version: ${{ steps.settings.outputs.postgres-version }}
18+
image_tag: supabase/postgres:${{ steps.settings.outputs.postgres-version }}
19+
build_args: ${{ steps.args.outputs.result }}
20+
steps:
21+
- uses: actions/checkout@v3
22+
- id: settings
23+
# Remove spaces and quotes to get the raw version string
24+
run: sed -r 's/(\s|\")+//g' common-nix.vars.pkr.hcl >> $GITHUB_OUTPUT
25+
- id: args
26+
uses: mikefarah/yq@master
27+
with:
28+
cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml'
29+
30+
build_release_image:
31+
needs: [settings]
32+
strategy:
33+
matrix:
34+
include:
35+
- runner: [self-hosted, X64]
36+
arch: amd64
37+
- runner: arm-runner
38+
arch: arm64
39+
runs-on: ${{ matrix.runner }}
40+
timeout-minutes: 180
41+
outputs:
42+
image_digest: ${{ steps.build.outputs.digest }}
43+
steps:
44+
- run: docker context create builders
45+
- uses: docker/setup-buildx-action@v3
46+
with:
47+
endpoint: builders
48+
- uses: docker/login-action@v2
49+
with:
50+
username: ${{ secrets.DOCKER_USERNAME }}
51+
password: ${{ secrets.DOCKER_PASSWORD }}
52+
- id: build
53+
uses: docker/build-push-action@v5
54+
with:
55+
push: true
56+
build-args: |
57+
${{ needs.settings.outputs.build_args }}
58+
target: production
59+
tags: ${{ needs.settings.outputs.image_tag }}_${{ matrix.arch }}
60+
platforms: linux/${{ matrix.arch }}
61+
cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
62+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-latest-${{ matrix.arch }}
63+
file: "Dockerfile-156"
64+
- name: Slack Notification
65+
if: ${{ failure() }}
66+
uses: rtCamp/action-slack-notify@v2
67+
env:
68+
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }}
69+
SLACK_USERNAME: "gha-failures-notifier"
70+
SLACK_COLOR: "danger"
71+
SLACK_MESSAGE: "Building Postgres ${{ matrix.arch }} image failed"
72+
SLACK_FOOTER: ""
73+
74+
merge_manifest:
75+
needs: [settings, build_release_image]
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: docker/setup-buildx-action@v3
79+
- uses: docker/login-action@v2
80+
with:
81+
username: ${{ secrets.DOCKER_USERNAME }}
82+
password: ${{ secrets.DOCKER_PASSWORD }}
83+
- name: Merge multi-arch manifests
84+
run: |
85+
docker buildx imagetools create -t ${{ needs.settings.outputs.image_tag }} \
86+
${{ needs.settings.outputs.image_tag }}_amd64 \
87+
${{ needs.settings.outputs.image_tag }}_arm64
88+
- name: Slack Notification
89+
if: ${{ failure() }}
90+
uses: rtCamp/action-slack-notify@v2
91+
env:
92+
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }}
93+
SLACK_USERNAME: "gha-failures-notifier"
94+
SLACK_COLOR: "danger"
95+
SLACK_MESSAGE: "Building Postgres image failed"
96+
SLACK_FOOTER: ""
97+
98+
publish:
99+
needs: [settings, merge_manifest]
100+
# Call workflow explicitly because events from actions cannot trigger more actions
101+
uses: ./.github/workflows/mirror.yml
102+
with:
103+
version: ${{ needs.settings.outputs.docker_version }}
104+
secrets: inherit

.github/workflows/nix-build.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
push:
55
branches:
66
- develop
7+
- release/*
78
pull_request:
9+
workflow_dispatch:
810

911
permissions:
1012
contents: read
@@ -42,9 +44,18 @@ jobs:
4244
python -c "import os; file = open('nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
4345
env:
4446
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
45-
46-
- name: Build docker images
47+
- name: Log in to Docker Hub
48+
uses: docker/login-action@v2
49+
with:
50+
username: ${{ secrets.DOCKER_USERNAME }}
51+
password: ${{ secrets.DOCKER_PASSWORD }}
52+
- name: Build psql bundle with nix
4753
run: docker build -t base_nix -f docker/nix/Dockerfile .
4854
- name: Run build psql bundle
49-
run: docker run -e AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} -e AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} -e AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} base_nix bash -c "./workspace/docker/nix/build.sh"
55+
run: |
56+
docker run -e AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} \
57+
-e AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} \
58+
-e AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} \
59+
base_nix bash -c "./workspace/docker/nix/build_nix.sh"
5060
name: build psql bundle on ${{ matrix.arch }}
61+

0 commit comments

Comments
 (0)