From b7eb327d42a867d18b93c528dd6e057e3665e8d3 Mon Sep 17 00:00:00 2001 From: Div Arora Date: Tue, 13 Aug 2024 20:15:48 +0800 Subject: [PATCH] chore: remove old workflows that are no longer used --- .github/workflows/ami-release.yml | 158 ------------------ .../workflows/publish-pgupgrade-scripts.yml | 100 ----------- .github/workflows/testinfra.yml | 146 ---------------- 3 files changed, 404 deletions(-) delete mode 100644 .github/workflows/ami-release.yml delete mode 100644 .github/workflows/publish-pgupgrade-scripts.yml delete mode 100644 .github/workflows/testinfra.yml diff --git a/.github/workflows/ami-release.yml b/.github/workflows/ami-release.yml deleted file mode 100644 index e7cc4c48f..000000000 --- a/.github/workflows/ami-release.yml +++ /dev/null @@ -1,158 +0,0 @@ -name: Release AMI - -on: - push: - branches: - - develop - paths: - - '.github/workflows/ami-release.yml' - - 'common.vars.pkr.hcl' - workflow_dispatch: - -jobs: - build: - strategy: - matrix: - include: - - runner: arm-runner - arch: arm64 - ubuntu_release: focal - ubuntu_version: 20.04 - mcpu: neoverse-n1 - runs-on: ${{ matrix.runner }} - timeout-minutes: 150 - permissions: - contents: write - packages: write - id-token: write - - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - - name: Run checks if triggered manually - if: ${{ github.event_name == 'workflow_dispatch' }} - # Update `ci.yaml` too if changing constraints. - run: | - SUFFIX=$(sed -E 's/postgres-version = "[0-9\.]+(.*)"/\1/g' common.vars.pkr.hcl) - if [[ -z $SUFFIX ]] ; then - echo "Version must include non-numeric characters if built manually." - exit 1 - fi - - - id: args - uses: mikefarah/yq@master - with: - cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml' - - run: docker context create builders - - uses: docker/setup-buildx-action@v3 - with: - endpoint: builders - - uses: docker/build-push-action@v5 - with: - build-args: | - ${{ steps.args.outputs.result }} - target: extensions - tags: supabase/postgres:extensions - platforms: linux/${{ matrix.arch }} - outputs: type=tar,dest=/tmp/extensions.tar - cache-from: type=gha,scope=${{ github.ref_name }}-latest-${{ matrix.arch }} - # No need to export extensions cache because latest depends on it - - name: Extract built packages - run: | - mkdir -p ansible/files/extensions - tar xvf /tmp/extensions.tar -C ansible/files/extensions --strip-components 1 - - - id: version - run: echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT" - - name: Build Postgres deb - uses: docker/build-push-action@v5 - with: - file: docker/Dockerfile - target: pg-deb - build-args: | - ubuntu_release=${{ matrix.ubuntu_release }} - ubuntu_release_no=${{ matrix.ubuntu_version }} - postgresql_major=${{ steps.version.outputs.postgresql_major }} - postgresql_release=${{ steps.version.outputs.postgresql_release }} - CPPFLAGS=-mcpu=${{ matrix.mcpu }} - CFLAGS=-g3 - tags: supabase/postgres:deb - platforms: linux/${{ matrix.arch }} - outputs: type=tar,dest=/tmp/pg-deb.tar - cache-from: type=gha,scope=${{ github.ref_name }}-deb - cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-deb - - name: Extract Postgres deb - run: | - mkdir -p ansible/files/postgres - tar xvf /tmp/pg-deb.tar -C ansible/files/postgres --strip-components 1 - - - name: Build AMI - run: | - packer init amazon-arm64.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.vars.pkr.hcl" -var "ansible_arguments=" amazon-arm64.pkr.hcl - - - name: Grab release version - id: process_release_version - run: | - VERSION=$(sed -e 's/postgres-version = "\(.*\)"/\1/g' common.vars.pkr.hcl) - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: configure aws credentials - staging - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: ${{ secrets.DEV_AWS_ROLE }} - aws-region: "us-east-1" - - - name: Upload software manifest to s3 staging - run: | - cd ansible - ansible-playbook -i localhost \ - -e "ami_release_version=${{ steps.process_release_version.outputs.version }}" \ - -e "internal_artifacts_bucket=${{ secrets.ARTIFACTS_BUCKET }}" \ - manifest-playbook.yml - - - name: Upload pg binaries to s3 staging - run: | - aws s3 cp /tmp/pg_binaries.tar.gz s3://${{ secrets.ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/20.04.tar.gz - - - name: configure aws credentials - prod - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: ${{ secrets.PROD_AWS_ROLE }} - aws-region: "us-east-1" - - - name: Upload software manifest to s3 prod - run: | - cd ansible - ansible-playbook -i localhost \ - -e "ami_release_version=${{ steps.process_release_version.outputs.version }}" \ - -e "internal_artifacts_bucket=${{ secrets.PROD_ARTIFACTS_BUCKET }}" \ - manifest-playbook.yml - - - name: Upload pg binaries to s3 prod - run: | - aws s3 cp /tmp/pg_binaries.tar.gz s3://${{ secrets.PROD_ARTIFACTS_BUCKET }}/upgrades/postgres/supabase-postgres-${{ steps.process_release_version.outputs.version }}/20.04.tar.gz - - - name: Create release - uses: softprops/action-gh-release@v1 - with: - name: ${{ steps.process_release_version.outputs.version }} - tag_name: ${{ steps.process_release_version.outputs.version }} - target_commitish: ${{github.sha}} - - - name: Slack Notification on Failure - if: ${{ failure() }} - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }} - SLACK_USERNAME: 'gha-failures-notifier' - SLACK_COLOR: 'danger' - SLACK_MESSAGE: 'Building Postgres AMI failed' - SLACK_FOOTER: '' - - - name: Cleanup resources on build cancellation - if: ${{ cancelled() }} - 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 {} diff --git a/.github/workflows/publish-pgupgrade-scripts.yml b/.github/workflows/publish-pgupgrade-scripts.yml deleted file mode 100644 index 838c32a94..000000000 --- a/.github/workflows/publish-pgupgrade-scripts.yml +++ /dev/null @@ -1,100 +0,0 @@ -name: Publish pg_upgrade_scripts - -on: - push: - branches: - - develop - paths: - - '.github/workflows/publish-pgupgrade-scripts.yml' - - 'common.vars.pkr.hcl' - workflow_dispatch: - inputs: - postgresVersion: - description: 'Optional. Postgres version to publish against, i.e. 15.1.1.78' - required: false - -permissions: - id-token: write - -jobs: - publish-staging: - runs-on: ubuntu-latest - - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - - name: Grab release version - id: process_release_version - run: | - VERSION=$(grep 'postgres-version' common.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g') - if [[ "${{ inputs.postgresVersion }}" != "" ]]; then - VERSION=${{ inputs.postgresVersion }} - fi - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: Create a tarball containing pg_upgrade scripts - 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 - - - name: configure aws credentials - staging - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: ${{ secrets.DEV_AWS_ROLE }} - aws-region: "us-east-1" - - - 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 - - - name: Slack Notification on Failure - if: ${{ failure() }} - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }} - SLACK_USERNAME: 'gha-failures-notifier' - SLACK_COLOR: 'danger' - SLACK_MESSAGE: 'Publishing pg_upgrade scripts failed' - SLACK_FOOTER: '' - - publish-prod: - runs-on: ubuntu-latest - if: github.ref_name == 'develop' - - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - - - name: Grab release version - id: process_release_version - run: | - VERSION=$(grep 'postgres-version' common.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g') - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - - name: Create a tarball containing pg_upgrade scripts - 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 - - - name: configure aws credentials - prod - uses: aws-actions/configure-aws-credentials@v1 - with: - role-to-assume: ${{ secrets.PROD_AWS_ROLE }} - aws-region: "us-east-1" - - - 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 - - - name: Slack Notification on Failure - if: ${{ failure() }} - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFICATIONS_WEBHOOK }} - SLACK_USERNAME: 'gha-failures-notifier' - SLACK_COLOR: 'danger' - SLACK_MESSAGE: 'Publishing pg_upgrade scripts failed' - SLACK_FOOTER: '' diff --git a/.github/workflows/testinfra.yml b/.github/workflows/testinfra.yml deleted file mode 100644 index 1b022eff2..000000000 --- a/.github/workflows/testinfra.yml +++ /dev/null @@ -1,146 +0,0 @@ -name: Testinfra Integration Tests - -on: - pull_request: - workflow_dispatch: - -jobs: - test-all-in-one: - strategy: - matrix: - include: - - runner: [self-hosted, X64] - arch: amd64 - - runner: arm-runner - arch: arm64 - runs-on: ${{ matrix.runner }} - timeout-minutes: 30 - steps: - - uses: actions/checkout@v3 - - - run: docker context create builders - - uses: docker/setup-buildx-action@v3 - with: - endpoint: builders - - - name: Run aio integration tests - run: | - # TODO: use poetry for pkg mgmt - pip3 install boto3 boto3-stubs[essential] docker ec2instanceconnectcli pytest pytest-testinfra[paramiko,docker] requests - - - if ! pytest -vv testinfra/test_all_in_one.py; then - # display container logs if the test fails - - if [ -f testinfra-aio-container-logs.log ]; then - echo "AIO container logs:" - cat testinfra-aio-container-logs.log - fi - exit 1 - fi - - test-ami: - strategy: - matrix: - include: - - runner: arm-runner - arch: arm64 - ubuntu_release: focal - ubuntu_version: 20.04 - mcpu: neoverse-n1 - runs-on: ${{ matrix.runner }} - timeout-minutes: 150 - permissions: - contents: write - packages: write - id-token: write - - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - - id: args - uses: mikefarah/yq@master - with: - cmd: yq 'to_entries | map(select(.value|type == "!!str")) | map(.key + "=" + .value) | join("\n")' 'ansible/vars.yml' - - - run: docker context create builders - - - uses: docker/setup-buildx-action@v3 - with: - endpoint: builders - - - uses: docker/build-push-action@v5 - with: - build-args: | - ${{ steps.args.outputs.result }} - target: extensions - tags: supabase/postgres:extensions - platforms: linux/${{ matrix.arch }} - outputs: type=tar,dest=/tmp/extensions.tar - cache-from: | - type=gha,scope=${{ github.ref_name }}-extensions - type=gha,scope=${{ github.base_ref }}-extensions - type=gha,scope=develop-extensions - cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-extensions - - - name: Extract built packages - run: | - mkdir -p ansible/files/extensions - tar xvf /tmp/extensions.tar -C ansible/files/extensions --strip-components 1 - - - id: version - run: echo "${{ steps.args.outputs.result }}" | grep "postgresql" >> "$GITHUB_OUTPUT" - - - name: Build Postgres deb - uses: docker/build-push-action@v5 - with: - file: docker/Dockerfile - target: pg-deb - build-args: | - ubuntu_release=${{ matrix.ubuntu_release }} - ubuntu_release_no=${{ matrix.ubuntu_version }} - postgresql_major=${{ steps.version.outputs.postgresql_major }} - postgresql_release=${{ steps.version.outputs.postgresql_release }} - CPPFLAGS=-mcpu=${{ matrix.mcpu }} - CFLAGS=-g3 - tags: supabase/postgres:deb - platforms: linux/${{ matrix.arch }} - outputs: type=tar,dest=/tmp/pg-deb.tar - cache-from: | - type=gha,scope=${{ github.ref_name }}-deb - type=gha,scope=${{ github.base_ref }}-deb - type=gha,scope=develop-deb - cache-to: type=gha,mode=max,scope=${{ github.ref_name }}-deb - - - name: Extract Postgres deb - run: | - mkdir -p ansible/files/postgres - tar xvf /tmp/pg-deb.tar -C ansible/files/postgres --strip-components 1 - - # Packer doesn't support skipping registering the AMI for the ebssurrogate - # builder, so we register an AMI with a fixed name and run tests on an - # instance launched from that - # https://github.com/hashicorp/packer/issues/4899 - - name: Build AMI - run: | - packer init amazon-arm64.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.vars.pkr.hcl" -var "ansible_arguments=" -var "postgres-version=ci-ami-test" -var "region=ap-southeast-1" -var 'ami_regions=["ap-southeast-1"]' -var "force-deregister=true" amazon-arm64.pkr.hcl - - - name: Run tests - timeout-minutes: 10 - run: | - # TODO: use poetry for pkg mgmt - pip3 install boto3 boto3-stubs[essential] docker ec2instanceconnectcli pytest pytest-testinfra[paramiko,docker] requests - pytest -vv -s testinfra/test_ami.py - - - name: Cleanup resources on build cancellation - if: ${{ cancelled() }} - run: | - aws ec2 --region ap-southeast-1 describe-instances --filters "Name=tag:packerExecutionId,Values=${GITHUB_RUN_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -n 1 -I {} aws ec2 terminate-instances --region ap-southeast-1 --instance-ids {} - - - name: Cleanup resources on build cancellation - if: ${{ always() }} - run: | - aws ec2 --region ap-southeast-1 describe-instances --filters "Name=tag:testinfra-run-id,Values=${GITHUB_RUN_ID}" --query "Reservations[].Instances[].InstanceId" --output text | xargs -n 1 -I {} aws ec2 terminate-instances --region ap-southeast-1 --instance-ids {} || true