|
1 | 1 | name: Deploy & run E2E |
2 | | -run-name: 'E2E by ${{ github.event.client_payload.actor || github.actor }} to ${{ github.event.client_payload.stack || github.event.inputs.stack }} (core: ${{ github.event.client_payload.core-image-tag || inputs.core-image-tag }}, farajaland: ${{ github.event.client_payload.countryconfig-image-tag || inputs.countryconfig-image-tag }}) ${{ github.event.client_payload.runtime || inputs.runtime }}' |
| 2 | +run-name: 'E2E by ${{ github.event.client_payload.actor || github.actor }} to ${{ github.event.client_payload.stack || github.event.inputs.stack }} (core: ${{ github.event.client_payload.core-image-tag || inputs.core-image-tag }}, farajaland: ${{ github.event.client_payload.countryconfig-image-tag || inputs.countryconfig-image-tag }})' |
3 | 3 | on: |
4 | 4 | repository_dispatch: |
5 | 5 | types: [run_e2e] |
|
43 | 43 | required: false |
44 | 44 | default: false |
45 | 45 | type: boolean |
46 | | -concurrency: |
47 | | - group: ${{ github.event.client_payload.stack || inputs.stack }} |
48 | | - cancel-in-progress: true |
| 46 | +# concurrency: |
| 47 | +# group: ${{ github.event.client_payload.stack || inputs.stack }} |
| 48 | +# cancel-in-progress: true |
49 | 49 |
|
50 | 50 | jobs: |
| 51 | + cancel-in-progress-runs: |
| 52 | + name: Cancel in-progress runs |
| 53 | + runs-on: ubuntu-24.04 |
| 54 | + steps: |
| 55 | + - name: Cancel in-progress runs |
| 56 | + env: |
| 57 | + GH_TOKEN: ${{ github.token }} |
| 58 | + STACK_NAME: ${{ github.event.client_payload.stack || inputs.stack }} |
| 59 | + CURRENT_RUN_ID: ${{ github.run_id }} |
| 60 | + run: | |
| 61 | + # FIXME: Replace with ${{ github.workflow_id }} |
| 62 | + gh api "/repos/${{ github.repository }}/actions/workflows/116693890/runs?status=in_progress&status=queued" \ |
| 63 | + --jq '.workflow_runs[] | select(.id != '$CURRENT_RUN_ID') | .id' > /tmp/run_ids.txt |
| 64 | + cat /tmp/run_ids.txt |
| 65 | + while read -r run_id; do |
| 66 | + RUN_NAME=$(gh api "/repos/${{ github.repository }}/actions/runs/$run_id" --jq '.name') |
| 67 | + [[ "$RUN_NAME" != *"to $STACK_NAME"* ]] && echo "Skip $RUN_NAME" && continue |
| 68 | + echo "Cancelling run: $run_id" |
| 69 | + gh api --method POST "/repos/${{ github.repository }}/actions/runs/$run_id/cancel" |
| 70 | + gh api \ |
| 71 | + --method POST \ |
| 72 | + /repos/opencrvs/e2e/actions/runs/${run_id}/force-cancel |
| 73 | + echo |
| 74 | + echo "Workflow $RUN_NAME cancelled: https://github.com/opencrvs/e2e/actions/runs/${run_id}" |
| 75 | + done < /tmp/run_ids.txt |
51 | 76 | debug: |
52 | 77 | name: Debug output |
53 | | - runs-on: ubuntu-22.04 |
| 78 | + runs-on: ubuntu-24.04 |
54 | 79 | outputs: |
55 | 80 | runtime: ${{ steps.runtime.outputs.runtime }} |
56 | 81 | domain: ${{ steps.runtime.outputs.domain }} |
@@ -124,7 +149,7 @@ jobs: |
124 | 149 | command: npx playwright install --with-deps |
125 | 150 |
|
126 | 151 | deploy-docker: |
127 | | - needs: debug |
| 152 | + needs: [debug, cancel-in-progress-runs] |
128 | 153 | if: needs.debug.outputs.runtime == 'docker' |
129 | 154 | uses: ./.github/workflows/deploy.yml |
130 | 155 | with: |
|
0 commit comments