CI: Run yamllint on added or modified YAML files
Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
5e735e8263
commit
24deb169fb
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
indentation:
|
||||||
|
spaces: 2
|
||||||
|
indent-sequences: whatever
|
||||||
|
level: warning
|
||||||
|
line-length:
|
||||||
|
max: 100
|
||||||
|
level: warning
|
||||||
|
truthy:
|
||||||
|
allowed-values: ['true', 'false', 'yes', 'no']
|
||||||
|
...
|
|
@ -19,8 +19,16 @@
|
||||||
parent: fi-ansible--ansible-review-base
|
parent: fi-ansible--ansible-review-base
|
||||||
run: ci/ansible-review-diff.yaml
|
run: ci/ansible-review-diff.yaml
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: fi-ansible--yamllint-diff
|
||||||
|
run: ci/yamllint-diff.yaml
|
||||||
|
files:
|
||||||
|
- \.yml$
|
||||||
|
- \.yaml$
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- fi-ansible--zuul-jobs-verify-namespace
|
- fi-ansible--zuul-jobs-verify-namespace
|
||||||
- fi-ansible--ansible-review-diff
|
- fi-ansible--ansible-review-diff
|
||||||
|
- fi-ansible--yamllint-diff
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
tasks:
|
||||||
|
- name: Install yamllint
|
||||||
|
package:
|
||||||
|
name: yamllint
|
||||||
|
state: latest
|
||||||
|
|
||||||
|
- name: Determine added or modified YAML files
|
||||||
|
command:
|
||||||
|
cmd: >
|
||||||
|
git diff --name-only --diff-filter=AM
|
||||||
|
origin/{{ zuul.branch|quote }}...{{ zuul.branch|quote }}
|
||||||
|
args:
|
||||||
|
chdir: '{{ zuul.project.src_dir }}'
|
||||||
|
register: fi_ansible__added_modified_yaml_files
|
||||||
|
changed_when: "False"
|
||||||
|
failed_when: fi_ansible__added_modified_yaml_files.rc != 0
|
||||||
|
|
||||||
|
- name: Run yamllint on changed YAML files
|
||||||
|
command: yamllint {{ item }}
|
||||||
|
args:
|
||||||
|
chdir: '{{ zuul.project.src_dir }}'
|
||||||
|
with_items: "{{ fi_ansible__added_modified_yaml_files.stdout_lines | list }}"
|
Loading…
Reference in New Issue