[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
This commit is contained in:
Boxiang Zhu 2022-10-18 10:41:30 +08:00
parent 37c2ab2aaa
commit 69d979c048
8 changed files with 111 additions and 0 deletions

View File

@ -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

View File

@ -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}

View File

@ -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 %}

View File

@ -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

60
tests/test-skyline.sh Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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