Test gitea project creation playbook

Add an option to run a playbook (in the fake bridge context) after
running the base playbook.  Use this to run a new playbook which
exercises gitea project creation after bootstrapping the gitea
service.

Disable ansible-lint 304 because it erroneously thinks shell and
command are the same thing.

Change-Id: I0394b614771bc62b9fe23d811defd7767b3d10db
This commit is contained in:
James E. Blair 2019-03-05 15:24:24 -08:00 committed by Monty Taylor
parent 853b7c2d66
commit 9ff29b108d
4 changed files with 37 additions and 1 deletions

View File

@ -513,6 +513,8 @@
label: ubuntu-bionic
- name: gitea01.opendev.org
label: ubuntu-bionic
vars:
run_base_test_playbook: playbooks/zuul/test-gitea.yaml
host-vars:
gitea01.opendev.org:
host_copy_output:

View File

@ -69,6 +69,9 @@
command: ansible localhost -m debug -a 'var=groups'
- name: Run base.yaml
command: ansible-playbook -v /home/zuul/src/git.openstack.org/openstack-infra/system-config/playbooks/base.yaml
- name: Run test playbook
when: run_base_test_playbook is defined
shell: "ANSIBLE_ROLES_PATH=/home/zuul/src/git.openstack.org/openstack-infra/system-config/playbooks/roles ansible-playbook -v /home/zuul/src/git.openstack.org/openstack-infra/system-config/{{ run_base_test_playbook }}"
- name: Run testinfra to validate configuration
include_role:
name: tox

View File

@ -0,0 +1,30 @@
- hosts: "localhost"
name: "Setup test project data"
vars:
projects:
- project: opendev/base-jobs
description: Zuul configuration common to all OpenDev tenants
tasks:
- name: Create test project-config directory
file:
path: "/opt/project-config/gerrit/"
state: directory
- name: Write test project configuration
copy:
dest: "/opt/project-config/gerrit/projects.yaml"
content: "{{ projects }}"
- hosts: "gitea"
name: "Create repos on gitea servers"
strategy: free
max_fail_percentage: 1
roles:
- role: gitea-git-repos
- hosts: "gitea"
tasks:
- name: Test project was created in gitea
uri:
url: "https://localhost:3000/opendev/base-jobs"
validate_certs: false
status_code: 200

View File

@ -24,7 +24,8 @@ commands =
# We often deploy latest pip packages
bash -c "find roles playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \
ansible-lint -x ANSIBLE0004 -x ANSIBLE0006 -x ANSIBLE0007 -x ANSIBLE0010 \
-x ANSIBLE0011 -x ANSIBLE0012 -x ANSIBLE0013 -x ANSIBLE0015"
-x ANSIBLE0011 -x ANSIBLE0012 -x ANSIBLE0013 -x ANSIBLE0015 \
-x 304"
[testenv:venv]
commands = {posargs}