You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
2 years ago
|
# standard role for fetching a package dist-git into the Ansible controller for running its tests
|
||
|
# variables:
|
||
|
# - package: dist-git source package name
|
||
|
# - modulemd: file name of module metadata description, for getting correct branch name
|
||
|
---
|
||
|
- name: Install git
|
||
|
dnf: name=git state=installed
|
||
|
|
||
|
- name: Clone package dist-git
|
||
|
git:
|
||
|
repo: git://pkgs.devel.redhat.com/rpms/{{ package }}
|
||
|
# read package branch from module md file
|
||
|
version: "{{ (lookup('file', modulemd) | from_yaml)['data']['components']['rpms'][package]['ref'] }}"
|
||
|
dest: "/tmp/packages/{{ package }}"
|
||
|
|
||
|
# fetch can only get a single file, so we have to do this in a loop
|
||
|
- name: Get package test file list
|
||
|
find:
|
||
|
paths: "/tmp/packages/{{ package }}/tests"
|
||
|
recurse: yes
|
||
|
register: test_files_to_fetch
|
||
|
|
||
|
- name: Copy package test files to controller
|
||
|
fetch:
|
||
|
src: "{{ item.path }}"
|
||
|
# strip off /tmp/ prefix
|
||
|
dest: "{{ playbook_dir }}/{{ item.path[5:] }}"
|
||
|
flat: yes
|
||
|
with_items: "{{ test_files_to_fetch.files }}"
|
||
|
|
||
|
- name: Copy package files
|
||
|
fetch:
|
||
|
src: "/tmp/packages/{{ package }}/{{ item }}"
|
||
|
dest: "{{ playbook_dir }}/packages/{{ package }}/"
|
||
|
flat: yes
|
||
|
with_items: ["{{ package }}.spec", "sources"]
|