tripleo-quickstart-extras/roles/build-test-packages/tasks/github-pr.yml
Sagi Shnaidman 12ee5046ee Install ansible-core in CentOS 9 for github PRs
Change-Id: Icd61c64c744a61fb9731feba6922220c71623543
2022-01-03 08:31:46 +02:00

76 lines
2.3 KiB
YAML

---
- when: artg_change.project in artg_github_projects
block:
- name: Install packages
package:
name:
- rpm-build
- ansible-macros
- "ansible{% if ansible_distribution_major_version|int >= 9 %}-core{% endif %}"
state: present
disable_gpg_check: true
become: true
register: install
retries: 10
until: install is success
delay: 10
- name: Set collection path
set_fact:
collection_path: >-
{{ ansible_user_dir }}/{{
zuul.projects['github.com/' + artg_change.project].src_dir|
default('src/github.com/' + artg_change.project) }}
- when:
- artg_change.project in artg_github_projects
- artg_change.project == "containers/ansible-podman-collections"
block:
- name: Build collection
shell: >-
./contrib/build_rpm.sh > ~/ansible-podman-collections-build_rpm.log 2>&1
args:
chdir: "{{ collection_path }}"
changed_when: true
tags:
- skip_ansible_lint
- when:
- artg_change.project in artg_github_projects
- artg_change.project != "containers/ansible-podman-collections"
block:
- name: Create a script to build collection
template:
src: build_collection.sh.j2
dest: ~/build_collection.sh
mode: 0777
- name: Create a spec file for building collection
template:
src: "specs/{{ artg_change.project.split('/')[1].split('.') | join ('-') }}-build.spec.j2"
dest: "{{ collection_path }}/{{ 'ansible-collection-' + (artg_change.project.split('/')[1].split('.') | join ('-')) }}-build.spec"
- name: Change collection version in galaxy.yml
lineinfile:
path: "{{ collection_path }}/galaxy.yml"
regexp: "^version:.*"
line: 'version: 9.9.9'
- name: Build collection
shell: >-
~/build_collection.sh > ~/{{ artg_change.project|replace('/', '-') }}-build_rpm-err.log 2>&1 || true;
~/build_collection.sh > ~/{{ artg_change.project|replace('/', '-') }}-build_rpm.log 2>&1
args:
chdir: "{{ collection_path }}"
changed_when: true
tags:
- skip_ansible_lint
- name: Append project name to package list
set_fact:
ansible_coll_packages: '{{ ansible_coll_packages }} + {{ [ artg_change.project ] }}'
when: artg_change.project in artg_github_projects