aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoxiang Zhu <zhu.boxiang@99cloud.net>2022-10-18 10:41:30 +0800
committerBoxiang Zhu <zhu.boxiang@99cloud.net>2023-11-08 09:28:53 +0800
commit69d979c048d5ec92084414d698e3571d7a4b4920 (patch)
tree454372d92a659244bb8d7079b9e8ad9099d38bce
parent37c2ab2aaafa06b40ba1c32a29699fbd8ee17b87 (diff)
downloadkolla-ansible-69d979c048d5ec92084414d698e3571d7a4b4920.tar.gz
kolla-ansible-69d979c048d5ec92084414d698e3571d7a4b4920.zip
[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
-rw-r--r--tests/run.yml7
-rwxr-xr-xtests/setup_gate.sh4
-rw-r--r--tests/templates/globals-default.j24
-rw-r--r--tests/templates/inventory.j210
-rw-r--r--tests/test-skyline.sh60
-rw-r--r--zuul.d/base.yaml10
-rw-r--r--zuul.d/jobs.yaml14
-rw-r--r--zuul.d/project.yaml2
8 files changed, 111 insertions, 0 deletions
diff --git a/tests/run.yml b/tests/run.yml
index 843f59cf1..5503902a5 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 7dc9c92a9..33098ac00 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 <<EOF
[DEFAULT]
engine = ${CONTAINER_ENGINE}
diff --git a/tests/templates/globals-default.j2 b/tests/templates/globals-default.j2
index 86cdb67f4..73029ab62 100644
--- a/tests/templates/globals-default.j2
+++ b/tests/templates/globals-default.j2
@@ -218,3 +218,7 @@ kolla_internal_fqdn: "{{ kolla_internal_fqdn }}"
kolla_enable_tls_backend: "no"
kolla_admin_openrc_cacert: "{% raw %}{{ kolla_certificates_dir }}{% endraw %}/ca/pebble.crt"
{% endif %}
+
+{% if scenario == "skyline" %}
+enable_skyline: "yes"
+{% endif %}
diff --git a/tests/templates/inventory.j2 b/tests/templates/inventory.j2
index e4c33c08c..e1b122288 100644
--- a/tests/templates/inventory.j2
+++ b/tests/templates/inventory.j2
@@ -261,6 +261,9 @@ monitoring
[letsencrypt:children]
loadbalancer
+[skyline:children]
+control
+
# Additional control implemented here. These groups allow you to control which
# services run on which hosts at a per-service level.
#
@@ -758,3 +761,10 @@ letsencrypt
[letsencrypt-lego:children]
letsencrypt
+
+# Skyline
+[skyline-apiserver:children]
+skyline
+
+[skyline-console:children]
+skyline
diff --git a/tests/test-skyline.sh b/tests/test-skyline.sh
new file mode 100644
index 000000000..5b276392e
--- /dev/null
+++ b/tests/test-skyline.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+set -o xtrace
+set -o pipefail
+
+# Enable unbuffered output
+export PYTHONUNBUFFERED=1
+
+function check_skyline {
+ skyline_endpoint=$(openstack endpoint list --interface public --service skyline -f value -c URL)
+ # 9998 is the default port for skyline apiserver.
+ # 9999 is the default port for skyline console.
+ skyline_login_url="${skyline_endpoint//9998/9999}/api/openstack/skyline/api/v1/login"
+ skyline_body="{\"region\": \"${OS_REGION_NAME}\", \"domain\": \"${OS_USER_DOMAIN_NAME}\", \"username\": \"${OS_USERNAME}\", \"password\": \"${OS_PASSWORD}\"}"
+
+ output_path=$1
+ if ! curl -k --include --fail -X POST $skyline_login_url -H "Accept: application/json" -H "Content-Type: application/json" -d "${skyline_body}" > $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 04e84ba12..bccb90488 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 6b62a9553..352814288 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 83fd33cea..6ff073b41 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