--- - name: "Run ci/playbooks/multinode-autohold.yml" hosts: controller, primary gather_facts: true tasks: - name: Verify if "success" flag exists after successful tests execution register: cifmw_success_flag ansible.builtin.stat: path: "{{ ansible_user_dir }}/cifmw-success" - name: Check if the current run is an autohold target when: - not cifmw_success_flag.stat.exists - zuul is defined - "'ref' in zuul" - "'tenant' in zuul" - "'job' in zuul" - "'project' in zuul" - "'canonical_name' in zuul.project" block: - name: Fetch existing autoholds from zuul vars: _zuul_host: >- {{ zuul.executor.hostname if (zuul.executor.hostname is ansible.utils.ip) else (zuul.executor.hostname | split('.'))[1:] | join('.') }} _zuul_api_url: >- {{ [ ('https://'+ _zuul_host), 'zuul', 'api', 'tenant', zuul.tenant, 'autohold' ] | join('/') }} cifmw_krb_request_url: "{{ zuul_autohold_endpoint | default(_zuul_api_url) }}" ansible.builtin.include_role: name: krb_request apply: ignore_errors: true # noqa: ignore-errors - name: Check if any autohold matches vars: autoholds_returned_data: >- {{ ( cifmw_krb_request_out.response_json | default([]) ) if (not cifmw_krb_request_out.failed) else [] }} autohold_candidates: >- {{ autoholds_returned_data | selectattr('tenant', 'defined') | selectattr('project', 'defined') | selectattr('job', 'defined') | selectattr('current_count', 'defined') | selectattr('max_count', 'defined') | selectattr('tenant', 'equalto', zuul.tenant) | selectattr('project', 'equalto', zuul.project.canonical_name) | selectattr('job', 'equalto', zuul.job) }} matching_candidates: >- {% set matching_holds = [] -%} {% for candidate in autohold_candidates -%} {% if zuul.ref | regex_search(candidate.ref_filter) and (candidate.max_count > candidate.current_count) -%} {% set _ = matching_holds.append(candidate) -%} {% endif -%} {% endfor -%} {{ matching_holds }} when: matching_candidates | length > 0 ansible.builtin.file: path: "{{ ansible_user_dir }}/crc-ci-bootstrap-skip-cleanup" state: touch mode: "0644"