784f6c5286
When script fails, the job continues and passes. Remove unnecessary code saving and let the task to fail. Make script to be generated for easier investigation what command was running. Change-Id: I1edce370458769a1479ee568b745e78ddcef693a
55 lines
2.0 KiB
YAML
55 lines
2.0 KiB
YAML
- hosts: primary
|
|
tasks:
|
|
- name: Include common vars
|
|
include_vars:
|
|
file: "common.yaml"
|
|
|
|
- name: Grab job artifacts
|
|
become: true
|
|
args:
|
|
chdir: "{{ workspace }}"
|
|
shell: |
|
|
set -x
|
|
mkdir -p {{ workspace }}/conf/
|
|
mkdir -p {{ workspace }}/logs/system
|
|
mkdir -p {{ workspace }}/etc/docker
|
|
mkdir -p {{ workspace }}/logs/buildah-builds
|
|
|
|
mv *.conf {{ workspace }}/conf/
|
|
mv *.log {{ workspace }}/logs/
|
|
mv *.sh {{ workspace }}/logs/
|
|
mv /tmp/kolla-* {{ workspace }}/logs/buildah-builds/ || true
|
|
rsync -var --no-links /var/log/ {{ workspace }}/logs/system/ || true
|
|
rsync -var --no-links /etc/docker/ {{ workspace }}/etc/docker/ || true
|
|
rsync -var --no-links /etc/containers/ {{ workspace }}/etc/containers/ || true
|
|
rsync -var --no-links /etc/yum.repos.d/ {{ workspace }}/etc/yum.repos.d/ || true
|
|
gzip -r "{{ workspace }}/logs" "{{ workspace }}/conf" "{{ workspace }}/etc"
|
|
chmod -R a+r "{{ workspace }}"
|
|
chown -R {{ ansible_user }}: "{{ workspace }}"
|
|
|
|
- name: Rename compressed text based files to end with txt.gz extension
|
|
become: true
|
|
shell: >
|
|
set -o pipefail &&
|
|
find {{ workspace }}/logs {{ workspace }}/conf {{ workspace }}/etc -type f |
|
|
awk 'function rename(orig)
|
|
{ new=orig; sub(/\.gz$/, ".txt.gz", new); system("mv " orig " " new) }
|
|
/\.(conf|ini|json|sh|log|yaml|yml|repo|cfg|j2|py)\.gz$/ { rename($0) }
|
|
/(\/logs\/|\/etc\/)[^ \/\.]+\.gz$/ { rename($0) }';
|
|
|
|
- name: Copy files from {{ ansible_user_dir }}/workspace/ on node
|
|
#no_log: true
|
|
synchronize:
|
|
src: '{{ ansible_user_dir }}/workspace/'
|
|
dest: '{{ zuul.executor.log_root }}'
|
|
mode: pull
|
|
copy_links: true
|
|
verify_host: true
|
|
rsync_opts:
|
|
- --include=/etc/**
|
|
- --include=/conf/**
|
|
- --include=/logs/**
|
|
- --include=*/
|
|
- --exclude=*
|
|
- --prune-empty-dirs
|