From 69d979c048d5ec92084414d698e3571d7a4b4920 Mon Sep 17 00:00:00 2001 From: Boxiang Zhu Date: Tue, 18 Oct 2022 10:41:30 +0800 Subject: [PATCH] [CI] Add skyline scenario Skyline is a new service for dashboard. This patch adds a CI scenario which tests Skyline deployment. Depends-On: https://review.opendev.org/c/openstack/kolla/+/826948 Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/828464 Implements: blueprint skyline Change-Id: I48488a24d6c8a03cd129929347b1bdac25f198b0 --- tests/run.yml | 7 ++++ tests/setup_gate.sh | 4 ++ tests/templates/globals-default.j2 | 4 ++ tests/templates/inventory.j2 | 10 +++++ tests/test-skyline.sh | 60 ++++++++++++++++++++++++++++++ zuul.d/base.yaml | 10 +++++ zuul.d/jobs.yaml | 14 +++++++ zuul.d/project.yaml | 2 + 8 files changed, 111 insertions(+) create mode 100644 tests/test-skyline.sh diff --git a/tests/run.yml b/tests/run.yml index 843f59cf18..5503902a58 100644 --- a/tests/run.yml +++ b/tests/run.yml @@ -555,6 +555,13 @@ chdir: "{{ kolla_ansible_src_dir }}" when: scenario == "venus" + - name: Run test-skyline.sh script + script: + cmd: test-skyline.sh + executable: /bin/bash + chdir: "{{ kolla_ansible_src_dir }}" + when: scenario == "skyline" + when: scenario != "bifrost" # NOTE(yoctozepto): each host checks itself diff --git a/tests/setup_gate.sh b/tests/setup_gate.sh index 7dc9c92a96..33098ac006 100755 --- a/tests/setup_gate.sh +++ b/tests/setup_gate.sh @@ -106,6 +106,10 @@ function prepare_images { GATE_IMAGES="^cron,^opensearch,^fluentd,^haproxy,^keepalived,^keystone,^kolla-toolbox,^mariadb,^memcached,^rabbitmq,^venus" fi + if [[ $SCENARIO == "skyline" ]]; then + GATE_IMAGES+=",^skyline" + fi + sudo tee -a /etc/kolla/kolla-build.conf < $output_path; then + return 1 + fi + if ! grep -E '"keystone_token":' $output_path >/dev/null; then + return 1 + fi +} + +function test_skyline { + echo "TESTING: Skyline" + output_path=$(mktemp) + attempt=1 + while ! check_skyline $output_path; do + echo "Skyline not accessible yet" + attempt=$((attempt+1)) + if [[ $attempt -eq 12 ]]; then + echo "FAILED: Skyline did not become accessible. Response:" + cat $output_path + return 1 + fi + sleep 10 + done + echo "SUCCESS: Skyline" +} + +function test_skyline_logged { + . /etc/kolla/admin-openrc.sh + . ~/openstackclient-venv/bin/activate + test_skyline +} + +function test_skyline_scenario { + echo "Testing Skyline" + test_skyline_logged > /tmp/logs/ansible/test-skyline 2>&1 + result=$? + if [[ $result != 0 ]]; then + echo "Testing Skyline failed. See ansible/test-skyline for details" + else + echo "Successfully tested Skyline. See ansible/test-skyline for details" + fi + return $result +} + +test_skyline_scenario diff --git a/zuul.d/base.yaml b/zuul.d/base.yaml index 04e84ba122..bccb904884 100644 --- a/zuul.d/base.yaml +++ b/zuul.d/base.yaml @@ -297,3 +297,13 @@ scenario: lets-encrypt tls_enabled: true le_enabled: true + +- job: + name: kolla-ansible-skyline-base + parent: kolla-ansible-base + voting: false + files: + - ^ansible/roles/skyline/ + - ^tests/test-skyline.sh + vars: + scenario: skyline diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 6b62a95533..3528142887 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -471,3 +471,17 @@ nodeset: kolla-ansible-rocky9 vars: base_distro: rocky + +- job: + name: kolla-ansible-ubuntu-skyline + parent: kolla-ansible-skyline-base + nodeset: kolla-ansible-jammy + vars: + base_distro: ubuntu + +- job: + name: kolla-ansible-rocky9-skyline + parent: kolla-ansible-skyline-base + nodeset: kolla-ansible-rocky9 + vars: + base_distro: rocky diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 83fd33ceaf..6ff073b416 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -64,6 +64,8 @@ - kolla-ansible-rocky9-hashi-vault - kolla-ansible-ubuntu-lets-encrypt - kolla-ansible-rocky9-lets-encrypt + - kolla-ansible-ubuntu-skyline + - kolla-ansible-rocky9-skyline check-arm64: jobs: - kolla-ansible-debian-aarch64