Add timeout for containers logs collection

When containers logs collection is stuck we lose all logs without
possibility to see the failure reasons. Set timeout for logs
collection of containers, by default 30 min.

Change-Id: I9082e9361f650a6bd9d1ddfe73963a696b849f39
This commit is contained in:
Sagi Shnaidman
2020-04-05 17:31:41 +03:00
parent c0c53b1634
commit b6d8c84112
2 changed files with 11 additions and 5 deletions

View File

@@ -151,6 +151,7 @@ artcl_artifact_url: "file://{{ local_working_dir }}"
artcl_full_artifact_url: "{{ artcl_artifact_url }}/{{ lookup('env', 'BUILD_TAG') }}/"
artcl_use_rsync: false
artcl_rsync_use_daemon: false
artcl_container_collect_timeout: 1800 # 30 mins
artcl_use_swift: false
# clean up the logs after 31 days

View File

@@ -30,8 +30,13 @@
journalctl -u opendaylight > /var/log/extra/odl/odl_journal.log
when: odl_rpm_enabled.rc == 0
- name: Collect container info and logs
script: collect-container-logs.sh
args:
# full path varies across distros
executable: bash
- name: Copy collection logs script for containers
copy:
src: collect-container-logs.sh
dest: /tmp/collect-container-logs.sh
- name: Run container logs collection with timeout
command: >-
timeout --preserve-status -s 15 -k {{ (artcl_container_collect_timeout|int + 30)|string }}
{{ artcl_container_collect_timeout|string }} bash -x /tmp/collect-container-logs.sh
changed_when: true