From 86c3ee9324228b806897728b51e927438d15f3ac Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Jan 28 2020 10:05:02 +0000 Subject: [PATCH 1/2] Simplify lint jobs by linting all rpms at once --- diff --git a/playbooks/rpm/artifact-lint.yaml b/playbooks/rpm/artifact-lint.yaml index 9018c64..c407e13 100644 --- a/playbooks/rpm/artifact-lint.yaml +++ b/playbooks/rpm/artifact-lint.yaml @@ -7,6 +7,3 @@ name: rpm-artifact-url - include_role: name: rpm-lint - vars: - rpm_url: "{{ item }}" - with_items: "{{ rpms }}" diff --git a/playbooks/rpm/lint.yaml b/playbooks/rpm/lint.yaml index bef4c6b..7e82e3e 100644 --- a/playbooks/rpm/lint.yaml +++ b/playbooks/rpm/lint.yaml @@ -3,6 +3,3 @@ tasks: - include_role: name: rpm-lint - vars: - rpm_url: "{{ item }}" - with_items: "{{ rpms }}" diff --git a/roles/rpm-lint/tasks/main.yaml b/roles/rpm-lint/tasks/main.yaml index 17c26d6..263ebfc 100644 --- a/roles/rpm-lint/tasks/main.yaml +++ b/roles/rpm-lint/tasks/main.yaml @@ -1,8 +1,9 @@ --- - name: Fetch rpm get_url: - url: "{{ rpm_url }}" - dest: "/tmp/{{ rpm_url | basename }}" + url: "{{ item }}" + dest: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/{{ item | basename }}" + loop: "{{ rpms }}" - name: Run rpmlint - command: rpmlint "/tmp/{{ rpm_url | basename }}" + command: rpmlint {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/*.rpm From 8bd08f9939fbf6e5fb2180b3daeb57de6739ea61 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Jan 28 2020 11:11:02 +0000 Subject: [PATCH 2/2] rpm-lint role: detect rpmlintrc file and use it --- diff --git a/roles/rpm-lint/tasks/main.yaml b/roles/rpm-lint/tasks/main.yaml index 263ebfc..0f8b02e 100644 --- a/roles/rpm-lint/tasks/main.yaml +++ b/roles/rpm-lint/tasks/main.yaml @@ -5,5 +5,15 @@ dest: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/{{ item | basename }}" loop: "{{ rpms }}" +- name: Get rpmlintrc path + shell: ls {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/*.rpmlintrc + register: rpmlintrc_check + ignore_errors: yes + +- name: Set rpmlintrc path fact + set_fact: + rpmlintrc: "{{ rpmlintrc_check.stdout }}" + when: rpmlintrc_check is succeeded + - name: Run rpmlint - command: rpmlint {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/*.rpm + shell: rpmlint {% if rpmlintrc | default("") %} --file {{ rpmlintrc }} {% endif %} {{ ansible_user_dir }}/{{ zuul.project.src_dir }}/*.rpm