Skip to content

Commit e9e60ba

Browse files
authored
ci: Use larger runner for other workflows and wait for the nix workflow to succeed (#1652)
* ci: use larger runner for the test and testinfra-ami-build workflows * ci: wait for the nix workflow to succeed before running the test and testinfra-ami-build workflow * ci: use larger runner for other workflows * chore: be less verbose when building postgresql dev setup * ci: build and cache more packages in the Nix CI workflow * ci: run nix copy * ci: do not run nix as root
1 parent 4b77682 commit e9e60ba

13 files changed

+62
-80
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ permissions:
1919

2020
jobs:
2121
build:
22-
runs-on: arm-runner
22+
runs-on: large-linux-arm
2323
timeout-minutes: 150
2424

2525
steps:
@@ -40,7 +40,7 @@ jobs:
4040

4141
- name: Generate common-nix.vars.pkr.hcl
4242
run: |
43-
PG_VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ env.POSTGRES_MAJOR_VERSION }}'"]' ansible/vars.yml)
43+
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ env.POSTGRES_MAJOR_VERSION }}'"]' ansible/vars.yml)
4444
PG_VERSION=$(echo "$PG_VERSION" | tr -d '"') # Remove any surrounding quotes
4545
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
4646
# Ensure there's a newline at the end of the file

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717

1818
jobs:
1919
prepare:
20-
runs-on: ubuntu-latest
20+
runs-on: large-linux-x86
2121
outputs:
2222
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
2323
steps:
@@ -38,11 +38,7 @@ jobs:
3838
matrix:
3939
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
4040
include:
41-
- runner: arm-runner
42-
arch: arm64
43-
ubuntu_release: focal
44-
ubuntu_version: 20.04
45-
mcpu: neoverse-n1
41+
- runner: large-linux-arm
4642
runs-on: ${{ matrix.runner }}
4743
timeout-minutes: 150
4844

