-
Notifications
You must be signed in to change notification settings - Fork 617
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: Fetch DevStack and k3s logs (#2527)
This commit makes sure we're fetching and putting the logs of the DevStack services as well as k3s into the artifacts for every CI job.
- Loading branch information
Showing
7 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- hosts: all | ||
become: true | ||
become_method: sudo | ||
gather_facts: true | ||
|
||
vars: | ||
user: stack | ||
devstack_workdir: /home/{{ user }}/devstack | ||
|
||
roles: | ||
- role: fetch-logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The ansible role gets logs of various services running in the CI for further analysis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
master_port_name: "k3s_master" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
- name: Get k3s master floating IP | ||
shell: | ||
executable: /bin/bash | ||
cmd: | | ||
set +x; source {{ devstack_workdir }}/openrc demo demo > /dev/null | ||
openstack floating ip list --port {{ master_port_name }} -c "Floating IP Address" -f value | ||
register: fip | ||
|
||
- name: Set fact for k3s master floating IP | ||
set_fact: | ||
k3s_fip: "{{ fip.stdout }}" | ||
|
||
- name: Creates directory | ||
ansible.builtin.file: | ||
path: "/root/logs" | ||
state: directory | ||
|
||
- name: Fetch k3s logs | ||
shell: | ||
executable: /bin/bash | ||
cmd: | | ||
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ ansible_user_dir }}/.ssh/id_rsa ubuntu@{{ k3s_fip }} sudo journalctl -u k3s.service --no-pager > /root/logs/k3s.log | ||
- name: Fetch DevStack logs | ||
shell: | ||
executable: /bin/bash | ||
cmd: | | ||
set +x; | ||
units=`systemctl list-units --type service | awk '{ print $1 }' | grep devstack\@` | ||
for unit in $units; do | ||
filename=${unit#"devstack@"} | ||
filename=${filename%".service"} | ||
sudo journalctl -u $unit --no-pager > /root/logs/${filename}.log | ||
done; |