diff --git a/playbooks/kata-runsh/post.yaml b/playbooks/kata-runsh/post.yaml new file mode 100644 index 00000000..4553e9af --- /dev/null +++ b/playbooks/kata-runsh/post.yaml @@ -0,0 +1,85 @@ +- hosts: all + tasks: + - name: Ensure logs directory + file: + path: '{{ ansible_user_dir }}/logs' + state: directory + mode: 0755 + + # TODO use with items + - name: Write runtime log + shell: | + set -x + journalctl -b -o short-precise -t kata-runtime | gzip > {{ ansible_user_dir }}/logs/kata-runtime.log.gz + become: yes + - name: Make runtime log readable + file: + path: '{{ ansible_user_dir }}/logs/kata-runtime.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write agent and proxy log + shell: | + set -x + journalctl -b -o short-precise -t kata-proxy | gzip > {{ ansible_user_dir }}/logs/kata-proxy.log.gz + become: yes + - name: Make proxy log readable + file: + path: '{{ ansible_user_dir }}/logs/kata-proxy.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write shim log + shell: | + set -x + journalctl -b -o short-precise -t kata-shim | gzip > {{ ansible_user_dir }}/logs/kata-shim.log.gz + become: yes + - name: Make shim log readable + file: + path: '{{ ansible_user_dir }}/logs/kata-shim.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write docker log + shell: | + set -x + journalctl -b -o short-precise -u docker.service | gzip > {{ ansible_user_dir }}/logs/docker.log.gz + become: yes + - name: Make docker log readable + file: + path: '{{ ansible_user_dir }}/logs/docker.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write crio log + shell: | + set -x + journalctl -b -o short-precise -u crio | gzip > {{ ansible_user_dir }}/logs/crio.log.gz + become: yes + - name: Make crio log readable + file: + path: '{{ ansible_user_dir }}/logs/crio.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Write kubelet log + shell: | + set -x + journalctl -b -o short-precise -u kubelet | gzip > {{ ansible_user_dir }}/logs/kubelet.log.gz + become: yes + - name: Make kubelet log readable + file: + path: '{{ ansible_user_dir }}/logs/kubelet.log.gz' + mode: 'u+r,g+r,o+r' + become: yes + + - name: Copy log files from test node to executor + synchronize: + src: '{{ ansible_user_dir }}/logs' + dest: '{{ zuul.executor.log_root }}' + mode: pull + copy_links: true + verify_host: true + rsync_opts: + - --prune-empty-dirs + diff --git a/playbooks/kata-runsh/pre.yaml b/playbooks/kata-runsh/pre.yaml index 5c64427f..4cc51e5c 100644 --- a/playbooks/kata-runsh/pre.yaml +++ b/playbooks/kata-runsh/pre.yaml @@ -18,6 +18,40 @@ mode: 0755 state: directory become: yes + + # Install docker because .ci/setup.sh installs a version that is too old + # to pass CI testing with. + # TODO have .ci/setup.sh do the right thing + - name: Install apt-transport-https + package: + name: apt-transport-https + state: present + become: yes + - name: Install ca-certificates + package: + name: ca-certificates + state: present + become: yes + - name: Install software-properties-common + package: + name: software-properties-common + state: present + become: yes + - name: Add docker-ce repo + args: + executable: /bin/bash + shell: | + set -x + curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | apt-key add - + add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + apt-get update + become: yes + - name: Install docker-ce + package: + name: docker-ce + state: present + become: yes + - name: Run kata setup.sh args: executable: /bin/bash diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index c00b9f31..ae75405b 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -1449,6 +1449,7 @@ Run kata's setup.sh and run.sh CI scripts pre-run: playbooks/kata-runsh/pre.yaml run: playbooks/kata-runsh/run.yaml + post-run: playbooks/kata-runsh/post.yaml timeout: 3600 nodeset: nodes: