Browse Source

Move to zuul3 jobs

https://docs.openstack.org/infra/manual/zuulv3.html#legacy-job-migration-details

Co-Authored-By: Duong Ha-Quang <duonghq@vn.fujitsu.com>
Co-Authored-By: yong sheng gong <gong.yongsheng@99cloud.net>

Closes-bug: #1729632
Change-Id: I2d1c4795b1a591831a12535d2f048a13258f4913
changes/04/516004/24
yong sheng gong 4 years ago
parent
commit
9af2b71e07
  1. 59
      .zuul.yaml
  2. 61
      devstack/lib/tacker
  3. 3
      devstack/plugin.sh
  4. 4
      playbooks/devstack/post.yaml
  5. 10
      playbooks/devstack/pre.yaml
  6. 3
      playbooks/devstack/run.yaml
  7. 13
      roles/devstack-config/tasks/main.yaml
  8. 24
      roles/setup-default-vim/tasks/main.yaml
  9. 7
      tools/test-setup-default-vim.sh
  10. 2
      tox.ini

59
.zuul.yaml

@ -0,0 +1,59 @@
- job:
name: tacker-functional-devstack
parent: devstack
description: |
Base job for devstack-based functional tests
pre-run: playbooks/devstack/pre
run: playbooks/devstack/run
post-run: playbooks/devstack/post
roles:
- zuul: openstack-infra/devstack
timeout: 9000
required-projects:
- openstack/aodh
- openstack/horizon
- openstack/barbican
- openstack/ceilometer
- openstack/heat
- openstack/mistral
- openstack/mistral-dashboard
- openstack/networking-sfc
- openstack/python-barbicanclient
- openstack/python-mistralclient
- openstack/python-tackerclient
- openstack/tacker
- openstack/tacker-horizon
vars:
devstack_services:
horizon: True
tacker: True
tacker-conductor: True
devstack_plugins:
heat: https://git.openstack.org/openstack/heat
networking-sfc: https://git.openstack.org/openstack/networking-sfc
aodh: https://git.openstack.org/openstack/aodh
ceilometer: https://git.openstack.org/openstack/ceilometer
barbican: https://git.openstack.org/openstack/barbican
mistral: https://git.openstack.org/openstack/mistral
tacker: https://git.openstack.org/openstack/tacker
tox_install_siblings: False
tox_envlist: dsvm-functional
zuul_work_dir: src/git.openstack.org/openstack/tacker
- job:
name: tacker-functional-devstack-python3
parent: tacker-functional-devstack
description: |
Run tacker functional tests using python3 against a master devstack
vars:
tacker_environment:
TACKER_TOX_PYTHON: python3
- project:
name: openstack/tacker
check:
jobs:
- tacker-functional-devstack:
voting: false
- tacker-functional-devstack-python3:
voting: false

61
devstack/lib/tacker

