Handle no running containers during zuul graceful stop
The way the currently graceful stop tasks are written for zuul expects there to always be a running zuul container to exec into. There are situations where there may not be a running container in which case there is nothing to stop. Avoid this being an error by checking if the containers are running before execing into them. If no containers are running then we'll noop the docker exec step allowing the rest of the ansible tasks to continue. Change-Id: I6c47147a589ae12cc33e37e40e49673396d120f7
This commit is contained in:
parent
0c59eff0e8
commit
d71b3a798d
@ -1,9 +1,19 @@
|
||||
- name: Check if Zuul Executor containers are running
|
||||
# It is possible they are stopped due to some external circumstance
|
||||
command:
|
||||
cmd: docker-compose ps -q
|
||||
chdir: /etc/zuul-executor
|
||||
become: true
|
||||
become_user: root
|
||||
register: executor_container_list
|
||||
- name: Gracefully stop Zuul Executor
|
||||
shell:
|
||||
cmd: docker-compose exec executor zuul-executor graceful
|
||||
chdir: /etc/zuul-executor
|
||||
become: true
|
||||
become_user: root
|
||||
# Only run the docker exec command if a container is running
|
||||
when: executor_container_list.stdout_lines | length > 0
|
||||
- name: Wait for Zuul Executor to stop
|
||||
shell:
|
||||
cmd: docker-compose ps -q | xargs docker wait
|
||||
|
@ -1,9 +1,19 @@
|
||||
- name: Check if Zuul merger containers are running
|
||||
# It is possible they are stopped due to some external circumstance
|
||||
command:
|
||||
cmd: docker-compose ps -q
|
||||
chdir: /etc/zuul-merger
|
||||
become: true
|
||||
become_user: root
|
||||
register: merger_container_list
|
||||
- name: Gracefully stop Zuul Merger
|
||||
shell:
|
||||
cmd: docker-compose exec merger zuul-merger stop
|
||||
chdir: /etc/zuul-merger
|
||||
become: true
|
||||
become_user: root
|
||||
# Only run the docker exec command if a container is running
|
||||
when: merger_container_list.stdout_lines | length > 0
|
||||
- name: Wait for Zuul Merger to stop
|
||||
shell:
|
||||
cmd: docker-compose ps -q | xargs docker wait
|
||||
|
Loading…
x
Reference in New Issue
Block a user