[Zuul] Migrate jobs to central repository

This commit will migrate existing Zuul jobs to pagure.io/fedora-infra/zuul
repository.

This commit also removes one job that is no longer needed.

Signed-off-by: Michal Konečný <mkonecny@redhat.com>
This commit is contained in:
Michal Konečný 2022-04-20 11:59:26 +02:00 committed by zlopez
parent d7c84cd540
commit c296ef0961
8 changed files with 2 additions and 154 deletions

View File

@ -1,34 +1,6 @@
---
- job:
name: fi-ansible--zuul-jobs-verify-namespace
run: ci/zuul-jobs-verify-namespace.yaml
files:
- ^\.zuul\.yaml$
- 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: fi-ansible--ansible-review-base
run: ci/ansible-review-diff.yaml
- job:
name: fi-ansible--yamllint-diff
run: ci/yamllint-diff.yaml
files:
- \.yml$
- \.yaml$
- project:
check:
jobs:
- fi-ansible--zuul-jobs-verify-namespace
- fi-ansible--ansible-review-diff
- fi-ansible--yamllint-diff
- fi-ansible-review-diff
- fi-yamllint-diff

View File

@ -1,16 +0,0 @@
- hosts: all
tasks:
- name: Install packages
package:
name:
- ansible-freeipa
- 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'

View File

@ -1,8 +0,0 @@
- 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 }}'

View File

@ -1,11 +0,0 @@
- 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 }}'

View File

@ -1,10 +0,0 @@
#!/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)

View File

@ -1,24 +0,0 @@
---
- 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 }}"

View File

@ -1,36 +0,0 @@
#!/usr/bin/env python3
import sys
import traceback
import yaml
errors_found = False
for zuul_yaml_file in sys.argv[1:]:
print(f"Processing {zuul_yaml_file!r}...", flush=True)
with open(zuul_yaml_file, "r") as yaml_stream:
for doc_no, yaml_doc in enumerate(yaml.safe_load_all(yaml_stream), 1):
print(f"Verifying YAML doc #{doc_no}...", flush=True)
yaml_doc_errors_found = False
try:
for item in yaml_doc:
if "job" in item:
job = item["job"]
if not job["name"].startswith("fi-ansible--"):
yaml_doc_errors_found = errors_found = True
print(
f"Locally defined Zuul job {job['name']!r} must be named"
" 'fi-ansible-...'"
)
except Exception:
yaml_doc_errors_found = errors_found = True
traceback.print_exc()
if yaml_doc_errors_found:
print(f"Verification failed.", flush=True)
else:
print(f"Verification passed.", flush=True)
sys.exit(errors_found)

View File

@ -1,19 +0,0 @@
- hosts: all
tasks:
- name: Install Python YAML package
package:
name: python3-pyyaml
state: latest
- name: Install invocation script
copy:
src: zuul-jobs-verify-namespace.py
dest: /usr/local/bin/zuul-jobs-verify-namespace.py
owner: root
group: root
mode: '0755'
- name: Verify that local Zuul jobs use our namespace
command: zuul-jobs-verify-namespace.py .zuul.yaml
args:
chdir: '{{ zuul.project.src_dir }}'