Skip to content

Commit 2c56608

Browse files
committed
feat: upload software artifacts to internal bucket
1 parent 141e7da commit 2c56608

File tree

5 files changed

+97
-3
lines changed

5 files changed

+97
-3
lines changed

.github/workflows/ami-release.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: [self-hosted, linux]
11+
runs-on: [self-hosted, X64]
1212
timeout-minutes: 150
13+
permissions:
14+
contents: write
15+
packages: write
16+
id-token: write
1317

1418
steps:
1519
- name: Checkout Repo
@@ -26,6 +30,20 @@ jobs:
2630
VERSION=$(sed -e 's/postgres-version = "\(.*\)"/\1/g' common.vars.pkr.hcl)
2731
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
2832
33+
- name: configure aws credentials - staging
34+
uses: aws-actions/configure-aws-credentials@v1
35+
with:
36+
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
37+
aws-region: "us-east-1"
38+
39+
- name: Upload software manifest to s3
40+
run: |
41+
cd ansible
42+
ansible-playbook -i localhost \
43+
-e "ami_release_version=${{ steps.process_release_version.outputs.version }}" \
44+
-e "internal_artifacts_bucket=${{ secrets.ARTIFACTS_BUCKET }}" \
45+
manifest-playbook.yml
46+
2947
- name: Create release
3048
uses: softprops/action-gh-release@v1
3149
with:

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
.python-version
33
venv/
44
*.swp
5-
docker/cache/
5+
docker/cache/
6+
7+
ansible/image-manifest*.json

ansible/files/manifest.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{ vars | to_json }}

ansible/manifest-playbook.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
- hosts: localhost
2+
gather_facts: no
3+
4+
vars_files:
5+
- ./vars.yml
6+
7+
tasks:
8+
- name: Write out image manifest
9+
action: template src=files/manifest.json dest=./image-manifest-{{ ami_release_version }}.json
10+
11+
- name: Upload image manifest
12+
shell: |
13+
aws s3 cp ./image-manifest-{{ ami_release_version }}.json s3://{{ internal_artifacts_bucket }}/manifests/postgres-{{ ami_release_version }}/software-manifest.json
14+
15+
# upload software artifacts of interest
16+
# Generally - download, extract, repack as xz archive, upload
17+
# currently, we upload gotrue, adminapi, postgrest
18+
- name: gotrue - download commit archive
19+
get_url:
20+
url: "https://github.com/supabase/gotrue/releases/download/{{ gotrue_release }}/gotrue-{{ gotrue_release }}-arm64.tar.gz"
21+
dest: /tmp/gotrue.tar.gz
22+
checksum: "{{ gotrue_release_checksum }}"
23+
timeout: 60
24+
25+
- name: gotrue - create /tmp/gotrue
26+
file:
27+
path: /tmp/gotrue
28+
state: directory
29+
mode: 0775
30+
31+
- name: gotrue - unpack archive in /tmp/gotrue
32+
unarchive:
33+
remote_src: yes
34+
src: /tmp/gotrue.tar.gz
35+
dest: /tmp/gotrue
36+
37+
- name: gotrue - pack archive
38+
shell: |
39+
tar -cJf /tmp/gotrue-{{ gotrue_release }}-arm64.tar.xz /tmp/gotrue
40+
41+
- name: PostgREST - download ubuntu binary archive (arm)
42+
get_url:
43+
url: "https://github.com/PostgREST/postgrest/releases/download/v{{ postgrest_release }}/postgrest-v{{ postgrest_release }}-ubuntu-aarch64.tar.xz"
44+
dest: /tmp/postgrest-{{ postgrest_release }}-arm64.tar.xz
45+
checksum: "{{ postgrest_arm_release_checksum }}"
46+
timeout: 60
47+
48+
- name: Download adminapi archive
49+
get_url:
50+
url: "https://supabase-public-artifacts-bucket.s3.amazonaws.com/supabase-admin-api/v{{ adminapi_release }}/supabase-admin-api_{{ adminapi_release }}_linux_arm64.tar.gz"
51+
dest: "/tmp/adminapi.tar.gz"
52+
timeout: 90
53+
54+
- name: adminapi - unpack archive in /tmp
55+
unarchive:
56+
remote_src: yes
57+
src: /tmp/adminapi.tar.gz
58+
dest: /tmp
59+
60+
- name: adminapi - pack archive
61+
shell: |
62+
tar -cJf /tmp/supabase-admin-api-{{ adminapi_release }}-arm64.tar.xz /tmp/supabase-admin-api
63+
64+
- name: upload archives
65+
shell: |
66+
aws s3 cp /tmp/{{ item.file }} s3://{{ internal_artifacts_bucket }}/upgrades/{{ item.service }}/{{ item.file }}
67+
with_items:
68+
- service: gotrue
69+
file: gotrue-{{ gotrue_release }}-arm64.tar.xz
70+
- service: postgrest
71+
file: postgrest-{{ postgrest_release }}-arm64.tar.xz
72+
- service: supabase-admin-api
73+
file: supabase-admin-api-{{ adminapi_release }}-arm64.tar.xz

common.vars.pkr.hcl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
postgres-version = "15.1.0.45"
1+
postgres-version = "15.1.0.46-rc0"

0 commit comments

Comments
 (0)