Add minimal functional gate

Change-Id: Ibb758b2e5a7f8bccffe307932aa4f472687f7acb
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-02-22 16:43:19 -06:00 committed by Kevin Carter (cloudnull)
parent 774688ca92
commit 84e471264a
8 changed files with 153 additions and 30 deletions

View File

@ -33,4 +33,5 @@ galaxy_info:
- python
- development
- openstack
dependencies: []
dependencies:
- plugins

View File

@ -10,7 +10,11 @@
src: https://git.openstack.org/openstack/openstack-ansible-openstack_hosts
scm: git
version: master
- name: lxc_hosts
src: https://git.openstack.org/openstack/openstack-ansible-lxc_hosts
- name: nspawn_hosts
src: https://git.openstack.org/openstack/openstack-ansible-nspawn_hosts
scm: git
version: master
- name: plugins
src: https://git.openstack.org/openstack/openstack-ansible-plugins
scm: git
version: master

View File

@ -13,13 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Gather nspawn container host facts
hosts: "localhost"
gather_facts: true
- name: Create container(s)
hosts: "{{ container_group|default('all_containers') }}"
gather_facts: false
user: root
roles:
- role: "nspawn_container_create"
container_networks:
management_address:
address: "{{ ansible_host | default('localhost') }}"
bridge: "br-mgmt"
interface: "eth1"
netmask: "255.255.252.0"
type: "veth"
static_routes:
- cidr: 10.100.100.0/24
gateway: 10.100.100.1

View File

@ -15,17 +15,6 @@
container_name: "{{ inventory_hostname }}"
container_networks:
management_address:
address: "{{ ansible_host }}"
bridge: "br-mgmt"
interface: "eth1"
netmask: "255.255.252.0"
type: "veth"
static_routes:
- cidr: 10.100.100.0/24
gateway: 10.100.100.1
properties:
service_name: "{{ inventory_hostname }}"

View File

@ -17,3 +17,5 @@ bridges:
- "br-mgmt"
ansible_python_interpreter: "/usr/bin/python2"
physical_host: localhost

View File

@ -13,11 +13,79 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Prepare the user ssh keys
- include: common/test-prepare-keys.yml
- name: Playbook for role testing
hosts: localhost
connection: local
become: true
pre_tasks:
- name: Show host facts
debug:
var: hostvars
# Prepare the host
- include: common/test-prepare-host.yml
- name: First ensure apt cache is always refreshed
apt:
update_cache: yes
when:
- ansible_pkg_mgr == 'apt'
# Test container creation
- include: test-containers-create.yml
- name: Ensure root ssh key
user:
name: "{{ ansible_env.USER | default('root') }}"
generate_ssh_key: "yes"
ssh_key_bits: 2048
ssh_key_file: ".ssh/id_rsa"
- name: Get root ssh key
slurp:
src: '~/.ssh/id_rsa.pub'
register: _root_ssh_key
- name: Prepare container ssh key fact
set_fact:
nspawn_container_ssh_key: "{{ _root_ssh_key['content'] | b64decode }}"
# This is a very dirty hack due to images.linuxcontainers.org
# constantly failing to resolve in openstack-infra.
- name: Implement hard-coded hosts entries for consistently failing name
lineinfile:
path: "/etc/hosts"
line: "{{ item }}"
state: present
with_items:
- "91.189.91.21 images.linuxcontainers.org us.images.linuxcontainers.org"
- "91.189.88.37 images.linuxcontainers.org uk.images.linuxcontainers.org"
# This is a temporary hack to override the nspawn image source to
# the reverse proxy if the test is run in OpenStack-Infra.
- name: Check if this is an OpenStack-CI nodepool instance
stat:
path: /etc/nodepool/provider
register: nodepool
- name: Discover the nspawn_image_cache_server value when in nodepool
shell: |
source /etc/ci/mirror_info.sh
echo "${NODEPOOL_MIRROR_HOST}:8080/images.linuxcontainers"
args:
executable: /bin/bash
register: nspawn_reverse_proxy
when:
- nodepool.stat.exists | bool
tags:
- skip_ansible_lint
- name: Set a fact to override nspawn_image_cache_server value when in nodepool
set_fact:
nspawn_image_cache_server_mirrors: ["http://{{ nspawn_reverse_proxy.stdout.strip('/') }}"]
when:
- nodepool.stat.exists | bool
roles:
- role: "nspawn_hosts"
- name: Create container(s)
hosts: "all_containers"
gather_facts: false
user: root
roles:
- role: "nspawn_container_create"

29
zuul.d/jobs.yaml Normal file
View File

@ -0,0 +1,29 @@
---
# Copyright 2017, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- job:
name: openstack-ansible-nspawn-ubuntu-xenial
parent: openstack-ansible-functional
nodeset: ubuntu-xenial
- job:
name: openstack-ansible-nspawn-centos-7
parent: openstack-ansible-functional
nodeset: centos-7
# - job:
# name: openstack-ansible-nspawn-opensuse-423
# parent: openstack-ansible-functional
# nodeset: opensuse-423

30
zuul.d/project.yaml Normal file
View File

@ -0,0 +1,30 @@
# Copyright 2017, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- project:
check:
jobs:
- openstack-ansible-linters
- openstack-ansible-nspawn-ubuntu-xenial
- openstack-ansible-nspawn-centos-7
# - openstack-ansible-nspawn-opensuse-423
experimental:
jobs:
- openstack-ansible-integrated-deploy-aio
gate:
jobs:
- openstack-ansible-linters
- openstack-ansible-nspawn-ubuntu-xenial
- openstack-ansible-nspawn-centos-7
# - openstack-ansible-nspawn-opensuse-423