Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mgirgisf/stf 1580/fix log commands #526

Merged
merged 15 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions build/run-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@
- name: Run the STF CI system
import_role:
name: stf-run-ci


- name: Create Log directory
file:
path: "{{ playbook_dir }}/working/logs"
state: directory

- name: Collect the logs
import_role:
name: stf-collect-logs
vars:
logfile_dir: "{{ playbook_dir }}/"
logfile_dir: "{{ playbook_dir }}/working/logs/"
44 changes: 13 additions & 31 deletions build/stf-collect-logs/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
---
- name: "Get builds"
ansible.builtin.shell:
cmd: |
echo "*** [INFO] Showing oc get builds" > {{ logfile_dir }}/post_oc_get_builds.log 2>&1
oc -n {{ namespace }} get builds -oyaml >> {{ logfile_dir }}/post_oc_get_builds.log 2>&1
echo "*** [INFO] Showing oc get builds -oyaml" >> {{ logfile_dir }}/post_oc_get_builds.log 2>&1
oc -n {{ namespace }} get builds -oyaml >> {{ logfile_dir }}/post_oc_get_builds.log 2>&1
cat {{ logfile_dir }}/post_oc_get_builds.log
- name: "Get resources logs [ Builds, Subscriptions, Image, Imagestreams, Pods ]"
ansible.builtin.shell: |
for resource in {{ resource_types|join(' ') }}; do
log_file="{{ logfile_dir }}/post_oc_get_$resource.log"
echo "*** [INFO] Showing oc get '$resource'" > "$log_file" 2>&1
oc -n {{ namespace }} get "$resource" >> "$log_file" 2>&1
echo "[INFO] oc get '$resource' -oyaml" >> "$log_file" 2>&1
oc -n {{ namespace }} get "$resource" -oyaml >> "$log_file" 2>&1
done
delay: 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retries: 3
ignore_errors: true
changed_when: false

- name: "Get subscription details"
ansible.builtin.shell:
cmd: |
oc -n {{ namespace }} get subscriptions > {{ logfile_dir }}/post_oc_get_subscriptions.log 2>&1
oc -n {{ namespace }} describe subscription service-telemetry-operator >> {{ logfile_dir }}/post_oc_get_subscriptions.log 2>&1
ignore_errors: true

- name: "Get image infos"
- name: "Get Additional Information details"
ansible.builtin.shell:
cmd: |
echo "[INFO] oc get images" > {{ logfile_dir }}/post_oc_get_images.log 2>&1
oc -n {{ namespace }} get images >> {{ logfile_dir }}/post_oc_get_images.log 2>&1
echo "[INFO] oc get imagestreams" >> {{ logfile_dir }}/post_oc_get_images.log 2>&1
oc -n {{ namespace }} get imagestream >> {{ logfile_dir }}/post_oc_get_images.log 2>&1
echo "[INFO] oc get imagestream -oyaml" >> {{ logfile_dir }}/post_oc_get_images.log 2>&1
oc -n {{ namespace }} get imagestream -oyaml >> {{ logfile_dir }}/post_oc_get_images.log 2>&1
retries: 3
delay: 10
oc -n {{ namespace }} describe subscription service-telemetry-operator >> {{ logfile_dir }}/post_oc_describe_subscriptions_STO.log 2>&1
ignore_errors: true

- name: "Get STO info"
Expand All @@ -47,13 +36,6 @@
oc -n {{ namespace }} get csv | grep service-telemetry-operator >> {{ logfile_dir }}/post_question_deployment.log 2>&1
oc -n {{ namespace }} get csv $(oc -n {{ namespace }} get csv | grep "service-telemetry-operator" | awk '{ print $1}') -oyaml >> {{ logfile_dir }}/post_question_deployment.log 2>&1
register: output
retries: 3
delay: 10

- name: "Get pods"
ansible.builtin.command:
cmd: |
oc -n {{ namespace }} get pods > {{ logfile_dir }}/post_oc_get_pods.log 2>&1
ignore_errors: true
retries: 3
delay: 10
Expand Down
6 changes: 6 additions & 0 deletions build/stf-collect-logs/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
---
# vars file for stf-collect-logs
resource_types:
- builds
- subscriptions
- images
- imagestream
- pods
6 changes: 3 additions & 3 deletions build/stf-run-ci/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@
- name: Validate system is operational
ansible.builtin.shell: |
OCP_PROJECT="{{ namespace }}" VALIDATION_SCOPE="{{ __service_telemetry_observability_strategy }}" timeout 1200 "{{ base_dir }}/validate_deployment.sh" >> {{ logfile_dir }}/validate_deployment.log 2>&1
cat {{ logfile_dir }}/validate_deployment.log
args:
executable: /bin/bash
register: validate_deployment

- name: Show the result of the validate_deployment script
ansible.builtin.shell:
cmd: |
cat {{ logfile_dir }}/validate_deployment.log
ansible.builtin.debug:
var: validate_deployment.stdout
7 changes: 6 additions & 1 deletion build/stf-run-ci/tasks/preflight_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
ansible.builtin.command:
cmd: |
oc describe csv $(oc get csv | grep "service-telemetry-operator" | awk '{print $1}') > {{ logfile_dir }}/oc_get_csv_sto.log 2>&1
cat {{ logfile_dir }}
cat {{ logfile_dir }}/oc_get_csv_sto.log
elfiesmelfie marked this conversation as resolved.
Show resolved Hide resolved
register: csv_sto

- name: "Show service-telemetry-operator CSV information"
ansible.builtin.debug:
var: csv_sto.stdout

- name: "Show fail message if CSV isn't Succeeded after the alotted time"
ansible.builtin.fail:
msg: "Service Telemetry Operator CSV not Succeeded after 10 minutes. Check {{ logfile_dir }}/oc_get_csv_sto.log for more information"
Expand Down