fix: bind wait/healthcheck tasks to traefik_restart.changed
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 31s
Security Vulnerability Scan / Check for Dependency Changes (push) Successful in 27s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Successful in 13s
🚀 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 Docker Image (push) Successful in 11s
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Failing after 1m12s
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Successful in 31s
Security Vulnerability Scan / Check for Dependency Changes (push) Successful in 27s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Successful in 13s
🚀 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 Docker Image (push) Successful in 11s
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Failing after 1m12s
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
- fix-gitea-timeouts.yml: Add when conditions to wait_for and uri tasks - Wait for Traefik only if traefik_restart.changed - Wait for Gitea via Traefik only if traefik_restart or gitea_restart changed - fix-gitea-complete.yml: Same fixes as fix-gitea-timeouts.yml - Wait for Traefik only if traefik_restart.changed - Wait for Gitea and service discovery checks only if restart occurred - fix-gitea-traefik-connection.yml: Fix wait and test tasks - Register traefik_restart to track if restart happened - Wait for Traefik only if traefik_restart.changed - Test Gitea via Traefik only if traefik_restart.changed - Update message to reflect actual restart status - update-gitea-traefik-service.yml: Fix pause block - Register traefik_restart to track if restart happened - Wait for Traefik only if traefik_restart.changed This prevents unnecessary blocking when traefik_auto_restart=false and ensures wait/healthcheck tasks only run when a restart actually occurred.
This commit is contained in:
@@ -88,6 +88,7 @@
|
|||||||
timeout: 30
|
timeout: 30
|
||||||
delay: 2
|
delay: 2
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
when: traefik_restart.changed | default(false) | bool
|
||||||
|
|
||||||
- name: Wait for Gitea to be reachable via Traefik (with retries)
|
- name: Wait for Gitea to be reachable via Traefik (with retries)
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
@@ -102,6 +103,7 @@
|
|||||||
delay: 2
|
delay: 2
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
when: (traefik_restart.changed | default(false) | bool) or (gitea_restart.changed | default(false) | bool)
|
||||||
|
|
||||||
- name: Check if Gitea is in Traefik service discovery
|
- name: Check if Gitea is in Traefik service discovery
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
@@ -110,6 +112,7 @@
|
|||||||
register: traefik_gitea_service_check
|
register: traefik_gitea_service_check
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
when: (traefik_restart.changed | default(false) | bool) or (gitea_restart.changed | default(false) | bool)
|
||||||
|
|
||||||
- name: Final status check
|
- name: Final status check
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
|
|||||||
@@ -86,6 +86,7 @@
|
|||||||
timeout: 30
|
timeout: 30
|
||||||
delay: 2
|
delay: 2
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
when: traefik_restart.changed | default(false) | bool
|
||||||
|
|
||||||
- name: Wait for Gitea to be reachable via Traefik
|
- name: Wait for Gitea to be reachable via Traefik
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
@@ -100,6 +101,7 @@
|
|||||||
delay: 2
|
delay: 2
|
||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
when: (traefik_restart.changed | default(false) | bool) or (gitea_restart.changed | default(false) | bool)
|
||||||
|
|
||||||
- name: Check final Gitea container status
|
- name: Check final Gitea container status
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
|
|||||||
@@ -60,11 +60,13 @@
|
|||||||
when: >
|
when: >
|
||||||
traefik_gitea_test.rc != 0
|
traefik_gitea_test.rc != 0
|
||||||
and (traefik_auto_restart | default(false) | bool)
|
and (traefik_auto_restart | default(false) | bool)
|
||||||
|
register: traefik_restart
|
||||||
|
changed_when: traefik_restart.rc == 0
|
||||||
|
|
||||||
- name: Wait for Traefik to be ready
|
- name: Wait for Traefik to be ready
|
||||||
pause:
|
pause:
|
||||||
seconds: 10
|
seconds: 10
|
||||||
when: traefik_gitea_test.rc != 0
|
when: traefik_restart.changed | default(false) | bool
|
||||||
|
|
||||||
- name: Test Gitea via Traefik
|
- name: Test Gitea via Traefik
|
||||||
uri:
|
uri:
|
||||||
@@ -75,15 +77,18 @@
|
|||||||
timeout: 10
|
timeout: 10
|
||||||
register: final_test
|
register: final_test
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
when: traefik_restart.changed | default(false) | bool
|
||||||
|
|
||||||
- name: Display result
|
- name: Display result
|
||||||
debug:
|
debug:
|
||||||
msg: |
|
msg: |
|
||||||
Gitea-Traefik connection test:
|
Gitea-Traefik connection test:
|
||||||
- Direct connection: {{ 'OK' if traefik_gitea_test.rc == 0 else 'FAILED' }}
|
- Direct connection: {{ 'OK' if traefik_gitea_test.rc == 0 else 'FAILED' }}
|
||||||
- Via Traefik: {{ 'OK' if final_test.status == 200 else 'FAILED' }}
|
- Via Traefik: {{ 'OK' if (final_test.status | default(0) == 200) else 'FAILED' if (traefik_restart.changed | default(false) | bool) else 'SKIPPED (no restart)' }}
|
||||||
|
|
||||||
{% if traefik_gitea_test.rc != 0 %}
|
{% if traefik_restart.changed | default(false) | bool %}
|
||||||
Both services have been restarted to refresh connections.
|
Traefik has been restarted to refresh service discovery.
|
||||||
|
{% elif traefik_gitea_test.rc != 0 %}
|
||||||
|
Note: Traefik restart was skipped (traefik_auto_restart=false). Direct connection test failed.
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
@@ -51,10 +51,13 @@
|
|||||||
shell: |
|
shell: |
|
||||||
docker compose -f {{ traefik_stack_path }}/docker-compose.yml restart traefik
|
docker compose -f {{ traefik_stack_path }}/docker-compose.yml restart traefik
|
||||||
when: traefik_auto_restart | default(false) | bool
|
when: traefik_auto_restart | default(false) | bool
|
||||||
|
register: traefik_restart
|
||||||
|
changed_when: traefik_restart.rc == 0
|
||||||
|
|
||||||
- name: Wait for Traefik to be ready
|
- name: Wait for Traefik to be ready
|
||||||
pause:
|
pause:
|
||||||
seconds: 10
|
seconds: 10
|
||||||
|
when: traefik_restart.changed | default(false) | bool
|
||||||
|
|
||||||
- name: Test Gitea via Traefik
|
- name: Test Gitea via Traefik
|
||||||
uri:
|
uri:
|
||||||
|
|||||||
Reference in New Issue
Block a user