Moved Octavia image upload and CirrOS image identification to Ansible
Change-Id: Ief843310ce57a2d1062d86c54cd7ad6e0f705b68
This commit is contained in:
parent
133af96666
commit
85fa2bb2b6
.zuul.yamlrun-ansible-tests-collection.sh
ci
playbooks
roles
floating_ip/tasks
loadbalancer/tasks
server/tasks
server_metadata/tasks
@ -67,7 +67,6 @@
|
|||||||
# parent job variant during job freeze when child jobs are on other branches.
|
# parent job variant during job freeze when child jobs are on other branches.
|
||||||
description: |
|
description: |
|
||||||
Run openstack collections functional tests against a devstack with Octavia plugin enabled
|
Run openstack collections functional tests against a devstack with Octavia plugin enabled
|
||||||
pre-run: ci/playbooks/get_amphora_tarball.yaml
|
|
||||||
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
|
# Do not set job.override-checkout or job.required-projects.override-checkout in base job because
|
||||||
# else Zuul will use this branch when matching variants for parent jobs during job freeze
|
# else Zuul will use this branch when matching variants for parent jobs during job freeze
|
||||||
required-projects:
|
required-projects:
|
||||||
@ -93,10 +92,6 @@
|
|||||||
o-cw: true
|
o-cw: true
|
||||||
o-hk: true
|
o-hk: true
|
||||||
o-hm: true
|
o-hm: true
|
||||||
devstack_localrc:
|
|
||||||
OCTAVIA_AMP_IMAGE_FILE: "/tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2"
|
|
||||||
OCTAVIA_AMP_IMAGE_SIZE: 3
|
|
||||||
OCTAVIA_AMP_IMAGE_NAME: "test-only-amphora-x64-haproxy-ubuntu-bionic"
|
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: ansible-collections-openstack-functional-devstack-octavia
|
name: ansible-collections-openstack-functional-devstack-octavia
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- name: Download amphora tarball
|
|
||||||
get_url:
|
|
||||||
url: "https://tarballs.openstack.org/octavia/test-images/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2"
|
|
||||||
dest: /tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2
|
|
@ -1,4 +1,15 @@
|
|||||||
---
|
---
|
||||||
|
- name: List all images
|
||||||
|
openstack.cloud.image_info:
|
||||||
|
cloud: "{{ cloud }}"
|
||||||
|
register: images
|
||||||
|
|
||||||
|
- name: Identify CirrOS image name
|
||||||
|
set_fact:
|
||||||
|
image_name: "{{ images.images|community.general.json_query(query)|first }}"
|
||||||
|
vars:
|
||||||
|
query: "[?starts_with(name, 'cirros')].name"
|
||||||
|
|
||||||
- name: Gather information about public network
|
- name: Gather information about public network
|
||||||
openstack.cloud.networks_info:
|
openstack.cloud.networks_info:
|
||||||
cloud: "{{ cloud }}"
|
cloud: "{{ cloud }}"
|
||||||
|
@ -1,5 +1,25 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
- name: Download Amphora tarball
|
||||||
|
get_url:
|
||||||
|
url: "https://tarballs.openstack.org/octavia/test-images/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2"
|
||||||
|
dest: /tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2
|
||||||
|
|
||||||
|
- name: Upload Amphora image for Octavia to test load balancers
|
||||||
|
openstack.cloud.image:
|
||||||
|
cloud: "{{ cloud }}"
|
||||||
|
container_format: bare
|
||||||
|
disk_format: qcow2
|
||||||
|
filename: /tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2
|
||||||
|
is_public: false
|
||||||
|
name: test-only-amphora-x64-haproxy-ubuntu-bionic
|
||||||
|
owner: service
|
||||||
|
properties:
|
||||||
|
hw_architecture: x86_64
|
||||||
|
hw_rng_model: virtio
|
||||||
|
state: present
|
||||||
|
tags:
|
||||||
|
- amphora
|
||||||
|
|
||||||
- name: Create network {{ network_name }} for LB
|
- name: Create network {{ network_name }} for LB
|
||||||
openstack.cloud.network:
|
openstack.cloud.network:
|
||||||
cloud: "{{ cloud }}"
|
cloud: "{{ cloud }}"
|
||||||
|
@ -1,4 +1,15 @@
|
|||||||
---
|
---
|
||||||
|
- name: List all images
|
||||||
|
openstack.cloud.image_info:
|
||||||
|
cloud: "{{ cloud }}"
|
||||||
|
register: images
|
||||||
|
|
||||||
|
- name: Identify CirrOS image name
|
||||||
|
set_fact:
|
||||||
|
image_name: "{{ images.images|community.general.json_query(query)|first }}"
|
||||||
|
vars:
|
||||||
|
query: "[?starts_with(name, 'cirros')].name"
|
||||||
|
|
||||||
- name: Create network for server
|
- name: Create network for server
|
||||||
openstack.cloud.network:
|
openstack.cloud.network:
|
||||||
cloud: "{{ cloud }}"
|
cloud: "{{ cloud }}"
|
||||||
|
@ -1,4 +1,15 @@
|
|||||||
---
|
---
|
||||||
|
- name: List all images
|
||||||
|
openstack.cloud.image_info:
|
||||||
|
cloud: "{{ cloud }}"
|
||||||
|
register: images
|
||||||
|
|
||||||
|
- name: Identify CirrOS image name
|
||||||
|
set_fact:
|
||||||
|
image_name: "{{ images.images|community.general.json_query(query)|first }}"
|
||||||
|
vars:
|
||||||
|
query: "[?starts_with(name, 'cirros')].name"
|
||||||
|
|
||||||
- name: Create test server
|
- name: Create test server
|
||||||
openstack.cloud.server:
|
openstack.cloud.server:
|
||||||
cloud: "{{ cloud }}"
|
cloud: "{{ cloud }}"
|
||||||
|
@ -95,12 +95,6 @@ if [ "$USE_DEV" -eq 1 ]; then
|
|||||||
source "$ENVDIR/ansible/hacking/env-setup"
|
source "$ENVDIR/ansible/hacking/env-setup"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run the shade Ansible tests
|
|
||||||
tag_opt=""
|
|
||||||
if [ -n "$TAGS" ]; then
|
|
||||||
tag_opt="--tags $TAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Loop through all ANSIBLE_VAR_ environment variables to allow passing the further
|
# Loop through all ANSIBLE_VAR_ environment variables to allow passing the further
|
||||||
for var in $(env | grep -e '^ANSIBLE_VAR_'); do
|
for var in $(env | grep -e '^ANSIBLE_VAR_'); do
|
||||||
VAR_NAME=${var%%=*} # split variable name from value
|
VAR_NAME=${var%%=*} # split variable name from value
|
||||||
@ -110,39 +104,20 @@ for var in $(env | grep -e '^ANSIBLE_VAR_'); do
|
|||||||
ANSIBLE_VARS+="${ANSIBLE_VAR_NAME}=${ANSIBLE_VAR_VALUE} " # concat variables
|
ANSIBLE_VARS+="${ANSIBLE_VAR_NAME}=${ANSIBLE_VAR_VALUE} " # concat variables
|
||||||
done
|
done
|
||||||
|
|
||||||
# Until we have a module that lets us determine the image we want from
|
|
||||||
# within a playbook, we have to find the image here and pass it in.
|
|
||||||
# We use the openstack client instead of nova client since it can use clouds.yaml.
|
|
||||||
IMAGE=$(openstack "--os-cloud=$CLOUD" image list -f value -c Name | grep cirros | grep -v -e ramdisk -e kernel)
|
|
||||||
if [ -z "$IMAGE" ]; then
|
|
||||||
echo "Failed to find Cirros image"
|
|
||||||
exit 3
|
|
||||||
fi
|
|
||||||
|
|
||||||
# In case of Octavia enabled:
|
|
||||||
_octavia_image_path="/tmp/test-only-amphora-x64-haproxy-ubuntu-bionic.qcow2"
|
|
||||||
if systemctl list-units --full -all | grep -Fq "devstack@o-api.service" && \
|
|
||||||
test -f "$_octavia_image_path"; then
|
|
||||||
# Upload apmhora image for Octavia to test load balancers
|
|
||||||
OCTAVIA_AMP_IMAGE_FILE=${OCTAVIA_AMP_IMAGE_FILE:-"$_octavia_image_path"}
|
|
||||||
OCTAVIA_AMP_IMAGE_NAME=${OCTAVIA_AMP_IMAGE_NAME:-"test-only-amphora-x64-haproxy-ubuntu-bionic"}
|
|
||||||
OCTAVIA_AMP_IMAGE_SIZE=${OCTAVIA_AMP_IMAGE_SIZE:-3}
|
|
||||||
openstack "--os-cloud=$CLOUD" image create \
|
|
||||||
--container-format bare \
|
|
||||||
--disk-format qcow2 \
|
|
||||||
--private \
|
|
||||||
--file "$OCTAVIA_AMP_IMAGE_FILE" \
|
|
||||||
--project service "$OCTAVIA_AMP_IMAGE_NAME"
|
|
||||||
openstack "--os-cloud=$CLOUD" image set --tag amphora "$OCTAVIA_AMP_IMAGE_NAME"
|
|
||||||
# End of Octavia preparement
|
|
||||||
else
|
|
||||||
# Run all tasks except for loadbalancer tasks
|
|
||||||
tag_opt+=" --skip-tags loadbalancer"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Discover openstacksdk version
|
# Discover openstacksdk version
|
||||||
SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)")
|
SDK_VER=$(python -c "import openstack; print(openstack.version.__version__)")
|
||||||
|
|
||||||
|
# Choose integration tests
|
||||||
|
tag_opt=""
|
||||||
|
if [ -n "$TAGS" ]; then
|
||||||
|
tag_opt="--tags $TAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! systemctl is-enabled devstack@o-api.service 2>&1; then
|
||||||
|
# Run all tasks except for loadbalancer if Octavia is not available
|
||||||
|
tag_opt+=" --skip-tags loadbalancer"
|
||||||
|
fi
|
||||||
|
|
||||||
cd ci/
|
cd ci/
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
@ -150,5 +125,5 @@ set -o pipefail
|
|||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
ANSIBLE_COLLECTIONS_PATHS=$TEST_COLLECTIONS_PATHS ansible-playbook \
|
ANSIBLE_COLLECTIONS_PATHS=$TEST_COLLECTIONS_PATHS ansible-playbook \
|
||||||
-vvv ./run-collection.yml \
|
-vvv ./run-collection.yml \
|
||||||
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} image_name=${IMAGE} ${ANSIBLE_VARS}" \
|
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} ${ANSIBLE_VARS}" \
|
||||||
${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log
|
${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log
|
||||||
|
Loading…
x
Reference in New Issue
Block a user