From 612e4276f43ef49137f20faff19cbebde79193c8 Mon Sep 17 00:00:00 2001 From: Jiri Kyjovsky Date: Mon, 9 Sep 2024 17:27:08 +0200 Subject: [PATCH] copr: dynamically specify builder volume size See https://github.com/fedora-copr/copr/issues/3268 --- roles/copr/backend/files/provision/files/copr-rpmbuild.yml | 6 ++++++ .../backend/files/provision/files/mock-custom-build.cfg.j2 | 3 +++ roles/copr/backend/files/provision/files/mock.cfg.j2 | 3 +++ .../backend/files/provision/provision_builder_tasks.yml | 2 ++ .../backend/templates/provision/copr-resalloc-aws-new.j2 | 1 - roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 | 3 +++ roles/copr/backend/templates/resalloc/pools.yaml | 6 +++--- 7 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 roles/copr/backend/files/provision/files/copr-rpmbuild.yml diff --git a/roles/copr/backend/files/provision/files/copr-rpmbuild.yml b/roles/copr/backend/files/provision/files/copr-rpmbuild.yml new file mode 100644 index 0000000000..fefab47451 --- /dev/null +++ b/roles/copr/backend/files/provision/files/copr-rpmbuild.yml @@ -0,0 +1,6 @@ +--- +tags_to_mock_snippet: + # requested in https://github.com/fedora-copr/copr/issues/3268 + - tagset: + - on_demand_powerful + snippet: config_opts['plugin_conf']['tmpfs_opts']['max_fs_size'] = '280g' diff --git a/roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 b/roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 index 9e161bcf8a..b4b9a19ce7 100644 --- a/roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 +++ b/roles/copr/backend/files/provision/files/mock-custom-build.cfg.j2 @@ -16,6 +16,9 @@ config_opts["root"] = "copr-custom-" + config_opts["root"] # /bin/mock calls (when tmpfs_enable is on). config_opts['plugin_conf']['tmpfs_opts']['keep_mounted'] = True +# Custom mock snippets configured in copr-crpmbuild config file - can be empty +{{ mock_snippet }} + {%- for key, value in macros.items() %} config_opts['macros']['{{ key }}'] = '{{ value }}' {%- endfor %} diff --git a/roles/copr/backend/files/provision/files/mock.cfg.j2 b/roles/copr/backend/files/provision/files/mock.cfg.j2 index 25f3bbf196..c0010056cc 100644 --- a/roles/copr/backend/files/provision/files/mock.cfg.j2 +++ b/roles/copr/backend/files/provision/files/mock.cfg.j2 @@ -4,6 +4,9 @@ config_opts.setdefault('plugin_conf', {}) config_opts['plugin_conf'].setdefault('tmpfs_opts', {}) config_opts['plugin_conf']['tmpfs_opts']['keep_mounted'] = True +# Custom mock snippets configured in copr-crpmbuild config file - can be empty +{{ mock_snippet }} + {% if buildroot_pkgs %} config_opts['chroot_additional_packages'] = '{{ buildroot_pkgs| join(" ") }}' {% endif %} diff --git a/roles/copr/backend/files/provision/provision_builder_tasks.yml b/roles/copr/backend/files/provision/provision_builder_tasks.yml index 4bba6d3851..135503665d 100644 --- a/roles/copr/backend/files/provision/provision_builder_tasks.yml +++ b/roles/copr/backend/files/provision/provision_builder_tasks.yml @@ -329,6 +329,8 @@ loop: - mock-custom-build.cfg.j2 - mock.cfg.j2 + # this one is not hotfix though... + - copr-rpmbuild.yml - name: Check that we have successfully finished the subscription async_status: diff --git a/roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 b/roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 index 17c70deffc..70410dac73 100644 --- a/roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 +++ b/roles/copr/backend/templates/provision/copr-resalloc-aws-new.j2 @@ -24,7 +24,6 @@ cmd=( --tag CoprPurpose=builder --tag CoprInstance={% if devel %}devel{% else %}production{% endif %} --tag arch={{ item }} - --additional-volume-size 160 --playbook /var/lib/resallocserver/provision/builderpb-aws.yml ) diff --git a/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 b/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 index 7748228645..50320ad260 100644 --- a/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 +++ b/roles/copr/backend/templates/resalloc/ibm-cloud-vm.j2 @@ -17,9 +17,11 @@ case $RESALLOC_NAME in case $RESALLOC_NAME in *_hp_*) instance_type=bz2-16x64 + additional_volume_size=320 ;; *) instance_type=mz2-2x16 + additional_volume_size=160 ;; esac image_uuid="{{ copr_builder_images.ibm_cloud.s390x.us_east }}" @@ -43,6 +45,7 @@ if [ "$1" == "create" ]; then --ssh-key-id "$ssh_key_id" --instance-type "$instance_type" --subnets-ids $subnets_ids + --additional-volume-size "$additional_volume_size" -- ) fi diff --git a/roles/copr/backend/templates/resalloc/pools.yaml b/roles/copr/backend/templates/resalloc/pools.yaml index b655b3cec8..90017359e4 100644 --- a/roles/copr/backend/templates/resalloc/pools.yaml +++ b/roles/copr/backend/templates/resalloc/pools.yaml @@ -58,11 +58,11 @@ aws_{{ arch }}_{{ on_demand + '_' if on_demand is not none else '' }}{% if spot {% endif %} {% if spot and on_demand == 'powerful' %} - cmd_new: copr-resalloc-aws-new-{{ arch }} --instance-type {{ itype }} --root-volume-size 18 + cmd_new: copr-resalloc-aws-new-{{ arch }} --instance-type {{ itype }} --additional-volume-size 320 --root-volume-size 18 {% elif spot %} - cmd_new: copr-resalloc-aws-new-{{ arch }} --instance-type {{ itype }} --spot-price 0.156 + cmd_new: copr-resalloc-aws-new-{{ arch }} --instance-type {{ itype }} --additional-volume-size 160 --spot-price 0.156 {% else %} - cmd_new: copr-resalloc-aws-new-{{ arch }} --instance-type {{ itype }} + cmd_new: copr-resalloc-aws-new-{{ arch }} --instance-type {{ itype }} --additional-volume-size 160 {% endif %} cmd_delete: "/var/lib/resallocserver/resalloc_provision/vm-delete" cmd_livecheck: "resalloc-check-vm-ip"