@@ -55,7 +51,7 @@ jobs:
5551
- name: Run checks if triggered manually
5652
if: ${{ github.event_name == 'workflow_dispatch' }}
5753
run: |
58-
SUFFIX=$(sudo nix run nixpkgs#yq -- ".postgres_release[\"postgres${{ matrix.postgres_version }}\"]" ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/')
54+
SUFFIX=$(nix run nixpkgs#yq -- ".postgres_release[\"postgres${{ matrix.postgres_version }}\"]" ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/')
5955
if [[ -z "$SUFFIX" ]] ; then
6056
echo "Version must include non-numeric characters if built manually."
6157
exit 1
@@ -66,7 +62,7 @@ jobs:
6662

6763
- name: Generate common-nix.vars.pkr.hcl
6864
run: |
69-
PG_VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
65+
PG_VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
7066
PG_VERSION=$(echo "$PG_VERSION" | tr -d '"') # Remove any surrounding quotes
7167
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
7268
# Ensure there's a newline at the end of the file

.github/workflows/dockerhub-release-matrix.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616

1717
jobs:
1818
prepare:
19-
runs-on: ubuntu-latest
19+
runs-on: large-linux-x86
2020
outputs:
2121
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
2222
steps:
@@ -49,7 +49,7 @@ jobs:
4949
needs: prepare
5050
strategy:
5151
matrix: ${{ fromJson(needs.prepare.outputs.matrix_config) }}
52-
runs-on: ubuntu-latest
52+
runs-on: large-linux-x86
5353
outputs:
5454
build_args: ${{ steps.args.outputs.result }}
5555
steps:
@@ -75,7 +75,7 @@ jobs:
7575
matrix:
7676
postgres: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
7777
arch: [amd64, arm64]
78-
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
78+
runs-on: ${{ matrix.arch == 'amd64' && 'large-linux-x86' || 'large-linux-arm' }}
7979
timeout-minutes: 180
8080
steps:
8181
- name: Checkout Repo
@@ -93,7 +93,7 @@ jobs:
9393
id: image
9494
run: |
9595
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
96-
pg_version=$(sudo nix run nixpkgs#nushell -- -c '
96+
pg_version=$(nix run nixpkgs#nushell -- -c '
9797
let version = "${{ matrix.postgres.version }}"
9898
let release_key = if ($version | str contains "orioledb") {
9999
$"postgresorioledb-17"
@@ -132,7 +132,7 @@ jobs:
132132
strategy:
133133
matrix:
134134
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
135-
runs-on: ubuntu-latest
135+
runs-on: large-linux-x86
136136
steps:
137137
- name: Checkout Repo
138138
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
@@ -176,7 +176,7 @@ jobs:
176176
${{ steps.get_version.outputs.pg_version }}_arm64
177177
combine_results:
178178
needs: [prepare, merge_manifest]
179-
runs-on: ubuntu-latest
179+
runs-on: large-linux-x86
180180
steps:
181181
- name: Checkout Repo
182182
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

.github/workflows/manual-docker-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313

1414
jobs:
1515
prepare:
16-
runs-on: ubuntu-latest
16+
runs-on: large-linux-x86
1717
outputs:
1818
matrix_config: ${{ steps.set-matrix.outputs.matrix_config }}
1919
steps:
@@ -46,7 +46,7 @@ jobs:
4646
needs: prepare
4747
strategy:
4848
matrix: ${{ fromJson(needs.prepare.outputs.matrix_config) }}
49-
runs-on: ubuntu-latest
49+
runs-on: large-linux-x86
5050
outputs:
5151
build_args: ${{ steps.args.outputs.result }}
5252
steps:
@@ -72,7 +72,7 @@ jobs:
7272
matrix:
7373
postgres: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
7474
arch: [amd64, arm64]
75-
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'arm-runner' }}
75+
runs-on: ${{ matrix.arch == 'amd64' && 'large-linux-x86' || 'large-linux-arm' }}
7676
timeout-minutes: 180
7777
steps:
7878
- name: Checkout Repo
@@ -90,7 +90,7 @@ jobs:
9090
id: image
9191
run: |
9292
if [[ "${{ matrix.arch }}" == "arm64" ]]; then
93-
pg_version=$(sudo nix run nixpkgs#nushell -- -c '
93+
pg_version=$(nix run nixpkgs#nushell -- -c '
9494
let version = "${{ matrix.postgres.version }}"
9595
let release_key = if ($version | str contains "orioledb") {
9696
$"postgresorioledb-17"
@@ -141,7 +141,7 @@ jobs:
141141
strategy:
142142
matrix:
143143
include: ${{ fromJson(needs.prepare.outputs.matrix_config).include }}
144-
runs-on: ubuntu-latest
144+
runs-on: large-linux-x86
145145
steps:
146146
- name: Checkout Repo
147147
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
@@ -185,7 +185,7 @@ jobs:
185185
${{ steps.get_version.outputs.pg_version }}_arm64
186186
combine_results:
187187
needs: [prepare, merge_manifest]
188-
runs-on: ubuntu-latest
188+
runs-on: large-linux-x86
189189
steps:
190190
- name: Checkout Repo
191191
uses: supabase/postgres/.github/actions/shared-checkout@HEAD

.github/workflows/nix-build.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ on:
1010

1111
permissions:
1212
contents: read
13-
id-token: write
14-
13+
id-token: write
14+
1515
jobs:
1616
build-run-image:
1717
strategy:
@@ -37,21 +37,27 @@ jobs:
3737
aws-region: "us-east-1"
3838
output-credentials: true
3939
role-duration-seconds: 7200
40+
- name: Setup AWS credentials for Nix
41+
if: ${{ github.secret_source == 'Actions' }}
42+
run: |
43+
sudo -H aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
44+
sudo -H aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
45+
sudo -H aws configure set aws_session_token $AWS_SESSION_TOKEN
4046
- name: write secret key
4147
# use python so we don't interpolate the secret into the workflow logs, in case of bugs
4248
run: |
43-
python -c "import os; file = open('nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
49+
sudo mkdir -p /etc/nix
50+
sudo -E python -c "import os; file = open('/etc/nix/nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
4451
env:
4552
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
4653
- name: Setup cache script
4754
if: ${{ github.secret_source == 'Actions' }}
4855
run: |
49-
sudo mkdir -p /etc/nix
5056
cat << 'EOF' | sudo tee /etc/nix/upload-to-cache.sh > /dev/null
5157
#!/usr/bin/env bash
5258
set -eouf
5359
export IFS=' '
54-
echo /nix/var/nix/profiles/default/bin/nix copy --to 's3://nix-postgres-artifacts?secret-key=nix-secret-key' \$OUT_PATHS
60+
/nix/var/nix/profiles/default/bin/nix copy --to 's3://nix-postgres-artifacts?secret-key=/etc/nix/nix-secret-key' $OUT_PATHS
5561
EOF
5662
sudo chmod +x /etc/nix/upload-to-cache.sh
5763
- name: Install nix

.github/workflows/publish-migrations-prod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
build:
8-
runs-on: [self-hosted, linux]
8+
runs-on: large-linux-arm
99
timeout-minutes: 15
1010
permissions:
1111
id-token: write

.github/workflows/publish-migrations-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: [self-hosted, linux]
11+
runs-on: large-linux-arm
1212
timeout-minutes: 15
1313
permissions:
1414
id-token: write

.github/workflows/publish-nix-pgupgrade-bin-flake-version.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212

1313
jobs:
1414
prepare:
15-
runs-on: ubuntu-latest
15+
runs-on: large-linux-x86
1616
outputs:
1717
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
1818
steps:
@@ -29,7 +29,7 @@ jobs:
2929
3030
publish-staging:
3131
needs: prepare
32-
runs-on: ubuntu-latest
32+
runs-on: large-linux-x86
3333
strategy:
3434
matrix:
3535
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
@@ -79,7 +79,7 @@ jobs:
7979
SLACK_FOOTER: ''
8080

8181
publish-prod:
82-
runs-on: ubuntu-latest
82+
runs-on: large-linux-x86
8383
if: github.ref_name == 'develop' || contains( github.ref, 'release' )
8484
needs: prepare
8585
strategy:
@@ -93,7 +93,7 @@ jobs:
9393
- name: Grab release version
9494
id: process_release_version
9595
run: |
96-
VERSION=$(sudo nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
96+
VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)
9797
VERSION=$(echo $VERSION | tr -d '"') # Remove any surrounding quotes
9898
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
9999
echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT"

.github/workflows/publish-nix-pgupgrade-scripts.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ permissions:
1919

2020
jobs:
2121
prepare:
22-
runs-on: ubuntu-latest
22+
runs-on: large-linux-x86
2323
outputs:
2424
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
2525
steps:
@@ -36,7 +36,7 @@ jobs:
3636
3737
publish-staging:
3838
needs: prepare
39-
runs-on: ubuntu-latest
39+
runs-on: large-linux-x86
4040
strategy:
4141
matrix:
4242
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
@@ -84,7 +84,7 @@ jobs:
8484
SLACK_FOOTER: ''
8585
publish-prod:
8686
needs: prepare
87-
runs-on: ubuntu-latest
87+
runs-on: large-linux-x86
8888
if: github.ref_name == 'develop' || contains( github.ref, 'release' )
8989

9090
strategy:

.github/workflows/qemu-image-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818

1919
jobs:
2020
prepare:
21-
runs-on: ubuntu-latest
21+
runs-on: large-linux-x86
2222
outputs:
2323
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
2424
steps:
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
matrix:
4040
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
41-
runs-on: arm-native-runner
41+
runs-on: large-linux-arm
4242
timeout-minutes: 150
4343
permissions:
4444
contents: write
@@ -54,7 +54,7 @@ jobs:
5454
- name: Run checks if triggered manually
5555
if: ${{ github.event_name == 'workflow_dispatch' }}
5656
run: |
57-
SUFFIX=$(sudo nix run nixpkgs#yq -- ".postgres_release[\"postgres${{ matrix.postgres_version }}\"]" ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/')
57+
SUFFIX=$(nix run nixpkgs#yq -- ".postgres_release[\"postgres${{ matrix.postgres_version }}\"]" ansible/vars.yml | sed -E 's/[0-9\.]+(.*)$/\1/')
5858
if [[ -z $SUFFIX ]] ; then
5959
echo "Version must include non-numeric characters if built manually."
6060
exit 1

.github/workflows/test.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: Test Database
22
on:
3-
push:
4-
branches:
5-
- develop
6-
pull_request:
3+
# Trigger this workflow when the "Nix CI" workflow completes
4+
workflow_run:
5+
workflows: ["Nix CI"]
6+
types:
7+
- completed
78
workflow_dispatch:
89

910
permissions:
@@ -12,17 +13,13 @@ permissions:
1213

1314
jobs:
1415
prepare:
15-
runs-on: ubuntu-latest
16+
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
17+
runs-on: large-linux-x86
1618
outputs:
1719
postgres_versions: ${{ steps.set-versions.outputs.postgres_versions }}
1820
steps:
1921
- name: Checkout Repo
2022
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
21-
22-
- name: Clear Nix cache
23-
run: |
24-
sudo rm -rf /home/runner/.cache/nix
25-
2623
- uses: DeterminateSystems/nix-installer-action@main
2724
with:
2825
extra-conf: |
@@ -34,14 +31,15 @@ jobs:
3431
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c "split(\"\n\")[:-1]")
3532
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
3633
build:
34+
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
3735
needs: prepare
3836
strategy:
3937
matrix:
4038
postgres_version: ${{ fromJson(needs.prepare.outputs.postgres_versions) }}
4139
include:
42-
- runner: ubuntu-22.04
40+
- runner: large-linux-x86
4341
arch: amd64
44-
- runner: ubuntu-22.04
42+
- runner: large-linux-arm
4543
arch: arm64
4644
runs-on: ${{ matrix.runner }}
4745
timeout-minutes: 180
@@ -51,9 +49,6 @@ jobs:
5149
steps:
5250
- name: Checkout Repo
5351
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
54-
- name: Clear Nix cache
55-
run: |
56-
sudo rm -rf /home/runner/.cache/nix
5752
- uses: DeterminateSystems/nix-installer-action@main
5853
with:
5954
extra-conf: |

0 commit comments

Comments
 (0)