From 476e5454ec318ccf8ecbef204f4f4f898ec0e7e4 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 28 Feb 2024 15:37:07 +0100 Subject: [PATCH] copr-builders: assert the storage limits early It doesn't make sense to spent a lot of time with the rest of the playbook when the builder is broken. Relates: https://github.com/fedora-copr/copr/issues/3053 --- .../provision/provision_builder_tasks.yml | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/roles/copr/backend/files/provision/provision_builder_tasks.yml b/roles/copr/backend/files/provision/provision_builder_tasks.yml index 03e8383d18..b303dfaa2d 100644 --- a/roles/copr/backend/files/provision/provision_builder_tasks.yml +++ b/roles/copr/backend/files/provision/provision_builder_tasks.yml @@ -127,6 +127,32 @@ register: rh_subscribtion_task when: starting_builder +- name: Collect facts about builder hardware + setup: + gather_subset: + - hardware + +- name: Make sure that we have 140G memory or SWAP for Mock caches + assert: + that: + - ansible_memory_mb.swap.free + ansible_memory_mb.real.free >= 1024 * 140 + fail_msg: "Not enough memory+swap, the builder is unusable: {{ ansible_memory_mb.swap.free }} MB SWAP and {{ ansible_memory_mb.real.free }} MB RAM" + success_msg: "Builder has enough memory/swap!" + when: + - starting_builder + +- name: check disk space + include_tasks: + file: check_path_free_space.yml + vars: + path: "{{ item.path }}" + size: "{{ item.size|int }}" + loop: + - path: /var/lib/copr-rpmbuild + size: 15000000 + when: + - starting_builder + - name: stop and disable systemd-oomd, rhbz 2051154 service: name: systemd-oomd @@ -251,32 +277,6 @@ when: - starting_builder -- name: Collect facts about builder hardware - setup: - gather_subset: - - hardware - -- name: Make sure that we have 140G memory or SWAP for Mock caches - assert: - that: - - ansible_memory_mb.swap.free + ansible_memory_mb.real.free >= 1024 * 140 - fail_msg: "Not enough memory+swap, the builder is unusable: {{ ansible_memory_mb.swap.free }} MB SWAP and {{ ansible_memory_mb.real.free }} MB RAM" - success_msg: "Builder has enough memory/swap!" - when: - - starting_builder - -- name: check disk space - include_tasks: - file: check_path_free_space.yml - vars: - path: "{{ item.path }}" - size: "{{ item.size|int }}" - loop: - - path: /var/lib/copr-rpmbuild - size: 15000000 - when: - - starting_builder - - name: detect package versions package_facts: manager=auto