From 398cbff04adea2f893b47c307ee53edf68c3062b Mon Sep 17 00:00:00 2001 From: John Watson Date: Wed, 23 Oct 2024 09:28:26 +0100 Subject: [PATCH] fix: amend deployment of prod --- .github/workflows/deploy-after-wait.yml | 57 ------------------------- .github/workflows/deploy-stack.yml | 22 +++++++++- .github/workflows/prod-deploy-cron.yml | 2 +- 3 files changed, 22 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/deploy-after-wait.yml diff --git a/.github/workflows/deploy-after-wait.yml b/.github/workflows/deploy-after-wait.yml deleted file mode 100644 index b5b180679a..0000000000 --- a/.github/workflows/deploy-after-wait.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: deploy-after-wait - -on: - workflow_dispatch: - inputs: - environment: - type: choice - required: true - description: "Where to deploy to" - default: "tools" - options: - - tools - - production - wait_duration: - type: string - required: true - description: "How long to wait before deploying" - default: "300" # 5 minutes - workflow_call: - inputs: - environment: - type: string - required: true - description: "Where to deploy to" - wait_duration: - type: string - required: false - description: "How long to wait before deploying" - default: "300" # 5 minutes - -jobs: - wait: - name: wait - runs-on: ubuntu-latest - steps: - - name: wait - run: | - echo "Sleeping for ${{ inputs.wait_duration }}" - sleep ${{ inputs.wait_duration }} - - deploy: - uses: ./.github/workflows/deploy-stack.yml - needs: wait - with: - environment: ${{ inputs.environment }} - version: stable - secrets: inherit - - on-failure: - runs-on: ubuntu-latest - needs: deploy - if: failure() - steps: - - run: | - curl -X POST \ - -H 'Content-type: application/json' \ - --data "{\"text\": \":si: Deployment to ${{ inputs.environment }} failed: \"}" ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/deploy-stack.yml b/.github/workflows/deploy-stack.yml index 960d2bc053..030fcfea41 100644 --- a/.github/workflows/deploy-stack.yml +++ b/.github/workflows/deploy-stack.yml @@ -11,6 +11,9 @@ on: version: type: string default: "stable" + wait_duration: + type: number + default: 0 workflow_dispatch: inputs: @@ -27,6 +30,11 @@ on: required: true description: "version to deploy" default: "stable" + wait_duration: + type: number + required: false + description: "How long to wait before deploying" + default: 0 # We only one one deploy happening at a time per environment, so if one is # in progress, we'll wait for it to finish before starting the @@ -37,6 +45,16 @@ concurrency: cancel-in-progress: false jobs: + + wait: + name: wait + runs-on: ubuntu-latest + steps: + - name: wait + run: | + echo "Sleeping for ${{ inputs.wait_duration }}" + sleep ${{ inputs.wait_duration }} + invoke-and-check-cdn: uses: ./.github/workflows/invoke-and-check-invalidations.yml with: @@ -45,6 +63,8 @@ jobs: set-service-versions: uses: ./.github/workflows/set-service-version.yml + needs: + - invoke-and-check-cdn strategy: fail-fast: false matrix: @@ -57,8 +77,8 @@ jobs: set-maintenance-mode: needs: - - invoke-and-check-cdn - set-service-versions + - wait uses: ./.github/workflows/set-maintenance-mode.yml with: environment: ${{ inputs.environment }} diff --git a/.github/workflows/prod-deploy-cron.yml b/.github/workflows/prod-deploy-cron.yml index c7a708355a..4068887b5e 100644 --- a/.github/workflows/prod-deploy-cron.yml +++ b/.github/workflows/prod-deploy-cron.yml @@ -10,7 +10,7 @@ concurrency: jobs: deploy-production: - uses: ./.github/workflows/deploy-after-wait.yml + uses: ./.github/workflows/deploy-stack.yml with: environment: production wait_duration: 900