Skip to content

Commit

Permalink
Add job for check openlab-zuul-jobs changes (apache#69)
Browse files Browse the repository at this point in the history
* Add job for check oepnlab-zuul-jobs changes

For apache#68

* modify the lint regular expression to support ".yml" format
  • Loading branch information
liusheng authored and Zhuli committed Mar 7, 2018
1 parent 65a7fb9 commit d0836f4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions playbooks/openlab-zuul-jobs-check/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[all]
localhost
15 changes: 15 additions & 0 deletions playbooks/openlab-zuul-jobs-check/run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- hosts: all
become: yes
tasks:
- shell:
cmd: |
set -e
set -o pipefail
set -x
pip install ansible-lint
find playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 ansible-lint -xANSIBLE0012 || true
find playbooks -type f -regex '.*.y[a]?ml' -exec ansible-playbook --syntax-check -i ./playbooks/openlab-zuul-jobs-check/inventory \{\} + > /dev/null
executable: /bin/bash
chdir: '{{ zuul.project.src_dir }}'
environment:
ANSIBLE_ROLES_PATH: '{{ ansible_user_dir }}/src/github.com/theopenlab/openlab-zuul-jobs/roles:{{ ansible_user_dir }}/src/github.com/theopenlab/zuul-jobs/roles:{{ ansible_user_dir }}/src/github.com/theopenlab/project-config/roles'
12 changes: 12 additions & 0 deletions zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,15 @@
Run Kubernetes openstack-cloud-controller-manager unit test in devstack instance
run: playbooks/openstack-cloud-controller-manager-unittest/run.yaml
nodeset: ubuntu-xenial-large

- job:
name: openlab-zuul-jobs-check
parent: init-test
description: |
This job runs against project-config, openlab-zuul-jobs and zuul-jobs
so we can properly lint our ansible playbooks / roles
required-projects:
- theopenlab/openlab-zuul-jobs
- theopenlab/project-config
- theopenlab/zuul-jobs
run: playbooks/openlab-zuul-jobs-check/run.yaml
4 changes: 4 additions & 0 deletions zuul.d/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- project:
check:
jobs:
- openlab-zuul-jobs-check

0 comments on commit d0836f4

Please sign in to comment.