@ -89,6 +89,8 @@ TACKER_NOVA_API_INSECURE=${TACKER_NOVA_API_INSECURE:-False}
HEAT_CONF_DIR=/etc/heat
source ${TACKER_DIR}/tacker/tests/contrib/post_test_hook_lib.sh
# Functions
# ---------
# Test if any Tacker services are enabled
@ -409,35 +411,60 @@ function tacker_register_default_vim {
get_or_create_project $DEFAULT_VIM_PROJECT_NAME
echo "Create NFV VIM user $DEFAULT_VIM_USER ..."
get_or_create_user $DEFAULT_VIM_USER $DEFAULT_VIM_PASSWORD
get_or_add_user_project_role "admin" $DEFAULT_VIM_USER $DEFAULT_VIM_PROJECT_NAME
get_or_add_user_project_role "advsvc" $DEFAULT_VIM_USER $DEFAULT_VIM_PROJECT_NAME
get_or_add_user_project_role admin $DEFAULT_VIM_USER $DEFAULT_VIM_PROJECT_NAME
# get_or_add_user_project_role advsvc $DEFAULT_VIM_USER $DEFAULT_VIM_PROJECT_NAME
echo "Register default VIM ..."
echo "Set register default VIM sh which is called by ansible role..."
mkdir -p $DATA_DIR/tacker
cp $TACKER_DIR/devstack/vim_config.yaml $DATA_DIR/tacker
VIM_CONFIG_FILE="$DATA_DIR/tacker/vim_config.yaml"
sed -e "s|^auth_url:.*$|auth_url: \'${KEYSTONE_SERVICE_URI}\'|" -i $VIM_CONFIG_FILE
echo "The content of VIM config file $VIM_CONFIG_FILE :"
cat $VIM_CONFIG_FILE
local default_vim_id
DEFAULT_VIM_NAME="VIM0"
old_project=$OS_PROJECT_NAME
old_user=$OS_USERNAME
$TOP_DIR/tools/create_userrc.sh -P -u $DEFAULT_VIM_USER -C $DEFAULT_VIM_PROJECT_NAME -p $DEFAULT_VIM_PASSWORD
echo "Switch environment openrc:"
echo $(cat $TOP_DIR/accrc/$DEFAULT_VIM_PROJECT_NAME/$DEFAULT_VIM_USER)
. $TOP_DIR/accrc/$DEFAULT_VIM_PROJECT_NAME/$DEFAULT_VIM_USER
default_vim_id=$(tacker vim-register --is-default --description "Default VIM" --config-file $VIM_CONFIG_FILE $DEFAULT_VIM_NAME -c id | grep id | awk '{print $4}')
echo "Default VIM registration done as $default_vim_id at $KEYSTONE_SERVICE_URI."
echo "Switch back to old environment openrc:"
echo $(cat $TOP_DIR/accrc/$old_project/$old_user)
. $TOP_DIR/accrc/$old_project/$old_user
cat >> $TACKER_DIR/tools/test-setup-default-vim.sh <<EOF
tacker --os-username nfv_user --os-project-name nfv --os-password devstack --os-auth-url ${KEYSTONE_SERVICE_URI} --os-project-domain-name Default --os-user-domain-name Default vim-register --is-default --description "Default VIM" --config-file $VIM_CONFIG_FILE $DEFAULT_VIM_NAME
EOF
echo "The content of $TACKER_DIR/tools/test-setup-default-vim.sh"
cat $TACKER_DIR/tools/test-setup-default-vim.sh
echo "Update tacker/tests/etc/samples/local-vim.yaml for functional testing"
functional_vim_file="$TACKER_DIR/tacker/tests/etc/samples/local-vim.yaml"
sed -e "s|^auth_url:.*$|auth_url: \'${KEYSTONE_SERVICE_URI}\'|" -i $functional_vim_file
echo "The content of functional VIM config file $functional_vim_file :"
cat $functional_vim_file
echo "Set up target openstack vim resources ..."
openstack --os-cloud=devstack-admin quota set \
--class --instances -1 --cores -1 --ram -1 default
openstack --os-cloud=devstack-admin \
quota set --ports -1 $DEFAULT_VIM_PROJECT_NAME
openstack --os-region-name RegionOne --os-project-name $DEFAULT_VIM_PROJECT_NAME \
--os-user-domain-id default --os-username $DEFAULT_VIM_USER \
--os-project-domain-id default --os-auth-url $KEYSTONE_SERVICE_URI \
--os-password $DEFAULT_VIM_PASSWORD keypair create userKey
openstack --os-region-name RegionOne --os-project-name $DEFAULT_VIM_PROJECT_NAME \
--os-user-domain-id default --os-username $DEFAULT_VIM_USER \
--os-project-domain-id default --os-auth-url $KEYSTONE_SERVICE_URI \
--os-password $DEFAULT_VIM_PASSWORD \
security group create \
--description "tacker functest security group" test_secgrp
openstack --os-region-name RegionOne --os-project-name $DEFAULT_VIM_PROJECT_NAME \
--os-user-domain-id default --os-username $DEFAULT_VIM_USER \
--os-project-domain-id default --os-auth-url $KEYSTONE_SERVICE_URI \
--os-password $DEFAULT_VIM_PASSWORD \
security group rule create \
--ingress --protocol icmp test_secgrp
openstack --os-region-name RegionOne --os-project-name $DEFAULT_VIM_PROJECT_NAME \
--os-user-domain-id default --os-username $DEFAULT_VIM_USER \
--os-project-domain-id default --os-auth-url $KEYSTONE_SERVICE_URI \
--os-password $DEFAULT_VIM_PASSWORD \
security group rule create \
--ingress --protocol tcp --dst-port 22 test_secgrp
}
function modify_heat_flavor_policy_rule {

3
devstack/plugin.sh

@ -4,7 +4,7 @@
XTRACE=$(set +o | grep xtrace)
set -o xtrace
echo_summary "tacker's plugin.sh was called..."
echo_summary "tacker's plugin.sh was called with args $1 and $2 ..."
. $DEST/tacker/devstack/lib/tacker
(set -o posix; set)
@ -60,4 +60,3 @@ $XTRACE
## Local variables:
## mode: shell-script
## End:

4
playbooks/devstack/post.yaml

@ -0,0 +1,4 @@
- hosts: all
roles:
- fetch-stestr-output
- devstack-config

10
playbooks/devstack/pre.yaml

@ -0,0 +1,10 @@
- hosts: all
roles:
- run-devstack
- setup-default-vim
- role: bindep
bindep_profile: test
bindep_dir: "{{ zuul_work_dir }}"
- ensure-tox
- role: tox-siblings
when: tox_install_siblings

3
playbooks/devstack/run.yaml

@ -0,0 +1,3 @@
- hosts: all
roles:
- tox

13
roles/devstack-config/tasks/main.yaml

@ -0,0 +1,13 @@
- name: Collect devstack stackenv file
fetch:
flat: yes
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/-stackenv"
src: "/opt/stack/devstack/.stackenv"
- name: Collect devstack config files
synchronize:
dest: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}/confs/devstack/"
mode: pull
src: "/opt/stack/devstack/{{ item }}"
with_items:
- local.conf

