Add base role integration jobs
These are jobs for the roles in this repo which are currently tested by the "base-integration" job in openstack-zuul-jobs. Move it into this repo and rename it "base-roles". Change-Id: Ibd07964a08120e033bc5a2deca18649bd0e74a48
This commit is contained in:
parent
2f113a6889
commit
a4e1f29468
13
test-playbooks/base-roles/base.yaml
Normal file
13
test-playbooks/base-roles/base.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Roles that are part of the 'base' job
|
||||||
|
|
||||||
|
# If you add new tests, also update the files section in job
|
||||||
|
# base-integration in zuul.d/jobs.yaml.
|
||||||
|
|
||||||
|
# Note: set-zuul-log-path-fact is tested by emit-job-header.yaml
|
||||||
|
- include: emit-job-header.yaml
|
||||||
|
- include: ensure-output-dirs.yaml
|
||||||
|
- include: use-cached-repos.yaml
|
||||||
|
- include: configure-mirrors.yaml
|
||||||
|
- include: fetch-zuul-cloner.yaml
|
||||||
|
- include: validate-host.yaml
|
||||||
|
- include: fetch-output.yaml
|
16
test-playbooks/base-roles/configure-mirrors.yaml
Normal file
16
test-playbooks/base-roles/configure-mirrors.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
- name: Test the configure-mirrors role
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: configure-mirrors
|
||||||
|
mirror_fqdn: "{{ zuul_site_mirror_fqdn }}"
|
||||||
|
set_apt_mirrors_trusted: True
|
||||||
|
post_tasks:
|
||||||
|
- name: Set emacs package fact for gentoo
|
||||||
|
set_fact:
|
||||||
|
emacs_package: app-editors/emacs
|
||||||
|
when: ansible_distribution == 'Gentoo'
|
||||||
|
- name: Install a package to sanity check the mirror configuration
|
||||||
|
package:
|
||||||
|
name: "{{ emacs_package | default('emacs') }}"
|
||||||
|
state: "present"
|
||||||
|
become: yes
|
19
test-playbooks/base-roles/emit-job-header.yaml
Normal file
19
test-playbooks/base-roles/emit-job-header.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
- name: Test the emit-job-header role
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: emit-job-header
|
||||||
|
zuul_log_url: "http://logs.openstack.org"
|
||||||
|
post_tasks:
|
||||||
|
# All emit-job-header does is a debug statement so the worst that would
|
||||||
|
# happen would be that the debug task would fail outright and we'd prevent
|
||||||
|
# something breaking that debug statement from merging just by running it.
|
||||||
|
# However, the emit-job-header role includes the set-zuul-log-path-fact
|
||||||
|
# role. We can only test for zuul_log_path against changes, though.
|
||||||
|
- name: Assert zuul_log_path by set-zuul-log-path-fact for a change
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- zuul_log_path is defined
|
||||||
|
- zuul.change in zuul_log_path
|
||||||
|
- zuul.patchset in zuul_log_path
|
||||||
|
- zuul.pipeline in zuul_log_path
|
||||||
|
- zuul.job in zuul_log_path
|
32
test-playbooks/base-roles/ensure-output-dirs.yaml
Normal file
32
test-playbooks/base-roles/ensure-output-dirs.yaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
- name: Test the ensure-output-dirs role
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: ensure-output-dirs
|
||||||
|
post_tasks:
|
||||||
|
- name: Check that log dir has been created
|
||||||
|
file:
|
||||||
|
path: "{{ zuul_output_dir }}/logs"
|
||||||
|
state: directory
|
||||||
|
register: log_directory
|
||||||
|
|
||||||
|
- name: Check that artifact dir has been created
|
||||||
|
file:
|
||||||
|
path: "{{ zuul_output_dir }}/artifacts"
|
||||||
|
state: directory
|
||||||
|
register: artifact_directory
|
||||||
|
|
||||||
|
- name: Check that doc dir has been created
|
||||||
|
file:
|
||||||
|
path: "{{ zuul_output_dir }}/docs"
|
||||||
|
state: directory
|
||||||
|
register: doc_directory
|
||||||
|
|
||||||
|
- name: Validate that directories were set correctly
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- log_directory is not changed
|
||||||
|
- log_directory is succeeded
|
||||||
|
- artifact_directory is not changed
|
||||||
|
- artifact_directory is succeeded
|
||||||
|
- doc_directory is not changed
|
||||||
|
- doc_directory is succeeded
|
46
test-playbooks/base-roles/fetch-output.yaml
Normal file
46
test-playbooks/base-roles/fetch-output.yaml
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
- name: Run the fetch-output role
|
||||||
|
hosts: all
|
||||||
|
pre_tasks:
|
||||||
|
# ensure-output-dirs is run before this
|
||||||
|
- name: Write test log file
|
||||||
|
copy:
|
||||||
|
dest: '{{ zuul_output_dir }}/{{ item }}/{{ inventory_hostname }}'
|
||||||
|
content: '{{ item }}'
|
||||||
|
loop:
|
||||||
|
- logs
|
||||||
|
- docs
|
||||||
|
- artifacts
|
||||||
|
roles:
|
||||||
|
- role: fetch-output
|
||||||
|
post_tasks:
|
||||||
|
- name: Check that logs have been pulled
|
||||||
|
delegate_to: localhost
|
||||||
|
file:
|
||||||
|
# log_path fact is set in fetch-output
|
||||||
|
path: "{{ log_path }}/{{ inventory_hostname }}"
|
||||||
|
state: file
|
||||||
|
register: local_log_content
|
||||||
|
|
||||||
|
- name: Check that artifacts have been pulled
|
||||||
|
delegate_to: localhost
|
||||||
|
file:
|
||||||
|
path: "{{ zuul.executor.work_root }}/artifacts/{{ inventory_hostname }}"
|
||||||
|
state: file
|
||||||
|
register: local_artifact_content
|
||||||
|
|
||||||
|
- name: Check that docs have been pulled
|
||||||
|
delegate_to: localhost
|
||||||
|
file:
|
||||||
|
path: "{{ zuul.executor.work_root }}/docs/{{ inventory_hostname }}"
|
||||||
|
state: file
|
||||||
|
register: local_doc_content
|
||||||
|
|
||||||
|
- name: Validate that files were pulled correctly
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- local_log_content is not changed
|
||||||
|
- local_log_content is succeeded
|
||||||
|
- local_artifact_content is not changed
|
||||||
|
- local_artifact_content is succeeded
|
||||||
|
- local_doc_content is not changed
|
||||||
|
- local_doc_content is succeeded
|
84
test-playbooks/base-roles/fetch-zuul-cloner.yaml
Normal file
84
test-playbooks/base-roles/fetch-zuul-cloner.yaml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
- name: Test the fetch-zuul-cloner role
|
||||||
|
hosts: all
|
||||||
|
vars:
|
||||||
|
destination: "/usr/zuul-env/bin/zuul-cloner"
|
||||||
|
repo_src_dir: "/home/zuul/src/opendev.org"
|
||||||
|
roles:
|
||||||
|
- role: fetch-zuul-cloner
|
||||||
|
post_tasks:
|
||||||
|
- name: Check that the directory exists
|
||||||
|
file:
|
||||||
|
path: "{{ destination | dirname }}"
|
||||||
|
state: directory
|
||||||
|
register: directory
|
||||||
|
|
||||||
|
- name: Check that the zuul-cloner shim exists
|
||||||
|
stat:
|
||||||
|
path: "{{ destination }}"
|
||||||
|
register: cloner
|
||||||
|
|
||||||
|
- name: Validate that the shim was installed successfully
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- directory is not changed
|
||||||
|
- directory is succeeded
|
||||||
|
- cloner.stat.exists
|
||||||
|
- cloner.stat.mode == "0755"
|
||||||
|
|
||||||
|
- name: Zuul clone something in required-projects
|
||||||
|
shell:
|
||||||
|
executable: /bin/bash
|
||||||
|
cmd: |
|
||||||
|
CLONEMAP=`mktemp`
|
||||||
|
function cleanup {
|
||||||
|
rm -f $CLONEMAP
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
cat > $CLONEMAP << EOF
|
||||||
|
clonemap:
|
||||||
|
- name: openstack/project-config
|
||||||
|
dest: {{ ansible_user_dir }}
|
||||||
|
EOF
|
||||||
|
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP \
|
||||||
|
--cache-dir /opt/git https://opendev.org \
|
||||||
|
openstack/project-config
|
||||||
|
register: clone_with_required
|
||||||
|
|
||||||
|
- name: Check if repository was cloned
|
||||||
|
stat:
|
||||||
|
path: "{{ ansible_user_dir }}/src/opendev.org/openstack/project-config"
|
||||||
|
register: with_required_stat
|
||||||
|
|
||||||
|
- name: Zuul clone something not in required-projects
|
||||||
|
shell:
|
||||||
|
executable: /bin/bash
|
||||||
|
cmd: |
|
||||||
|
CLONEMAP=`mktemp`
|
||||||
|
function cleanup {
|
||||||
|
rm -f $CLONEMAP
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
cat > $CLONEMAP << EOF
|
||||||
|
clonemap:
|
||||||
|
- name: openstack-infra/jenkins-job-builder
|
||||||
|
dest: {{ ansible_user_dir }}
|
||||||
|
EOF
|
||||||
|
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP \
|
||||||
|
--cache-dir /opt/git https://git.openstack.org \
|
||||||
|
openstack-infra/jenkins-job-builder
|
||||||
|
ignore_errors: yes
|
||||||
|
register: clone_without_required
|
||||||
|
|
||||||
|
- name: Check if repository was cloned
|
||||||
|
stat:
|
||||||
|
path: "{{ ansible_user_dir }}/src/git.openstack.org/openstack-infra/jenkins-job-builder"
|
||||||
|
register: without_required_stat
|
||||||
|
|
||||||
|
- name: Validate zuul-cloner shim results
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- clone_with_required is succeeded
|
||||||
|
- clone_with_required is changed
|
||||||
|
- with_required_stat.stat.exists
|
||||||
|
- clone_without_required is failed
|
||||||
|
- not without_required_stat.stat.exists
|
24
test-playbooks/base-roles/use-cached-repos.yaml
Normal file
24
test-playbooks/base-roles/use-cached-repos.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
- name: Test the use-cached-repos role
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: use-cached-repos
|
||||||
|
post_tasks:
|
||||||
|
# openstack/project-config is in 'required-projects'.
|
||||||
|
# Also check that the project being tested is being prepared.
|
||||||
|
# We're checking them explicitly rather than with_items on zuul.projects
|
||||||
|
# in case there is a regression which would take an item out.
|
||||||
|
- name: Check that openstack/project-config was prepared
|
||||||
|
stat:
|
||||||
|
path: "{{ ansible_user_dir }}/src/opendev.org/openstack/project-config"
|
||||||
|
register: project_config
|
||||||
|
|
||||||
|
- name: Check this project was prepared
|
||||||
|
stat:
|
||||||
|
path: "{{ ansible_user_dir }}/src/{{ zuul.project.canonical_name }}"
|
||||||
|
register: self_config
|
||||||
|
|
||||||
|
- name: Validate that required projects have been prepared
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- project_config.stat.exists
|
||||||
|
- self_config.stat.exists
|
13
test-playbooks/base-roles/validate-host.yaml
Normal file
13
test-playbooks/base-roles/validate-host.yaml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
- name: Test the validate-host role
|
||||||
|
pre_tasks:
|
||||||
|
# NOTE(pabelanger): Until we hit the validate-host role, we have a minimal
|
||||||
|
# set of ansible variables collected by zuul-executor. This doesn't include
|
||||||
|
# network variables (ansible_default_ipv4 / ansible_default_ipv6) so gather
|
||||||
|
# these variables as they are important to the configure-unbound role.
|
||||||
|
- name: Gather network facts
|
||||||
|
setup:
|
||||||
|
gather_subset: 'network'
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: validate-host
|
||||||
|
zuul_site_traceroute_host: files.openstack.org
|
@ -1,17 +1,107 @@
|
|||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles
|
||||||
|
description: |
|
||||||
|
Tests roles in the 'base' job
|
||||||
|
|
||||||
|
These roles are tested together in this job because testing them
|
||||||
|
relies on using base-minimal, which avoids running these roles.
|
||||||
|
However, for the job to fully function, they all need to have
|
||||||
|
been run (once) by the end.
|
||||||
|
parent: base-minimal
|
||||||
|
tags: all-platforms
|
||||||
|
abstract: true
|
||||||
|
run: test-playbooks/base-roles/base.yaml
|
||||||
|
# Testing of fetch-zuul-cloner and use-cached-repos need this repo
|
||||||
|
# in required-projects
|
||||||
|
required-projects:
|
||||||
|
- openstack/project-config
|
||||||
|
files:
|
||||||
|
- ^roles/configure-mirrors/.*
|
||||||
|
- ^roles/configure-mirrors/.*
|
||||||
|
- ^roles/emit-job-header/.*
|
||||||
|
- ^roles/ensure-output-dirs/.*
|
||||||
|
- ^roles/fetch-output/.*
|
||||||
|
- ^roles/fetch-zuul-cloner/.*
|
||||||
|
- ^roles/set-zuul-log-path-fact/.*
|
||||||
|
- ^roles/use-cached-repo/.*
|
||||||
|
- ^roles/validate-host/.*
|
||||||
|
- ^test-playbooks/base-roles/.*
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-centos-7
|
||||||
|
description: Tests roles in the 'base' job on centos-7
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: centos-7
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-debian-stable
|
||||||
|
description: Tests roles in the 'base' job on debian-stable
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: debian-stable
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-fedora-latest
|
||||||
|
description: Tests roles in the 'base' job on fedora-latest
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: fedora-latest
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-opensuse-15
|
||||||
|
description: Tests roles in the 'base' job on opensuse-15
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: opensuse-15
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-opensuse-tumbleweed
|
||||||
|
description: Tests roles in the 'base' job on opensuse-tumbleweed
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: opensuse-tumbleweed
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-ubuntu-bionic
|
||||||
|
description: Tests roles in the 'base' job on ubuntu-bionic
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: ubuntu-bionic
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-ubuntu-trusty
|
||||||
|
description: Tests roles in the 'base' job on ubuntu-trusty
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: ubuntu-trusty
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: zuul-jobs-test-base-roles-ubuntu-xenial
|
||||||
|
description: Tests roles in the 'base' job on ubuntu-xenial
|
||||||
|
parent: zuul-jobs-test-base-roles
|
||||||
|
tags: auto-generated
|
||||||
|
nodeset: ubuntu-xenial
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: zuul-jobs-test-upload-git-mirror
|
name: zuul-jobs-test-upload-git-mirror
|
||||||
description: |
|
description: Test the upload-git-mirror role
|
||||||
Tests for the upload-git-mirror role from zuul-jobs
|
|
||||||
run: test-playbooks/upload-git-mirror.yaml
|
run: test-playbooks/upload-git-mirror.yaml
|
||||||
files:
|
files:
|
||||||
- ^roles/upload-git-mirror/.*
|
- ^roles/upload-git-mirror/.*
|
||||||
- ^test-playbooks/upload-git-mirror.yaml
|
- ^test-playbooks/upload-git-mirror.yaml
|
||||||
|
|
||||||
# List all the jobs in this file.
|
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
check:
|
check:
|
||||||
jobs: &id001
|
jobs: &id001
|
||||||
|
- zuul-jobs-test-base-roles-centos-7
|
||||||
|
- zuul-jobs-test-base-roles-debian-stable
|
||||||
|
- zuul-jobs-test-base-roles-fedora-latest
|
||||||
|
- zuul-jobs-test-base-roles-opensuse-15
|
||||||
|
- zuul-jobs-test-base-roles-opensuse-tumbleweed
|
||||||
|
- zuul-jobs-test-base-roles-ubuntu-bionic
|
||||||
|
- zuul-jobs-test-base-roles-ubuntu-trusty
|
||||||
|
- zuul-jobs-test-base-roles-ubuntu-xenial
|
||||||
- zuul-jobs-test-upload-git-mirror
|
- zuul-jobs-test-upload-git-mirror
|
||||||
gate:
|
gate:
|
||||||
jobs: *id001
|
jobs: *id001
|
||||||
|
@ -7,13 +7,6 @@
|
|||||||
- build-tox-docs
|
- build-tox-docs
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-infra-base-integration-centos-7
|
|
||||||
- openstack-infra-base-integration-debian-stable
|
|
||||||
- openstack-infra-base-integration-fedora-latest
|
|
||||||
- openstack-infra-base-integration-ubuntu-bionic
|
|
||||||
- openstack-infra-base-integration-ubuntu-trusty
|
|
||||||
- openstack-infra-base-integration-ubuntu-xenial
|
|
||||||
- openstack-infra-base-integration-opensuse423
|
|
||||||
- openstack-infra-multinode-integration-centos-7
|
- openstack-infra-multinode-integration-centos-7
|
||||||
- openstack-infra-multinode-integration-debian-stable
|
- openstack-infra-multinode-integration-debian-stable
|
||||||
- openstack-infra-multinode-integration-fedora-latest
|
- openstack-infra-multinode-integration-fedora-latest
|
||||||
@ -25,13 +18,6 @@
|
|||||||
- tox-py35
|
- tox-py35
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-infra-base-integration-centos-7
|
|
||||||
- openstack-infra-base-integration-debian-stable
|
|
||||||
- openstack-infra-base-integration-fedora-latest
|
|
||||||
- openstack-infra-base-integration-ubuntu-bionic
|
|
||||||
- openstack-infra-base-integration-ubuntu-trusty
|
|
||||||
- openstack-infra-base-integration-ubuntu-xenial
|
|
||||||
- openstack-infra-base-integration-opensuse423
|
|
||||||
- openstack-infra-multinode-integration-centos-7
|
- openstack-infra-multinode-integration-centos-7
|
||||||
- openstack-infra-multinode-integration-debian-stable
|
- openstack-infra-multinode-integration-debian-stable
|
||||||
- openstack-infra-multinode-integration-fedora-latest
|
- openstack-infra-multinode-integration-fedora-latest
|
||||||
|
Loading…
Reference in New Issue
Block a user