summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan V <logan2211@gmail.com>2018-03-19 15:24:08 -0500
committerKevin Carter <kevin.carter@rackspace.com>2018-03-21 00:18:24 -0500
commitcebf3b34821f46e0ed250a3fad2657acc89ef9a0 (patch)
treeb770966f0d6fbdfee15a17859e8a581f9e86c0da
parentc348d0d0126c93c769dabcb05bc9dadd82aef6ae (diff)
Add base role tests
Depends-On: https://review.openstack.org/#/c/554402/ Change-Id: I3b270cc65aedaf9ef7375289b0ff7373b2c8d705 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
Notes
Notes (review): Code-Review+1: wangqi <wang.qi@99cloud.net> Code-Review+2: Kevin Carter (cloudnull) <kevin@cloudnull.com> Workflow+1: Kevin Carter (cloudnull) <kevin@cloudnull.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 21 Mar 2018 14:12:07 +0000 Reviewed-on: https://review.openstack.org/554350 Project: openstack/ansible-role-systemd_networkd Branch: refs/heads/master
-rw-r--r--bindep.txt41
-rw-r--r--doc/source/conf.py30
-rw-r--r--releasenotes/source/conf.py29
-rwxr-xr-xrun_tests.sh87
-rw-r--r--setup.cfg2
-rw-r--r--tasks/main.yml26
-rw-r--r--tests/test.yml87
-rwxr-xr-xtests/tests-repo-clone.sh117
-rw-r--r--vars/main.yml20
-rw-r--r--vars/redhat-7.yml17
-rw-r--r--zuul.d/project.yaml30
11 files changed, 383 insertions, 103 deletions
diff --git a/bindep.txt b/bindep.txt
index 59ab45d..5a05c5a 100644
--- a/bindep.txt
+++ b/bindep.txt
@@ -2,40 +2,51 @@
2# before the execution of any tests. 2# before the execution of any tests.
3# 3#
4# See the following for details: 4# See the following for details:
5# - http://docs.openstack.org/infra/bindep/ 5# - https://docs.openstack.org/infra/bindep/
6# - https://github.com/openstack-infra/bindep 6# - https://git.openstack.org/cgit/openstack-infra/bindep
7# 7#
8# Even if the role does not make use of this facility, it 8# Even if the role does not make use of this facility, it
9# is better to have this file empty, otherwise OpenStack-CI 9# is better to have this file empty, otherwise OpenStack-CI
10# will fall back to installing its default packages which 10# will fall back to installing its default packages which
11# will potentially be detrimental to the tests executed. 11# will potentially be detrimental to the tests executed.
12#
13# Note:
14# This file is maintained in the openstack-ansible-tests repository.
15# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/bindep.txt
16# If you need to remove or add extra dependencies, you should modify
17# the central file instead and once your change is accepted then update
18# this file as well. The purpose of this file is to ensure that Python and
19# Ansible have all their necessary binary requirements on the test host before
20# tox executes. Any binary requirements needed by services/roles should be
21# installed by those roles in their applicable package install tasks, not through
22# using this file.
23#
24
25# The gcc compiler
26gcc
12 27
13# Base requirements for Ubuntu 28# Base requirements for Ubuntu
14build-essential [platform:dpkg]
15git-core [platform:dpkg] 29git-core [platform:dpkg]
16libssl-dev [platform:dpkg] 30libssl-dev [platform:dpkg]
17libffi-dev [platform:dpkg] 31libffi-dev [platform:dpkg]
18python2.7 [platform:dpkg] 32python2.7 [platform:dpkg]
33python-apt [platform:dpkg]
19python-dev [platform:dpkg] 34python-dev [platform:dpkg]
35python3 [platform:dpkg]
36python3-apt [platform:dpkg]
37python3-dev [platform:dpkg]
20 38
21# Base requirements for CentOS 39# Base requirements for RPM distros
22gcc [platform:rpm]
23gcc-c++ [platform:rpm] 40gcc-c++ [platform:rpm]
24git [platform:rpm] 41git [platform:rpm]
25python-devel [platform:rpm]
26libffi-devel [platform:rpm] 42libffi-devel [platform:rpm]
27openssl-devel [platform:rpm] 43openssl-devel [platform:rpm]
44python-devel [platform:rpm]
45python2-dnf [platform:fedora]
28 46
29# For SELinux 47# For SELinux
30libselinux-python [platform:rpm] 48libselinux-python [platform:redhat]
31 49libsemanage-python [platform:redhat]
32# For SSL SNI support
33python-pyasn1 [platform:dpkg]
34python-openssl [platform:dpkg]
35python-ndg-httpsclient [platform:ubuntu !platform:ubuntu-trusty]
36python2-pyasn1 [platform:rpm]
37python2-pyOpenSSL [platform:rpm]
38python-ndg_httpsclient [platform:rpm]
39 50
40# Required for compressing collected log files in CI 51# Required for compressing collected log files in CI
41gzip 52gzip
diff --git a/doc/source/conf.py b/doc/source/conf.py
index dc68a3e..b711b39 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -22,7 +22,6 @@
22# All configuration values have a default; values that are commented out 22# All configuration values have a default; values that are commented out
23# serve to show the default. 23# serve to show the default.
24 24
25import openstackdocstheme
26import pbr.version 25import pbr.version
27import os 26import os
28 27
@@ -40,8 +39,8 @@ import os
40# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 39# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
41# ones. 40# ones.
42extensions = [ 41extensions = [
42 'openstackdocstheme',
43 'sphinx.ext.autodoc', 43 'sphinx.ext.autodoc',
44 'oslosphinx',
45 'sphinxmark' 44 'sphinxmark'
46] 45]
47 46
@@ -62,15 +61,17 @@ master_doc = 'index'
62# General information about the project. 61# General information about the project.
63author = 'OpenStack-Ansible Contributors' 62author = 'OpenStack-Ansible Contributors'
64category = 'Miscellaneous' 63category = 'Miscellaneous'
65copyright = '2014-2018, OpenStack-Ansible Contributors' 64copyright = '2014-2016, OpenStack-Ansible Contributors'
66description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.' 65description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.'
67project = 'OpenStack-Ansible' 66project = 'OpenStack-Ansible'
68role_name = 'os_nova' 67role_name = 'systemd_networkd'
69target_name = 'openstack-ansible-' + role_name 68target_name = 'openstack-ansible-' + role_name
70title = 'OpenStack-Ansible Documentation: ' + role_name + 'role' 69title = 'OpenStack-Ansible Documentation: ' + role_name + 'role'
71 70
72# The link to the browsable source code (for the left hand menu) 71# The link to the browsable source code (for the left hand menu)
73oslosphinx_cgit_link = 'https://git.openstack.org/cgit/openstack/' + target_name 72oslosphinx_cgit_link = (
73 "https://git.openstack.org/cgit/openstack/{}".format(target_name)
74)
74 75
75# The version info for the project you're documenting, acts as replacement for 76# The version info for the project you're documenting, acts as replacement for
76# |version| and |release|, also used in various other places throughout the 77# |version| and |release|, also used in various other places throughout the
@@ -83,21 +84,10 @@ release = version_info.version_string_with_vcs()
83# The short X.Y version. 84# The short X.Y version.
84version = version_info.canonical_version_string() 85version = version_info.canonical_version_string()
85 86
86# A few variables have to be set for the log-a-bug feature. 87# openstackdocstheme options
87# giturl: The location of conf.py on Git. Must be set manually. 88repository_name = 'openstack/' + target_name
88# gitsha: The SHA checksum of the bug description.
89# Automatically extracted from git log.
90# bug_tag: Tag for categorizing the bug. Must be set manually.
91# These variables are passed to the logabug code via html_context.
92giturl = ("https://git.openstack.org/cgit/openstack/{0}"
93 "/tree/doc/source").format(target_name)
94git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
95gitsha = os.popen(git_cmd).read().strip('\n')
96bug_project = project.lower() 89bug_project = project.lower()
97bug_title = "Documentation bug" 90bug_tag = ''
98html_context = {"gitsha": gitsha, "giturl": giturl,
99 "bug_tag": "docs", "bug_title": bug_title,
100 "bug_project": bug_project}
101 91
102# The language for content autogenerated by Sphinx. Refer to documentation 92# The language for content autogenerated by Sphinx. Refer to documentation
103# for a list of supported languages. 93# for a list of supported languages.
@@ -156,7 +146,7 @@ html_theme = 'openstackdocs'
156# html_theme_options = {} 146# html_theme_options = {}
157 147
158# Add any paths that contain custom themes here, relative to this directory. 148# Add any paths that contain custom themes here, relative to this directory.
159html_theme_path = [openstackdocstheme.get_html_theme_path()] 149# html_theme_path = []
160 150
161# The name for this set of Sphinx documents. If None, it defaults to 151# The name for this set of Sphinx documents. If None, it defaults to
162# "<project> v<release> documentation". 152# "<project> v<release> documentation".
diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py
index 5034fb4..fb2a460 100644
--- a/releasenotes/source/conf.py
+++ b/releasenotes/source/conf.py
@@ -22,8 +22,6 @@
22# All configuration values have a default; values that are commented out 22# All configuration values have a default; values that are commented out
23# serve to show the default. 23# serve to show the default.
24 24
25import pbr.version
26
27# If extensions (or modules to document with autodoc) are in another directory, 25# If extensions (or modules to document with autodoc) are in another directory,
28# add these directories to sys.path here. If the directory is relative to the 26# add these directories to sys.path here. If the directory is relative to the
29# documentation root, use os.path.abspath to make it absolute, like shown here. 27# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -38,7 +36,7 @@ import pbr.version
38# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 36# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
39# ones. 37# ones.
40extensions = [ 38extensions = [
41 'oslosphinx', 39 'openstackdocstheme',
42 'reno.sphinxext', 40 'reno.sphinxext',
43] 41]
44 42
@@ -57,7 +55,7 @@ master_doc = 'index'
57# General information about the project. 55# General information about the project.
58author = 'OpenStack-Ansible Contributors' 56author = 'OpenStack-Ansible Contributors'
59category = 'Miscellaneous' 57category = 'Miscellaneous'
60copyright = '2014-2018, OpenStack-Ansible Contributors' 58copyright = '2014-2016, OpenStack-Ansible Contributors'
61description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.' 59description = 'OpenStack-Ansible deploys OpenStack environments using Ansible.'
62project = 'OpenStack-Ansible' 60project = 'OpenStack-Ansible'
63role_name = 'systemd_networkd' 61role_name = 'systemd_networkd'
@@ -65,18 +63,21 @@ target_name = 'openstack-ansible-' + role_name
65title = 'OpenStack-Ansible Release Notes: ' + role_name + 'role' 63title = 'OpenStack-Ansible Release Notes: ' + role_name + 'role'
66 64
67# The link to the browsable source code (for the left hand menu) 65# The link to the browsable source code (for the left hand menu)
68oslosphinx_cgit_link = 'https://git.openstack.org/cgit/openstack/' + target_name 66oslosphinx_cgit_link = (
67 "https://git.openstack.org/cgit/openstack/{}".format(target_name)
68)
69 69
70# The version info for the project you're documenting, acts as replacement for 70# Release notes do not need a version number in the title,
71# |version| and |release|, also used in various other places throughout the 71# they cover multiple versions.
72# built documents.
73#
74# The short X.Y version.
75version_info = pbr.version.VersionInfo(target_name)
76# The full version, including alpha/beta/rc tags. 72# The full version, including alpha/beta/rc tags.
77release = version_info.version_string_with_vcs() 73release = ''
78# The short X.Y version. 74# The short X.Y version.
79version = version_info.canonical_version_string() 75version = ''
76
77# openstackdocstheme options
78repository_name = 'openstack/' + target_name
79bug_project = project.lower()
80bug_tag = ''
80 81
81# The language for content autogenerated by Sphinx. Refer to documentation 82# The language for content autogenerated by Sphinx. Refer to documentation
82# for a list of supported languages. 83# for a list of supported languages.
@@ -121,7 +122,7 @@ pygments_style = 'sphinx'
121 122
122# The theme to use for HTML and HTML Help pages. See the documentation for 123# The theme to use for HTML and HTML Help pages. See the documentation for
123# a list of builtin themes. 124# a list of builtin themes.
124html_theme = 'default' 125html_theme = 'openstackdocs'
125 126
126# Theme options are theme-specific and customize the look and feel of a theme 127# Theme options are theme-specific and customize the look and feel of a theme
127# further. For a list of options available for each theme, see the 128# further. For a list of options available for each theme, see the
diff --git a/run_tests.sh b/run_tests.sh
index ca109b8..4b72d3f 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -1,5 +1,5 @@
1#!/usr/bin/env bash 1#!/usr/bin/env bash
2# Copyright 2018, Rackspace US, Inc. 2# Copyright 2015, Rackspace US, Inc.
3# 3#
4# Licensed under the Apache License, Version 2.0 (the "License"); 4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License. 5# you may not use this file except in compliance with the License.
@@ -12,63 +12,48 @@
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and 13# See the License for the specific language governing permissions and
14# limitations under the License. 14# limitations under the License.
15#
16# Note:
17# This file is maintained in the openstack-ansible-tests repository.
18# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/run_tests.sh
19# If you need to modify this file, update the one in the openstack-ansible-tests
20# repository and then update this file as well. The purpose of this file is to
21# prepare the host and then execute all the tox tests.
22#
23
24## Shell Opts ----------------------------------------------------------------
25set -xeu
26
27## Vars ----------------------------------------------------------------------
28
29export WORKING_DIR=${WORKING_DIR:-$(pwd)}
15 30
16set -xeuo pipefail 31## Main ----------------------------------------------------------------------
17 32
18FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true} 33source /etc/os-release || source /usr/lib/os-release
19 34
20# Install python2 for Ubuntu 16.04 and CentOS 7 35install_pkg_deps() {
21if which apt-get; then 36 pkg_deps="git"
22 sudo apt-get update && sudo apt-get install -y python
23fi
24 37
25if which yum; then 38 # Prefer dnf over yum for CentOS.
26 sudo yum install -y python 39 which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum'
27fi
28 40
29# Install pip. 41 case ${ID,,} in
30if ! which pip; then 42 *suse*) pkg_mgr_cmd="zypper -n in" ;;
31 curl --silent --show-error --retry 5 \ 43 centos|rhel|fedora) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;;
32 https://bootstrap.pypa.io/get-pip.py | sudo python2.7 44 ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
33fi 45 *) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
46 esac
34 47
35# Install bindep and tox with pip. 48 eval sudo $pkg_mgr_cmd $pkg_deps
36sudo pip install bindep tox 49}
37 50
38# CentOS 7 requires two additional packages: 51# Install the host distro package dependencies
39# redhat-lsb-core - for bindep profile support 52install_pkg_deps
40# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
41if which yum; then
42 sudo yum -y install redhat-lsb-core epel-release
43fi
44 53
45# Get a list of packages to install with bindep. If packages need to be 54# Clone the tests repo for access to the common test script
46# installed, bindep exits with an exit code of 1. 55source tests/tests-repo-clone.sh
47BINDEP_PKGS=$(bindep -b -f bindep.txt test || true)
48echo "Packages to install: ${BINDEP_PKGS}"
49 56
50# Install a list of OS packages provided by bindep. 57# Execute the common test script
51if which apt-get; then 58source tests/common/run_tests_common.sh
52 sudo apt-get update
53 DEBIAN_FRONTEND=noninteractive \
54 sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
55 --assume-yes install $BINDEP_PKGS
56elif which yum; then
57 # Don't run yum with an empty list of packages.
58 # It will fail and cause the script to exit with an error.
59 if [[ ${#BINDEP_PKGS} > 0 ]]; then
60 sudo yum install -y $BINDEP_PKGS
61 fi
62fi
63 59
64# Loop through each tox environment and run tests.
65for tox_env in $(awk -F= '/envlist/ { gsub(",", " "); print $2 }' tox.ini); do
66 echo "Executing tox environment: ${tox_env}"
67 if [[ ${tox_env} == ansible-functional ]]; then
68 if ${FUNCTIONAL_TEST}; then
69 tox -e ${tox_env}
70 fi
71 else
72 tox -e ${tox_env}
73 fi
74done
diff --git a/setup.cfg b/setup.cfg
index 1f21389..4d99b64 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,7 @@
2name = systemd_networkd 2name = systemd_networkd
3summary = systemd_networkd for OpenStack Ansible 3summary = systemd_networkd for OpenStack Ansible
4description-file = 4description-file =
5 README.rst 5 README.md
6author = OpenStack 6author = OpenStack
7author-email = openstack-dev@lists.openstack.org 7author-email = openstack-dev@lists.openstack.org
8home-page = http://docs.openstack.org/developer/ansible-systemd_networkd/ 8home-page = http://docs.openstack.org/developer/ansible-systemd_networkd/
diff --git a/tasks/main.yml b/tasks/main.yml
index 8ecce4c..052acd4 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -13,6 +13,32 @@
13# See the License for the specific language governing permissions and 13# See the License for the specific language governing permissions and
14# limitations under the License. 14# limitations under the License.
15 15
16- name: Gather variables for each operating system
17 include_vars: "{{ item }}"
18 with_first_found:
19 - files:
20 - "{{ ansible_distribution | lower }}-{{ ansible_distribution_version | lower }}.yml"
21 - "{{ ansible_distribution | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
22 - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version | lower }}.yml"
23 - "{{ ansible_distribution | lower }}.yml"
24 - "{{ ansible_os_family | lower }}.yml"
25 skip: true
26 tags:
27 - always
28
29- name: Install networkd distro packages
30 package:
31 name: "{{ systemd_networkd_distro_packages }}"
32 state: "present"
33 update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
34 cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(600, omit) }}"
35 when:
36 - systemd_networkd_distro_packages | length > 0
37 register: install_packages
38 until: install_packages|success
39 retries: 3
40 delay: 2
41
16- name: Create systemd-networkd directory 42- name: Create systemd-networkd directory
17 file: 43 file:
18 path: "/etc/systemd/network" 44 path: "/etc/systemd/network"
diff --git a/tests/test.yml b/tests/test.yml
index 5c34458..544b2e2 100644
--- a/tests/test.yml
+++ b/tests/test.yml
@@ -1,5 +1,6 @@
1--- 1---
2# Copyright 2018, Rackspace US, Inc. 2# Copyright 2018, Rackspace US, Inc.
3# Copyright 2018, Logan Vig <logan2211@gmail.com>
3# 4#
4# Licensed under the Apache License, Version 2.0 (the "License"); 5# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License. 6# you may not use this file except in compliance with the License.
@@ -13,7 +14,89 @@
13# See the License for the specific language governing permissions and 14# See the License for the specific language governing permissions and
14# limitations under the License. 15# limitations under the License.
15 16
16- hosts: localhost 17- name: Playbook for role testing
18 hosts: localhost
19 connection: local
20 become: true
21 gather_facts: true
22 roles:
23 - role: "systemd_networkd"
24 post_tasks:
25 # Pause for 5 minutes to build app cache.
26 - name: Allow networkd to spin up
27 pause:
28 seconds: 15
29 vars:
30 systemd_networkd_distro_packages:
31 yum:
32 - systemd-networkd
33 systemd_run_networkd: yes
34 systemd_netdevs:
35 - NetDev:
36 Name: dummy0
37 Kind: dummy
38 - NetDev:
39 Name: dummy1
40 Kind: dummy
41 - NetDev:
42 Name: bond0
43 Kind: bond
44 Bond:
45 Mode: 802.3ad
46 TransmitHashPolicy: layer3+4
47 MIIMonitorSec: 1s
48 LACPTransmitRate: fast
49 - NetDev:
50 Name: br-dummy
51 Kind: bridge
52 systemd_networks:
53 - interface: "dummy0"
54 bond: "bond0"
55 mtu: 9000
56 - interface: "dummy1"
57 bond: "bond0"
58 mtu: 9000
59 - interface: "bond0"
60 bridge: "br-dummy"
61 mtu: 9000
62 - interface: "br-dummy"
63 address: "10.0.0.100"
64 netmask: "255.255.255.0"
65 gateway: "10.0.0.1"
66 mtu: 9000
67 usedns: true
68 static_routes:
69 - gateway: "10.1.0.1"
70 cidr: "10.1.0.0/24"
71 config_overrides:
72 Network:
73 ConfigureWithoutCarrier: true
74
75- name: Test networkd
76 hosts: localhost
77 connection: local
78 become: true
17 gather_facts: true 79 gather_facts: true
18 tasks: 80 tasks:
19 - debug: msg=testing \ No newline at end of file 81 - name: Interface check
82 assert:
83 that:
84 - ansible_dummy0['active'] == true
85 - ansible_dummy0['type'] == 'ether'
86 - ansible_dummy0['mtu'] == 9000
87 - ansible_dummy1['active'] == true
88 - ansible_dummy1['type'] == 'ether'
89 - ansible_dummy1['mtu'] == 9000
90 - name: Bond check
91 assert:
92 that:
93 - ansible_bond0['active'] == true
94 - ansible_bond0['type'] == 'bonding'
95 - ansible_bond0['mtu'] == 9000
96 - name: Bridge check
97 assert:
98 that:
99 - ansible_br_dummy['active'] == true
100 - ansible_br_dummy['type'] == 'bridge'
101 - ansible_br_dummy['ipv4']['address'] == '10.0.0.100'
102 - ansible_br_dummy['ipv4']['netmask'] == '255.255.255.0'
diff --git a/tests/tests-repo-clone.sh b/tests/tests-repo-clone.sh
new file mode 100755
index 0000000..5ad509c
--- /dev/null
+++ b/tests/tests-repo-clone.sh
@@ -0,0 +1,117 @@
1#!/bin/bash
2# Copyright 2017, Rackspace US, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# PURPOSE:
17# This script clones the openstack-ansible-tests repository to the
18# tests/common folder in order to be able to re-use test components
19# for role testing.
20
21# WARNING:
22# This file is maintained in the openstack-ansible-tests repository:
23# https://git.openstack.org/cgit/openstack/openstack-ansible-tests
24# If you need to change this script, then propose the change there.
25# Once it merges, the change will be replicated to the other repositories.
26
27## Shell Opts ----------------------------------------------------------------
28
29set -e
30
31## Vars ----------------------------------------------------------------------
32
33export TESTING_HOME=${TESTING_HOME:-$HOME}
34export WORKING_DIR=${WORKING_DIR:-$(pwd)}
35export CLONE_UPGRADE_TESTS=${CLONE_UPGRADE_TESTS:-no}
36export ZUUL_TESTS_CLONE_LOCATION="/home/zuul/src/git.openstack.org/openstack/openstack-ansible-tests"
37
38## Functions -----------------------------------------------------------------
39
40function create_tests_clonemap {
41
42# Prepare the clonemap for zuul-cloner to use
43cat > ${TESTING_HOME}/tests-clonemap.yaml << EOF
44clonemap:
45 - name: openstack/openstack-ansible-tests
46 dest: ${WORKING_DIR}/tests/common
47EOF
48
49}
50
51## Main ----------------------------------------------------------------------
52
53# If zuul-cloner is present, use it so that we
54# also include any dependent patches from the
55# tests repo noted in the commit message.
56# We only want to use zuul-cloner if we detect
57# zuul v2 running, so we check for the presence
58# of the ZUUL_REF environment variable.
59# ref: http://git.openstack.org/cgit/openstack-infra/zuul/tree/zuul/ansible/filter/zuul_filters.py?h=feature/zuulv3#n17
60if [[ -x /usr/zuul-env/bin/zuul-cloner ]] && [[ "${ZUUL_REF:-none}" != "none" ]]; then
61
62 # Prepare the clonemap for zuul-cloner to use
63 create_tests_clonemap
64
65 # Execute the clone
66 /usr/zuul-env/bin/zuul-cloner \
67 --cache-dir /opt/git \
68 --map ${TESTING_HOME}/tests-clonemap.yaml \
69 git://git.openstack.org \
70 openstack/openstack-ansible-tests
71
72 # Clean up the clonemap.
73 rm -f ${TESTING_HOME}/tests-clonemap.yaml
74
75# Alternatively, use a simple git-clone. We do
76# not re-clone if the directory exists already
77# to prevent overwriting any local changes which
78# may have been made.
79elif [[ ! -d tests/common ]]; then
80
81 # The tests repo doesn't need a clone, we can just
82 # symlink it. As zuul v3 clones into a folder called
83 # 'workspace' we have to use one of its environment
84 # variables to determine the project name.
85 if [[ "${ZUUL_SHORT_PROJECT_NAME:-none}" == "openstack-ansible-tests" ]] ||\
86 [[ "$(basename ${WORKING_DIR})" == "openstack-ansible-tests" ]]; then
87 ln -s ${WORKING_DIR} ${WORKING_DIR}/tests/common
88
89 # In zuul v3 any dependent repository is placed into
90 # /home/zuul/src/git.openstack.org, so we check to see
91 # if there is a tests checkout there already. If so, we
92 # symlink that and use it.
93 elif [[ -d "${ZUUL_TESTS_CLONE_LOCATION}" ]]; then
94 ln -s "${ZUUL_TESTS_CLONE_LOCATION}" ${WORKING_DIR}/tests/common
95
96 # Otherwise we're clearly not in zuul or using a previously setup
97 # repo in some way, so just clone it from upstream.
98 else
99 git clone \
100 https://git.openstack.org/openstack/openstack-ansible-tests \
101 ${WORKING_DIR}/tests/common
102 fi
103fi
104
105# If this test set includes an upgrade test, the
106# previous stable release tests repo must also be
107# cloned.
108# Note:
109# Dependent patches to the previous stable release
110# tests repo are not supported.
111if [[ "${CLONE_UPGRADE_TESTS}" == "yes" ]]; then
112 if [[ ! -d "${WORKING_DIR}/tests/common/previous" ]]; then
113 git clone -b stable/queens \
114 https://git.openstack.org/openstack/openstack-ansible-tests \
115 ${WORKING_DIR}/tests/common/previous
116 fi
117fi
diff --git a/vars/main.yml b/vars/main.yml
new file mode 100644
index 0000000..b8f0239
--- /dev/null
+++ b/vars/main.yml
@@ -0,0 +1,20 @@
1---
2# Copyright 2018, Logan Vig <logan2211@gmail.com>
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16## APT Cache options
17cache_timeout: 600
18
19# Supporting package required to make systemd-networkd function
20systemd_networkd_distro_packages: []
diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml
new file mode 100644
index 0000000..2aaa301
--- /dev/null
+++ b/vars/redhat-7.yml
@@ -0,0 +1,17 @@
1---
2# Copyright 2018, Logan Vig <logan2211@gmail.com>
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16systemd_networkd_distro_packages:
17 - systemd-networkd
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
new file mode 100644
index 0000000..6d4e2f4
--- /dev/null
+++ b/zuul.d/project.yaml
@@ -0,0 +1,30 @@
1# Copyright 2017, Rackspace US, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15- project:
16 check:
17 jobs:
18 - openstack-ansible-linters
19 - openstack-ansible-functional-centos-7
20 - openstack-ansible-functional-opensuse-423
21 - openstack-ansible-functional-ubuntu-xenial
22 experimental:
23 jobs:
24 - openstack-ansible-integrated-deploy-aio
25 gate:
26 jobs:
27 - openstack-ansible-linters
28 - openstack-ansible-functional-centos-7
29 - openstack-ansible-functional-opensuse-423
30 - openstack-ansible-functional-ubuntu-xenial