openqa: use an external side repo for test builds

It's overall simpler and more idempotent to just use a side repo
maintained outside of ansible than re-create one on each system
on each run of the plays.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2023-10-27 11:19:23 -07:00
parent cef973a010
commit 530f69d967
4 changed files with 22 additions and 86 deletions

View file

@ -0,0 +1,6 @@
[openqa-lab-repo]
name=Side repo for lab which may contain newer test builds
baseurl=https://fedorapeople.org/groups/qa/openqa-repos/openqa-lab-repo/$basearch/
enabled=1
metadata_expire=30
gpgcheck=0

View file

@ -1,6 +0,0 @@
[scratchrepo]
name=Scratch buld repo
baseurl=file:///var/tmp/scratchrepo
enabled=1
metadata_expire=30
gpgcheck=0

View file

@ -71,14 +71,6 @@
## string - Fedora Infrastructure thing; for this role, applies an
## infra-specific tweak to httpd config. Don't set it outside
## Fedora infra.
# - openqa_scratch
## list - A list of task IDs of scratch builds to install. If set, we
## will download the scratch build(s) and set up a side repo
## containing them. We do this because openQA staging is our
## main platform for testing new openQA releases; we need to
## be able to run scratch builds to see if a new release is
## really bad before submitting it as an update, we don't want
## to send new builds to updates-testing if they have problems
# - openqa_nfs_workers
## list - A list of hostnames of workers that will share the factory
## directory via NFS. All these will be granted rw access to
@ -107,41 +99,15 @@
shell: /sbin/nologin
when: "openqa_static_uid is defined"
- name: Remove scratch repo directory
- name: Remove old scratch repo directory
file: path=/var/tmp/scratchrepo state=absent
- name: (Re-)create scratch repo directory
file: path=/var/tmp/scratchrepo state=directory owner=root group=root
when: "openqa_scratch is defined"
- name: Install Koji CLI client and createrepo
package:
name: ["koji", "createrepo"]
state: present
tags:
- packages
when: "openqa_scratch is defined"
- name: Download scratch builds
command: "koji download-task --arch=noarch --arch={{ ansible_architecture }} {{ item }}"
args:
chdir: /var/tmp/scratchrepo
loop: "{{ openqa_scratch|flatten(levels=1) }}"
when: "openqa_scratch is defined"
- name: Write repodata
command: "createrepo ."
args:
chdir: /var/tmp/scratchrepo
when: "openqa_scratch is defined"
- name: Write scratch build repo config
copy: src=scratchrepo.repo dest=/etc/yum.repos.d/scratchrepo.repo owner=root group=root mode=0644
when: "openqa_scratch is defined"
- name: Delete scratch build repo config
- name: Delete old scratch build repo config
file: path=/etc/yum.repos.d/scratchrepo.conf state=absent
when: "openqa_scratch is not defined"
- name: Write lab side repo config
copy: src=openqa-lab-repo.repo dest=/etc/yum.repos.d/openqa-lab-repo.repo owner=root group=root mode=0644
when: "deployment_type is defined and deployment_type == 'stg'"
# this is separate from the step below so we can use openqa_repo just
# for these packages

View file

@ -39,19 +39,15 @@
## default - empty string (disabled)
# Optional vars
# - deployment_type
## string - Fedora Infrastructure thing; for this role, applies an
## infra-specific tweak to httpd config. Don't set it outside
## Fedora infra.
# - openqa_rngd
## string - if set to any value, rng-tools package will be
## installed and rngd.service enabled/started
# - openqa_worker_class
## string - custom WORKER_CLASS value for workers.ini
# - openqa_scratch
## list - A list of task IDs of scratch builds to install. If set, we
## will download the scratch build(s) and set up a side repo
## containing them. We do this because openQA staging is our
## main platform for testing new openQA releases; we need to
## be able to run scratch builds to see if a new release is
## really bad before submitting it as an update, we don't want
## to send new builds to updates-testing if they have problems
# - openqa_static_uid
## int - a static ID for the geekotest group if desired. this is useful
## for NFS mounting openQA data files. The _openqa_worker user,
@ -61,41 +57,15 @@
## so os-autoinst can write to the shared asset directories,
## which it needs to do when uncompressing compressed disk assets
- name: Remove scratch repo directory
- name: Remove old scratch repo directory
file: path=/var/tmp/scratchrepo state=absent
- name: (Re-)create scratch repo directory
file: path=/var/tmp/scratchrepo state=directory owner=root group=root
when: "openqa_scratch is defined"
- name: Delete old scratch build repo config
file: path=/etc/yum.repos.d/scratchrepo.conf state=absent
- name: Install Koji CLI client and createrepo
package:
name: ["koji", "createrepo"]
state: present
tags:
- packages
when: "openqa_scratch is defined"
- name: Download scratch builds
command: "koji download-task --arch=noarch --arch={{ ansible_architecture }} {{ item }}"
args:
chdir: /var/tmp/scratchrepo
loop: "{{ openqa_scratch|flatten(levels=1) }}"
when: "openqa_scratch is defined"
- name: Write repodata
command: "createrepo ."
args:
chdir: /var/tmp/scratchrepo
when: "openqa_scratch is defined"
- name: Write scratch build repo config
copy: src=scratchrepo.repo dest=/etc/yum.repos.d/scratchrepo.repo owner=root group=root mode=0644
when: "openqa_scratch is defined"
- name: Delete scratch build repo config
file: path=/etc/yum.repos.d/scratchrepo.repo state=absent
when: "openqa_scratch is not defined"
- name: Write lab side repo config
copy: src=openqa-lab-repo.repo dest=/etc/yum.repos.d/openqa-lab-repo.repo owner=root group=root mode=0644
when: "deployment_type is defined and deployment_type == 'stg'"
- name: Install required packages
package: