@@ -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
@@ -55,18 +60,50 @@ jobs:
5560 known_hosts : ' just-a-placeholder-so-we-dont-get-errors'
5661
5762 - name : Deploy with rsync (with retry)
58- run : rsync -avz --delete -e "ssh -p 22" ./public/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_WORKDIR }}/
63+ run : |
64+ rsync -avz --delete \
65+ -e "ssh -p 22 -o StrictHostKeyChecking=no" \
66+ ./public/ \
67+ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_WORKDIR }}/
5968
60- - name : Notification Mattermost
61- if : failure()
69+ - name : Notification Mattermost - Retry en cours
70+ if : failure() && inputs.retry_count < 2
6271 uses : mattermost/action-mattermost-notify@master
6372 with :
6473 MATTERMOST_WEBHOOK_URL : ${{ secrets.ECEDI_MATTERMOST_WEBHOOK_URL }}
6574 TEXT : |
66- @ld @cp
6775 :warning: **Pipeline FAILED: Deploy**
6876 Repo: **${{ github.repository }}**
6977 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 }}**)
70101 Logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
102+ :no_entry: **All retry failed. No more retries will be triggered.**
71103
72- :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