24
roles/setup-default-vim/tasks/main.yaml

@ -0,0 +1,24 @@
- name: Copy files test setup default vim sh
copy:
remote_src=True
src=/opt/stack/tacker/tools/test-setup-default-vim.sh
dest={{ zuul_work_dir }}/tools/test-setup-default-vim.sh
- name: Copy test vim file
copy:
remote_src=True
src=/opt/stack/tacker/tacker/tests/etc/samples/local-vim.yaml
dest={{ zuul_work_dir }}/tacker/tests/etc/samples/local-vim.yaml
- name: Check if project's tools/test-setup-default-vim.sh exists
stat:
path: "{{ zuul_work_dir }}/tools/test-setup-default-vim.sh"
register: p
- name: Run tools/test-setup-default-vim.sh
command: tools/test-setup-default-vim.sh
args:
chdir: "{{ zuul_work_dir }}"
when:
- p.stat.exists
- p.stat.executable

7
tools/test-setup-default-vim.sh

@ -0,0 +1,7 @@
#!/bin/bash -xe
# This script is used to set up default vim
# for functional testing, which cannot be put
# in devstack/plugin.sh because new zuul3 CI
# cannot keep the devstack plugins order

2
tox.ini

@ -4,7 +4,9 @@ minversion = 1.6
skipsdist = True
[testenv]
basepython = {env:TACKER_TOX_PYTHON:python2}
setenv = VIRTUAL_ENV={envdir}
passenv = UPPER_CONSTRAINTS_FILE
usedevelop = True
whitelist_externals = rm
install_command =

Loading…
Cancel
Save