Guillaume Boutry 0bda4738e3
[tests] migrate tests to k8s
Migrate tests from microk8s to ck8s.
Bootstrap a controller on a manual cloud, and add ck8s to available
clouds.

Upgrade juju to 3.5

Configure ephemeral device when available, configure k8s to use it for
local storage.

Change-Id: Ief491f8b339307f0c43d11639336b02d9f6479b4
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
2024-09-18 12:31:05 +02:00

59 lines
1.8 KiB
YAML

- name: test runner packages are installed
apt:
name:
- jq
become: true
- name: Create destination for logs
file:
path: "{{ zuul.project.src_dir }}/log"
state: directory
mode: 0755
- name: collect disk usage
shell: df -h > {{ zuul.project.src_dir }}/log/df.txt
- name: collect mount list
shell: mount > {{ zuul.project.src_dir }}/log/mount.txt
- name: debug logs replay
args:
executable: /bin/bash
shell: |
set -o pipefail
MODEL="$(juju models --format=json | jq -r '.models[]["short-name"]' | grep '^zaza-')"
juju switch $MODEL
juju debug-log --replay > {{ zuul.project.src_dir }}/log/debug-hooks.txt
exit 0
- name: juju status
args:
executable: /bin/bash
shell: |
set -o pipefail
for model in $(juju models | grep zaza- | awk '{gsub(/\*?/,""); print $1}'); do
juju status -m $model > {{ zuul.project.src_dir }}/log/juju-status.$model.txt
juju status -m $model --format=yaml > {{ zuul.project.src_dir }}/log/juju-status.$model.yaml
done
- name: Collect units' info
args:
executable: /bin/bash
shell: |
set -o pipefail
set -x
LOG_FOLDER={{ zuul.project.src_dir }}/log/unit-info/
MODEL_NAME=$(juju models --format=json | jq -r '.models[]["short-name"]' | grep '^zaza-')
mkdir -p $LOG_FOLDER
for unit in $(juju status --format json | jq -r '[.applications[].units | keys[0]] | join("\n")');
do
echo Collecting unit info: $unit
unit_name=$(echo $unit | tr / -)
juju show-unit --output="$LOG_FOLDER/$unit_name.yaml" $unit
done
- name: Include k8s tasks
include_tasks: k8s.yaml
when: env_type == 'k8s'
- name: fetch juju logs
synchronize:
dest: "{{ zuul.executor.log_root }}"
mode: pull
src: "{{ zuul.project.src_dir }}/log"
verify_host: true
owner: false
group: false