From 4f543db0b7a08e903a295c150621cd8b18021297 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Dec 21 2020 14:39:21 +0000 Subject: Role + job to check the sources file Goal is to check that the source0 file is part of the sources file. This will tell us if the file has been push to the lookaside cache. --- diff --git a/playbooks/fedora/check-sources.yaml b/playbooks/fedora/check-sources.yaml new file mode 100644 index 0000000..0983142 --- /dev/null +++ b/playbooks/fedora/check-sources.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - fedora-check-sources diff --git a/roles/fedora-check-sources/tasks/main.yaml b/roles/fedora-check-sources/tasks/main.yaml new file mode 100644 index 0000000..f8c7ee9 --- /dev/null +++ b/roles/fedora-check-sources/tasks/main.yaml @@ -0,0 +1,30 @@ +- name: Discover specfile name + command: ls *.spec + args: + chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + register: get_spec_name + +- set_fact: + spec_name: "{{ get_spec_name.stdout }}" + +- name: Discover Source0 name + shell: "spectool {{ spec_name }} | grep Source0 | sed 's/Source0: //' | xargs basename" + register: get_source0_name + +- set_fact: + source_name: "{{ get_source0_name.stdout }}" + +- name: Ensure source name is in the sources file + command: grep {{ source_name }} sources + args: + chdir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}" + register: grep_source + ignore_errors: true + +- fail: + msg: | + The sources file does not contain the source0 name and hash. + You should run + spectool {{ spec_name }} + fedpkg new-sources {{ source_name }} + when: grep_source.rc == 1 diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 495ab51..9da7cf6 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -145,9 +145,19 @@ - job: name: rpminspect description: | - Job to run rpminspct on rpms from a repo artifact + Job to run rpminspect on rpms from a repo artifact requires: repo pre-run: playbooks/ensure-output-dirs.yaml run: playbooks/rpm/rpminspect.yaml post-run: - playbooks/rpm/rpminspect-json2html.yaml +<<<<<<< HEAD +======= + - playbooks/fetch-output.yaml + +- job: + name: fedora-check-sources + description: | + Job to detect missing sources file update (lookaside cache) + run: playbooks/fedora/check-sources.yaml +>>>>>>> 4865c41... Role + job to check the sources file