From 3457831d714e20c50708aca06ae454bdf66ebf15 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Mar 05 2020 14:09:46 +0000 Subject: rpm-mock-build: remove complexity brings by required-project support Remove the complexity previously added when working on the DNF project integration. Idea was to build Zuul required-projects in addition to the project being tested because merged PRs are not automatically built and publish (I mean rpms). Solution was instead to propose to DNF folks to manage a dnf-master repository. A Zuul job is attached to PR merged to build on that copr repo. This master repo is used as input to rpm-mock-build job. I think that workflow should be the one we promote. Thus that patch is removing the previously added complexity. --- diff --git a/playbooks/rpm/mock-build.yaml b/playbooks/rpm/mock-build.yaml index b8c3d5a..d4f4eb2 100644 --- a/playbooks/rpm/mock-build.yaml +++ b/playbooks/rpm/mock-build.yaml @@ -1,48 +1,14 @@ - hosts: all tasks: - - set_fact: - project_deps_to_build: "{{ zuul.projects.values() | list | json_query('[?required]') }}" - project_to_build: - - "{{ zuul.project }}" - srpms: [] - - - name: Add additional repositories - become: yes - copy: - dest: "/etc/yum.repos.d/additional-repos.repo" - content: | - {% for repo in repos|default([]) %} - [{{ repo.name }}] - name={{ repo.name }} - enabled=1 - baseurl={{ repo.url }} - gpgcheck={{ repo.gpgcheck|default('0') }} - {% endfor %} - - include_role: name: ensure-mock - include_role: - name: filter-artifacts - when: zuul.artifacts is defined - - - include_role: name: source-to-tarball - vars: - zuul: - project: "{{ item }}" - loop: "{{ project_deps_to_build | union(project_to_build) }}" when: "{{ build_from_source | default(false) }}" - include_role: name: mock-srpm-build - vars: - zuul: - project: "{{ item }}" - loop: "{{ project_deps_to_build | union(project_to_build) }}" - include_role: name: mock-build - vars: - srpm: "{{ item }}" - loop: "{{ srpms }}" diff --git a/roles/filter-artifacts/files/filter.py b/roles/filter-artifacts/files/filter.py deleted file mode 100755 index 19c3235..0000000 --- a/roles/filter-artifacts/files/filter.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import json - -artifacts = json.loads(sys.argv[1]) -deps_to_build = json.loads(sys.argv[2]) - -artifacts = [artifact['project'] for artifact in artifacts] - -deps_to_build = list(filter( - lambda x: x['name'] not in artifacts, deps_to_build)) - -print(json.dumps(deps_to_build)) diff --git a/roles/filter-artifacts/tasks/main.yml b/roles/filter-artifacts/tasks/main.yml deleted file mode 100644 index e286be6..0000000 --- a/roles/filter-artifacts/tasks/main.yml +++ /dev/null @@ -1,10 +0,0 @@ -- name: Remove project that exposed artifact from build list - script: - cmd: > - filter.py '{{ zuul.artifacts | to_json }}' - '{{ project_deps_to_build | to_json }}' - register: _filter - -- name: Store back the result in project_deps_to_build fact - set_fact: - project_deps_to_build: "{{ _filter.stdout | trim }}" diff --git a/roles/mock-build/tasks/main.yaml b/roles/mock-build/tasks/main.yaml index e916bb8..d24f4fe 100644 --- a/roles/mock-build/tasks/main.yaml +++ b/roles/mock-build/tasks/main.yaml @@ -1,7 +1,7 @@ --- - name: Set mock options fact set_fact: - mock_opts: "-v -r {{ mock_config }} --localrepo {{ ansible_user_dir }}/chainrepo" + mock_opts: "-v -r {{ mock_config }}" - name: Init the mock chroot command: mock {{ mock_opts }} --init @@ -21,6 +21,7 @@ - name: Build the RPM shell: > mock {{ mock_opts }} {{ artifacts_baseurls|trim }} {{ repos_baseurls|trim }} + --localrepo {{ ansible_user_dir }}/chainrepo --postinstall --chain {{ srpm }} - name: Sync chained repo in {{ ansible_user_dir }}/repo diff --git a/roles/mock-srpm-build/tasks/main.yaml b/roles/mock-srpm-build/tasks/main.yaml index ac9af53..fb435c7 100644 --- a/roles/mock-srpm-build/tasks/main.yaml +++ b/roles/mock-srpm-build/tasks/main.yaml @@ -44,7 +44,3 @@ - name: Set SRPM path fact set_fact: srpm: "{{ result.stdout }}" - -- name: Set SRPMs path fact - set_fact: - srpms: "{{ (srpms | default([])) | union([result.stdout]) }}"