From c296ef09618ef90f3e72873f271ab353cbc43d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kone=C4=8Dn=C3=BD?= Date: Wed, 20 Apr 2022 11:59:26 +0200 Subject: [PATCH] [Zuul] Migrate jobs to central repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ý --- .zuul.yaml | 32 ++------------------------ ci/ansible-review-base.yaml | 16 ------------- ci/ansible-review-diff.yaml | 8 ------- ci/ansible-review-everything.yaml | 11 --------- ci/ansible-review-filtered.sh | 10 --------- ci/yamllint-diff.yaml | 24 -------------------- ci/zuul-jobs-verify-namespace.py | 36 ------------------------------ ci/zuul-jobs-verify-namespace.yaml | 19 ---------------- 8 files changed, 2 insertions(+), 154 deletions(-) delete mode 100644 ci/ansible-review-base.yaml delete mode 100644 ci/ansible-review-diff.yaml delete mode 100644 ci/ansible-review-everything.yaml delete mode 100755 ci/ansible-review-filtered.sh delete mode 100644 ci/yamllint-diff.yaml delete mode 100755 ci/zuul-jobs-verify-namespace.py delete mode 100644 ci/zuul-jobs-verify-namespace.yaml diff --git a/.zuul.yaml b/.zuul.yaml index b8c038ab34..d312f97229 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -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 diff --git a/ci/ansible-review-base.yaml b/ci/ansible-review-base.yaml deleted file mode 100644 index 33d24e74ca..0000000000 --- a/ci/ansible-review-base.yaml +++ /dev/null @@ -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' diff --git a/ci/ansible-review-diff.yaml b/ci/ansible-review-diff.yaml deleted file mode 100644 index a56d8e48de..0000000000 --- a/ci/ansible-review-diff.yaml +++ /dev/null @@ -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 }}' diff --git a/ci/ansible-review-everything.yaml b/ci/ansible-review-everything.yaml deleted file mode 100644 index 1d1914f514..0000000000 --- a/ci/ansible-review-everything.yaml +++ /dev/null @@ -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 }}' diff --git a/ci/ansible-review-filtered.sh b/ci/ansible-review-filtered.sh deleted file mode 100755 index 84d220699f..0000000000 --- a/ci/ansible-review-filtered.sh +++ /dev/null @@ -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) diff --git a/ci/yamllint-diff.yaml b/ci/yamllint-diff.yaml deleted file mode 100644 index b2a11b67a6..0000000000 --- a/ci/yamllint-diff.yaml +++ /dev/null @@ -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 }}" diff --git a/ci/zuul-jobs-verify-namespace.py b/ci/zuul-jobs-verify-namespace.py deleted file mode 100755 index ffd52bee0a..0000000000 --- a/ci/zuul-jobs-verify-namespace.py +++ /dev/null @@ -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) diff --git a/ci/zuul-jobs-verify-namespace.yaml b/ci/zuul-jobs-verify-namespace.yaml deleted file mode 100644 index 21483168de..0000000000 --- a/ci/zuul-jobs-verify-namespace.yaml +++ /dev/null @@ -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 }}'