From 530f69d96733d56d399fffb91594e405857f2b32 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Fri, 27 Oct 2023 11:19:23 -0700 Subject: [PATCH] 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 --- .../openqa/server/files/openqa-lab-repo.repo | 6 +++ roles/openqa/server/files/scratchrepo.repo | 6 --- roles/openqa/server/tasks/main.yml | 46 +++-------------- roles/openqa/worker/tasks/main.yml | 50 ++++--------------- 4 files changed, 22 insertions(+), 86 deletions(-) create mode 100644 roles/openqa/server/files/openqa-lab-repo.repo delete mode 100644 roles/openqa/server/files/scratchrepo.repo diff --git a/roles/openqa/server/files/openqa-lab-repo.repo b/roles/openqa/server/files/openqa-lab-repo.repo new file mode 100644 index 0000000000..a1c43f0bec --- /dev/null +++ b/roles/openqa/server/files/openqa-lab-repo.repo @@ -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 diff --git a/roles/openqa/server/files/scratchrepo.repo b/roles/openqa/server/files/scratchrepo.repo deleted file mode 100644 index d25cc78137..0000000000 --- a/roles/openqa/server/files/scratchrepo.repo +++ /dev/null @@ -1,6 +0,0 @@ -[scratchrepo] -name=Scratch buld repo -baseurl=file:///var/tmp/scratchrepo -enabled=1 -metadata_expire=30 -gpgcheck=0 diff --git a/roles/openqa/server/tasks/main.yml b/roles/openqa/server/tasks/main.yml index e424622e13..55a45381a5 100644 --- a/roles/openqa/server/tasks/main.yml +++ b/roles/openqa/server/tasks/main.yml @@ -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 diff --git a/roles/openqa/worker/tasks/main.yml b/roles/openqa/worker/tasks/main.yml index b4aa6a1f80..ad50000605 100644 --- a/roles/openqa/worker/tasks/main.yml +++ b/roles/openqa/worker/tasks/main.yml @@ -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: