Skip to content

Commit eaac850

Browse files
committed
fix: Force cancel previous runs
1 parent 61a9d73 commit eaac850

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

.github/workflows/deploy-and-e2e.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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 }})'
33
on:
44
repository_dispatch:
55
types: [run_e2e]
@@ -48,9 +48,34 @@ concurrency:
4848
cancel-in-progress: true
4949

5050
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
5176
debug:
5277
name: Debug output
53-
runs-on: ubuntu-22.04
78+
runs-on: ubuntu-24.04
5479
outputs:
5580
runtime: ${{ steps.runtime.outputs.runtime }}
5681
domain: ${{ steps.runtime.outputs.domain }}
@@ -124,7 +149,7 @@ jobs:
124149
command: npx playwright install --with-deps
125150

126151
deploy-docker:
127-
needs: debug
152+
needs: [debug, cancel-in-progress-runs]
128153
if: needs.debug.outputs.runtime == 'docker'
129154
uses: ./.github/workflows/deploy.yml
130155
with:
@@ -225,6 +250,12 @@ jobs:
225250
export NODE_EXTRA_CA_CERTS=/tmp/letsencrypt-stg-root-x1.pem
226251
curl -s -o $NODE_EXTRA_CA_CERTS https://letsencrypt.org/certs/staging/letsencrypt-stg-root-x1.pem
227252
npx playwright test --shard=${{ matrix.shard }}/20
253+
PW_PID=$!
254+
while kill -0 $PW_PID 2>/dev/null; do
255+
sleep 10
256+
done
257+
258+
wait $PW_PID
228259
env:
229260
DOMAIN: '${{ needs.debug.outputs.domain }}'
230261
- id: ctrf_check

0 commit comments

Comments
 (0)