fix: Add retry logic to git operations in deploy-application-code.yml
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 30s
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 37s
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
Security Vulnerability Scan / Composer Security Audit (push) Has been skipped
🚀 Build & Deploy Image / Build Runtime Base Image (push) Failing after 13m31s
🚀 Build & Deploy Image / Build Docker Image (push) Has been cancelled
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been cancelled
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been cancelled
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 30s
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 37s
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
Security Vulnerability Scan / Composer Security Audit (push) Has been skipped
🚀 Build & Deploy Image / Build Runtime Base Image (push) Failing after 13m31s
🚀 Build & Deploy Image / Build Docker Image (push) Has been cancelled
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been cancelled
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been cancelled
- Add retry logic (5 retries, 10s delay) to git clone and update tasks - Handle 504 Gateway Timeout errors from Gitea gracefully - Fail with clear error message if all retries are exhausted - Prevents workflow failures due to temporary Gitea unavailability
This commit is contained in:
@@ -68,6 +68,18 @@
|
|||||||
GIT_TERMINAL_PROMPT: "0"
|
GIT_TERMINAL_PROMPT: "0"
|
||||||
vars:
|
vars:
|
||||||
ansible_become: no
|
ansible_become: no
|
||||||
|
register: git_clone_result
|
||||||
|
retries: 5
|
||||||
|
delay: 10
|
||||||
|
until: git_clone_result is succeeded
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Fail if git clone failed after retries
|
||||||
|
fail:
|
||||||
|
msg: "Failed to clone repository after 5 retries. Gitea may be unreachable or overloaded. Last error: {{ git_clone_result.msg | default('Unknown error') }}"
|
||||||
|
when:
|
||||||
|
- not git_repo_exists.stat.exists
|
||||||
|
- git_clone_result is failed
|
||||||
|
|
||||||
- name: Update repository (if exists)
|
- name: Update repository (if exists)
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
@@ -81,6 +93,18 @@
|
|||||||
GIT_TERMINAL_PROMPT: "0"
|
GIT_TERMINAL_PROMPT: "0"
|
||||||
vars:
|
vars:
|
||||||
ansible_become: no
|
ansible_become: no
|
||||||
|
register: git_update_result
|
||||||
|
retries: 5
|
||||||
|
delay: 10
|
||||||
|
until: git_update_result is succeeded
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Fail if git update failed after retries
|
||||||
|
fail:
|
||||||
|
msg: "Failed to update repository after 5 retries. Gitea may be unreachable or overloaded. Last error: {{ git_update_result.msg | default('Unknown error') }}"
|
||||||
|
when:
|
||||||
|
- git_repo_exists.stat.exists
|
||||||
|
- git_update_result is failed
|
||||||
|
|
||||||
- name: Set ownership of repository files
|
- name: Set ownership of repository files
|
||||||
file:
|
file:
|
||||||
|
|||||||
Reference in New Issue
Block a user