Add zuul tests in-tree

This allows us to gate properly with windmill-jobs.

Change-Id: I23a072da89791666bc711d785344ba88d206710c
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2018-12-04 11:29:54 -05:00
parent 9b1db346a4
commit da91ffc022
5 changed files with 47 additions and 28 deletions

39
.zuul.yaml Normal file
View File

@ -0,0 +1,39 @@
---
- job:
name: ansible-role-sudoers
run: tests/playbooks/run.yaml
roles:
- zuul: openstack/ansible-role-sudoers
- job:
name: ansible-role-sudoers-fedora-latest
parent: ansible-role-sudoers
nodeset: fedora-latest
- job:
name: ansible-role-sudoers-ubuntu-bionic
parent: ansible-role-sudoers
nodeset: ubuntu-bionic
- job:
name: ansible-role-sudoers-ubuntu-xenial
parent: ansible-role-sudoers
nodeset: ubuntu-xenial
- project:
templates:
- windmill-jobs-fedora-latest
- windmill-jobs-bionic
- windmill-jobs-xenial
check:
jobs:
- ansible-role-sudoers-fedora-latest
- ansible-role-sudoers-ubuntu-bionic
- ansible-role-sudoers-ubuntu-xenial
- tox-linters
gate:
jobs:
- ansible-role-sudoers-fedora-latest
- ansible-role-sudoers-ubuntu-bionic
- ansible-role-sudoers-ubuntu-xenial
- tox-linters

View File

@ -1,2 +0,0 @@
[defaults]
roles_path = ../..

View File

@ -1,2 +1 @@
[all] localhost
localhost ansible_connection=local

View File

@ -1,4 +1,4 @@
# Copyright 2015 Red Hat, Inc. # Copyright 2018 Red Hat, Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -12,16 +12,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
--- ---
- hosts: localhost - hosts: all
vars: vars:
rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}" rolename: ansible-role-sudoers
pre_tasks:
# Make sure OS does not have a stale package cache.
- name: Update apt cache.
become: yes
apt:
update_cache: yes
when: ansible_os_family == 'Debian'
roles: roles:
- "{{ rolename }}" - "{{ rolename }}"

18
tox.ini
View File

@ -4,20 +4,10 @@ envlist = docs,linters
skipsdist = True skipsdist = True
[testenv] [testenv]
basepython = python3
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
[testenv:functional]
commands =
# NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-playbook -i tests/inventory tests/test.yaml -e ansible_user={env:USER}
passenv =
HOME
USER
setenv =
ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
PYTHONUNBUFFERED = 1
[testenv:docs] [testenv:docs]
commands = python setup.py build_sphinx commands = python setup.py build_sphinx
@ -34,14 +24,14 @@ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
[testenv:linters] [testenv:linters]
setenv = setenv =
ANSIBLE_CONFIG = tests/ansible.cfg ANSIBLE_ROLES_PATH = ..
whitelist_externals = bash whitelist_externals = bash
commands = commands =
# PEP8 Lint Check # PEP8 Lint Check
flake8 flake8
# Ansible Lint Check # Ansible Lint Check
bash -c "find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \ bash -c "find . -not -path '*/\.*' -type f -regex '.*.y[a]?ml' -print0 | \
ansible-lint" xargs -t -n1 -0 ansible-lint"
# Ansible Syntax Check # Ansible Syntax Check
bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \ bash -c "find tests -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \
ansible-playbook --syntax-check -i tests/inventory \ ansible-playbook --syntax-check -i tests/inventory \