From 4bc662b6ff8073d5a07056bfdc43000831729ea2 Mon Sep 17 00:00:00 2001 From: Alan Moran Date: Fri, 30 Aug 2024 10:47:35 +0200 Subject: [PATCH] WIP --- .github/workflows/acceptance_tests_mta.yaml | 18 +++++++++ .../workflows/acceptance_tests_mta_close.yaml | 37 +++++++++++++++++++ .../workflows/acceptance_tests_reusable.yaml | 9 +++++ 3 files changed, 64 insertions(+) create mode 100644 .github/workflows/acceptance_tests_mta.yaml create mode 100644 .github/workflows/acceptance_tests_mta_close.yaml diff --git a/.github/workflows/acceptance_tests_mta.yaml b/.github/workflows/acceptance_tests_mta.yaml new file mode 100644 index 0000000000..addede9765 --- /dev/null +++ b/.github/workflows/acceptance_tests_mta.yaml @@ -0,0 +1,18 @@ +name: Acceptance Tests - Broker +on: + pull_request: + types: [ opened, labeled, synchronize ] + +concurrency: + group: "${{ github.workflow }}/${{ github.ref }}" + cancel-in-progress: true + +jobs: + acceptance_tests_reusable: + name: " " # Whitespace name looks nicest on Github UI + uses: ./.github/workflows/acceptance_tests_reusable.yaml + with: + deployment_name: "autoscaler-mta-${{ github.event.pull_request.number }}" + deploy_apps: "true" + secrets: + bbl_ssh_key: "${{ secrets.BBL_SSH_KEY }}" diff --git a/.github/workflows/acceptance_tests_mta_close.yaml b/.github/workflows/acceptance_tests_mta_close.yaml new file mode 100644 index 0000000000..f68ea416eb --- /dev/null +++ b/.github/workflows/acceptance_tests_mta_close.yaml @@ -0,0 +1,37 @@ +name: Acceptance Tests Cleanup (Broker) +on: + pull_request: + types: [closed] +env: + PR_NUMBER: "${{ github.event.pull_request.number }}" + DEPLOYMENT_NAME: "autoscaler-mta-${{ github.event.pull_request.number }}" + +jobs: + deployment_cleanup: + name: Cleanup deployments + runs-on: ubuntu-latest + container: + image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main + steps: + - uses: actions/checkout@v4 + with: + path: app-autoscaler-release + ref: main + + - uses: ./app-autoscaler-release/.github/actions/setup-environment + with: + ssh-key: ${{ secrets.BBL_SSH_KEY }} + + - name: "clean up" + shell: bash + run: | + #! /usr/bin/env bash + set -eu -o pipefail + + # The subsequent assignments are needed *HERE* because of: + # or + # + export BBL_STATE_PATH="${GITHUB_WORKSPACE}/bbl/bbl-state" + declare -r AUTOSCALER_DIR="${GITHUB_WORKSPACE}/app-autoscaler-release" + + make --directory="${AUTOSCALER_DIR}" deploy-cleanup diff --git a/.github/workflows/acceptance_tests_reusable.yaml b/.github/workflows/acceptance_tests_reusable.yaml index cbf1e0fa3a..df7d2e6602 100644 --- a/.github/workflows/acceptance_tests_reusable.yaml +++ b/.github/workflows/acceptance_tests_reusable.yaml @@ -12,6 +12,9 @@ on: deployment_name: required: true type: string + deploy_apps: + required: false + type: boolean secrets: bbl_ssh_key: required: true @@ -80,6 +83,12 @@ jobs: - name: Deploy autoscaler shell: bash run: make --directory="${AUTOSCALER_DIR}" deploy-autoscaler + - name: Deploy Apps + shell: bash + run: make --directory="${AUTOSCALER_DIR}" deploy-apps + if: ${{ inputs.deploy_apps }} + + acceptance_tests: needs: [ deploy_autoscaler ]