@@ -5,6 +5,11 @@ permissions:
55
66on :
77 workflow_call :
8+ inputs :
9+ retry_count :
10+ required : false
11+ type : number
12+ default : 0
813 secrets :
914 SSH_PRIVATE_KEY :
1015 required : true
@@ -61,16 +66,44 @@ jobs:
6166 ./public/ \
6267 ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_WORKDIR }}/
6368
64- - name : Notification Mattermost
65- if : failure()
69+ - name : Notification Mattermost - Retry en cours
70+ if : failure() && inputs.retry_count < 2
6671 uses : mattermost/action-mattermost-notify@master
6772 with :
6873 MATTERMOST_WEBHOOK_URL : ${{ secrets.ECEDI_MATTERMOST_WEBHOOK_URL }}
6974 TEXT : |
70- @ld @cp
7175 :warning: **Pipeline FAILED: Deploy**
7276 Repo: **${{ github.repository }}**
7377 Workflow: **${{ github.workflow }}** (job: **${{ github.job }}**)
78+ :repeat: **Start retry : ${{ inputs.retry_count + 1 }}/2**
79+
80+ - name : Trigger Retry on Failure
81+ if : failure() && inputs.retry_count < 2
82+ run : |
83+ NEXT_RETRY=$(( ${{ inputs.retry_count }} + 1 ))
84+ echo "Deployment failed. Triggering retry ${NEXT_RETRY}/2..."
85+ gh workflow run ecedi-deploy-wrapper.yml \
86+ --ref "${{ github.ref_name }}" \
87+ -f retry_count="${NEXT_RETRY}"
88+ env :
89+ GH_TOKEN : ${{ github.token }}
90+
91+ - name : Notification Mattermost - Final failure
92+ if : failure() && inputs.retry_count >= 2
93+ uses : mattermost/action-mattermost-notify@master
94+ with :
95+ MATTERMOST_WEBHOOK_URL : ${{ secrets.ECEDI_MATTERMOST_WEBHOOK_URL }}
96+ TEXT : |
97+ @ld @cp
98+ :x: **Pipeline FAILED: Deploy**
99+ Repo: **${{ github.repository }}**
100+ Workflow: **${{ github.workflow }}** (job: **${{ github.job }}**)
74101 Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
102+ :no_entry: **All retry failed. No more retries will be triggered.**
75103
76- :repeat: **Un nouveau lancement du workflow va être déclenché automatiquement.**
104+ - name : Stop retries
105+ if : failure() && inputs.retry_count >= 2
106+ run : |
107+ echo "Deployment failed after maximum retries (${{
108+ inputs.retry_count
109+ }}). No more retries will be triggered."
0 commit comments