diff --git a/.github/workflows/ami-release-nix.yml b/.github/workflows/ami-release-nix.yml index cef369afa..5f5796455 100644 --- a/.github/workflows/ami-release-nix.yml +++ b/.github/workflows/ami-release-nix.yml @@ -72,15 +72,7 @@ jobs: - name: Generate common-nix.vars.pkr.hcl run: | PG_VERSION="$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml)" - BRANCH_NAME="$(echo "${{ github.ref }}" | sed 's|refs/heads/||')" - if [[ "${{ github.event_name }}" == "workflow_dispatch" && "$BRANCH_NAME" != "develop" && "$BRANCH_NAME" != release/* ]]; then - SUFFIX="${BRANCH_NAME//[^a-zA-Z0-9._-]/-}-${{ github.run_id }}" - PG_VERSION="${PG_VERSION}-${SUFFIX}" - echo "Added branch suffix to version: $SUFFIX" - fi echo "postgres-version = \"$PG_VERSION\"" > common-nix.vars.pkr.hcl - # Ensure there's a newline at the end of the file - echo "" >> common-nix.vars.pkr.hcl - name: Build AMI stage 1 env: @@ -89,13 +81,13 @@ jobs: GIT_SHA=${{github.sha}} nix run github:supabase/postgres/${GIT_SHA}#packer -- init amazon-arm64-nix.pkr.hcl # why is postgresql_major defined here instead of where the _three_ other postgresql_* variables are defined? - 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-file="common-nix.vars.pkr.hcl" -var "ansible_arguments=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" 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-file="common-nix.vars.pkr.hcl" -var "ansible_arguments=-e postgresql_major=${POSTGRES_MAJOR_VERSION}" -var "region=us-east-1" -var 'ami_regions=["us-east-1"]' amazon-arm64-nix.pkr.hcl - name: Find stage 1 AMI run: | GIT_SHA=${{github.sha}} PG_VERSION=$(sed -n 's/postgres-version = "\(.*\)"/\1/p' common-nix.vars.pkr.hcl) - REGION=$(grep '^region=' development-arm.vars.pkr.hcl | cut -d'=' -f2 | tr -d ' "') + REGION="us-east-1" echo "Looking for stage 1 AMI with postgresVersion=${PG_VERSION}-stage1 and sourceSha=${GIT_SHA} in region ${REGION}" @@ -124,7 +116,7 @@ jobs: GIT_SHA=${{github.sha}} nix run github:supabase/postgres/${GIT_SHA}#packer -- init stage2-nix-psql.pkr.hcl POSTGRES_MAJOR_VERSION=${{ env.POSTGRES_MAJOR_VERSION }} - nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git_sha=${GIT_SHA}" -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var "source_ami=${STAGE1_AMI_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" stage2-nix-psql.pkr.hcl + nix run github:supabase/postgres/${GIT_SHA}#packer -- build -var "git_sha=${GIT_SHA}" -var "git-head-version=${GIT_SHA}" -var "packer-execution-id=${EXECUTION_ID}" -var "postgres_major_version=${POSTGRES_MAJOR_VERSION}" -var "source_ami=${STAGE1_AMI_ID}" -var-file="development-arm.vars.pkr.hcl" -var-file="common-nix.vars.pkr.hcl" -var "region=us-east-1" stage2-nix-psql.pkr.hcl - name: Grab release version id: process_release_version diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index 509893eb0..712513fba 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -14,6 +14,10 @@ permissions: contents: write packages: write +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: nix-eval: uses: ./.github/workflows/nix-eval.yml diff --git a/.github/workflows/publish-nix-pgupgrade-bin-flake-version.yml b/.github/workflows/publish-nix-pgupgrade-bin-flake-version.yml index 7a8a45e00..ee6737a42 100644 --- a/.github/workflows/publish-nix-pgupgrade-bin-flake-version.yml +++ b/.github/workflows/publish-nix-pgupgrade-bin-flake-version.yml @@ -24,12 +24,7 @@ jobs: - name: Set PostgreSQL versions id: set-versions run: | - if [[ "${{ inputs.postgresVersion }}" != "" ]]; then - MAJOR_VERSION=$(echo "${{ inputs.postgresVersion }}" | cut -d'.' -f1) - VERSIONS="[\"$MAJOR_VERSION\"]" - else - VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]') - fi + VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]') echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT publish-staging: @@ -48,11 +43,7 @@ jobs: - name: Grab release version id: process_release_version run: | - if [[ "${{ inputs.postgresVersion }}" != "" ]]; then - VERSION="${{ inputs.postgresVersion }}" - else - VERSION=$(nix run nixpkgs#yq -- '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) - fi + VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT" @@ -87,7 +78,7 @@ jobs: publish-prod: runs-on: large-linux-x86 - if: github.ref_name == 'develop' || contains( github.ref, 'release' ) + if: github.ref_name == 'develop' || startsWith(github.ref_name, 'release/') needs: prepare strategy: matrix: @@ -100,11 +91,7 @@ jobs: - name: Grab release version id: process_release_version run: | - if [[ "${{ inputs.postgresVersion }}" != "" ]]; then - VERSION="${{ inputs.postgresVersion }}" - else - VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) - fi + VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) echo "version=$VERSION" >> "$GITHUB_OUTPUT" echo "major_version=$(echo $VERSION | cut -d'.' -f1)" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/publish-nix-pgupgrade-scripts.yml b/.github/workflows/publish-nix-pgupgrade-scripts.yml index 98eb9015c..721250fd1 100644 --- a/.github/workflows/publish-nix-pgupgrade-scripts.yml +++ b/.github/workflows/publish-nix-pgupgrade-scripts.yml @@ -29,12 +29,7 @@ jobs: - name: Set PostgreSQL versions id: set-versions run: | - if [[ "${{ inputs.postgresVersion }}" != "" ]]; then - MAJOR_VERSION=$(echo "${{ inputs.postgresVersion }}" | cut -d'.' -f1) - VERSIONS="[\"$MAJOR_VERSION\"]" - else - VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]') - fi + VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]') echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT publish-staging: @@ -53,11 +48,7 @@ jobs: - name: Grab release version id: process_release_version run: | - if [[ "${{ inputs.postgresVersion }}" != "" ]]; then - VERSION="${{ inputs.postgresVersion }}" - else - VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) - fi + VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) echo "version=$VERSION" >> "$GITHUB_OUTPUT" - name: Create a tarball containing pg_upgrade scripts @@ -88,7 +79,7 @@ jobs: publish-prod: needs: prepare runs-on: large-linux-x86 - if: github.ref_name == 'develop' || contains( github.ref, 'release' ) + if: github.ref_name == 'develop' || startsWith(github.ref_name, 'release/') strategy: matrix: @@ -104,11 +95,7 @@ jobs: - name: Grab release version id: process_release_version run: | - if [[ "${{ inputs.postgresVersion }}" != "" ]]; then - VERSION="${{ inputs.postgresVersion }}" - else - VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) - fi + VERSION=$(nix run nixpkgs#yq -- -r '.postgres_release["postgres'${{ matrix.postgres_version }}'"]' ansible/vars.yml) echo "version=$VERSION" >> "$GITHUB_OUTPUT" - name: Create a tarball containing pg_upgrade scripts diff --git a/ansible/tasks/setup-supabase-internal.yml b/ansible/tasks/setup-supabase-internal.yml index d59062012..00007ecd6 100644 --- a/ansible/tasks/setup-supabase-internal.yml +++ b/ansible/tasks/setup-supabase-internal.yml @@ -33,9 +33,20 @@ ansible.builtin.command: cmd: aws configure set default.s3.use_dualstack_endpoint true +- name: download Vector package + ansible.builtin.get_url: + url: "{{ vector_x86_deb if platform == 'amd64' else vector_arm_deb }}" + dest: /tmp/vector.deb + timeout: 120 + become: true + retries: 3 + delay: 10 + register: vector_download + until: vector_download is success + - name: install Vector for logging apt: - deb: "{{ vector_x86_deb if platform == 'amd64' else vector_arm_deb }}" + deb: /tmp/vector.deb become: true - name: add Vector to postgres group diff --git a/ansible/vars.yml b/ansible/vars.yml index 84861b604..209fcde31 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -10,15 +10,15 @@ postgres_major: # Full version strings for each major version postgres_release: - postgresorioledb-17: "17.6.0.037-orioledb" - postgres17: "17.6.1.080" - postgres15: "15.14.1.080" + postgresorioledb-17: "17.6.0.038-orioledb" + postgres17: "17.6.1.081" + postgres15: "15.14.1.081" # Non Postgres Extensions pgbouncer_release: 1.25.1 pgbouncer_release_checksum: sha256:6e566ae92fe3ef7f6a1b9e26d6049f7d7ca39c40e29e7b38f6d5500ae15d8465 -# The checksum can be found under "Assets", in the GitHub release page for each version. +# The checksum can be found under "Assets", in the GitHub release page for each version. # The binaries used are: ubuntu-aarch64 and linux-static. # https://github.com/PostgREST/postgrest/releases postgrest_release: 14.1