Zuul: use repo-local job playbooks again
Use our own namespace (fi-ansible) to not clash with tenant-wide defined Zuul jobs e.g. from zuul-fedora-jobs. Fixes: fedora-infrastructure#8932 Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr> Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
93b435f3ba
commit
97be9cdc8d
5 changed files with 58 additions and 1 deletions
16
.zuul.yaml
16
.zuul.yaml
|
@ -1,5 +1,19 @@
|
|||
---
|
||||
- job:
|
||||
name: fi-ansible--ansible-review-base
|
||||
pre-run: ci/ansible-review-base.yaml
|
||||
|
||||
- job:
|
||||
name: fi-ansible--ansible-review-everything
|
||||
parent: fi-ansible--ansible-review-base
|
||||
run: ci/ansible-review-everything.yaml
|
||||
|
||||
- job:
|
||||
name: fi-ansible--ansible-review-diff
|
||||
parent: ansible-review-base
|
||||
run: ci/ansible-review-diff.yaml
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- ansible-review-diff
|
||||
- fi-ansible--ansible-review-diff
|
||||
|
|
14
ci/ansible-review-base.yaml
Normal file
14
ci/ansible-review-base.yaml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Install ansible-review
|
||||
package:
|
||||
name: python3-ansible-review
|
||||
state: latest
|
||||
|
||||
- name: Install invocation script
|
||||
copy:
|
||||
src: ansible-review-filtered.sh
|
||||
dest: /usr/local/bin/ansible-review-filtered.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
8
ci/ansible-review-diff.yaml
Normal file
8
ci/ansible-review-diff.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Run ansible-review on the changes in the PR
|
||||
shell: >
|
||||
git diff origin/{{ zuul.branch|quote }}...{{ zuul.branch|quote }}
|
||||
| ansible-review-filtered.sh
|
||||
args:
|
||||
chdir: '{{ zuul.project.src_dir }}'
|
11
ci/ansible-review-everything.yaml
Normal file
11
ci/ansible-review-everything.yaml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Run ansible-review on the playbooks and roles
|
||||
shell: >
|
||||
exitcode=0;
|
||||
while read pbrulefile; do
|
||||
ansible-review-filtered.sh "$pbrulefile" || exitcode=1;
|
||||
done <<<$(find playbooks roles -name "*.yml" -o -name "*.yaml");
|
||||
exit "$exitcode"
|
||||
args:
|
||||
chdir: '{{ zuul.project.src_dir }}'
|
10
ci/ansible-review-filtered.sh
Executable file
10
ci/ansible-review-filtered.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Remove warnings on stderr about missing configuration and used default rules.
|
||||
|
||||
SEDSCRIPT='
|
||||
0,/^WARN: No configuration file found at/{/^WARN: No configuration file found at/d;};
|
||||
1,/^WARN: Using example .* found at/{/^WARN: Using example .* found at/d;};
|
||||
'
|
||||
|
||||
exec ansible-review "$@" 2> >(sed -e "$SEDSCRIPT" >&2)
|
Loading…
Add table
Add a link
Reference in a new issue