Skip to content

Commit

Permalink
[stf-collect-logs] Move describe build|pod from ci/ to the role
Browse files Browse the repository at this point in the history
  • Loading branch information
elfiesmelfie committed Oct 31, 2023
1 parent 03a5873 commit 6de7897
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
24 changes: 22 additions & 2 deletions build/stf-collect-logs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,28 @@
ansible.builtin.command:
cmd: |
oc -n {{ namespace }} get pods > {{ logfile_dir }}/post_oc_get_pods.log 2>&1
echo "Additional information" >> {{ logfile_dir }}/post_oc_get_pods.log
oc -n {{ namespace }} describe pods >> {{ logfile_dir }}/post_oc_get_pods.log 2>&1
ignore_errors: true
retries: 3
delay: 10

- name: "Describe non-completed, non-running pods"
ansible.builtin.shell:
cmd: |
for pod in $(oc get pods | grep -v NAME | grep -v Running | awk '{ print $1 }');
do
oc -n {{ namespace }} describe pod $pod > {{ logfile_dir }}/post_oc_describe_pod_${pod}.log 2>&1
done
ignore_errors: true
retries: 3
delay: 10

- name: "Describe builds"
ansible.builtin.shell:
cmd: |
for build in $(oc -n {{ namespace }} get builds -o json | jq -r '.items[].metadata.name');
do
oc -n {{ namespace }} describe build $build > {{ logfile_dir }}/post_oc_describe_build_${build}.log 2>&1
done
ignore_errors: true
retries: 3
delay: 10
19 changes: 0 additions & 19 deletions ci/post-collect_logs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,6 @@
ansible.builtin.import_role:
name: '../build/stf-collect-logs'

- name: "Get pods and describe non-completed, non-running pods"
ansible.builtin.shell:
cmd: |
echo "*** oc get pods ***" > {{ logfile_dir }}/oc_get_pods.log 2>&1
oc -n {{ namespace }} get pods >> {{ logfile_dir }}/oc_get_pods.log 2>&1
for pod in $(oc get pods | grep -v NAME | grep -v Running | awk '{ print $1 }');
do
oc -n {{ namespace }} describe pod $pod > {{ logfile_dir }}/post_oc_describe_pod_${pod}.log 2>&1
done
ignore_errors: true
retries: 3
delay: 10

- name: "Get build details"
ansible.builtin.shell:
cmd: |
for build in $(oc -n {{ namespace }} get builds -o json| jq -r '.items[].metadata.name'); do oc -n {{ namespace }} describe build $build > {{ logfile_dir }}/post_oc_describe_build_${build}.log 2>&1; done
- name: "Copy generated logs"
ansible.builtin.shell: |
cp {{ ansible_env.HOME }}/*.log .
Expand Down

0 comments on commit 6de7897

Please sign in to comment.