--- # First let's ensure that the internal tenant does not contain any Zuul configuration error - ansible.builtin.include_role: name: "health-check/check-zuul-tenant" vars: tenant_name: "internal" - name: Set random value ansible.builtin.set_fact: random: "{{ lookup('community.general.random_string', special=false, length=8) }}" - name: Create vars to generate and submit resources addition ansible.builtin.set_fact: repository_name: "ichiban-config-{{ random }}" tenant_name: "ichiban-tenant-{{ random }}" - ansible.builtin.include_role: name: "create-gerrit-repository" # First attempt a negative test where we expect a failure - name: Set bad Zuul tenant config ansible.builtin.blockinfile: content: | - tenant: name: {{ tenant_name }} souRZe: {} path: "{{ config_path }}/zuul/main.yaml" create: true - name: Commit file in the config repo ansible.builtin.command: "{{ item }}" args: chdir: "{{ config_path }}" loop: - "git add zuul/main.yaml" - "git commit -m 'Add zuul/main.yaml'" - ansible.builtin.include_role: name: "health-check/repo-submit-change" vars: ensure_job_failure: true # Now proceed with adding a correct tenant file - name: Set Zuul tenant config ansible.builtin.blockinfile: content: | - tenant: name: {{ tenant_name }} source: gerrit: config-projects: - {{ repository_name }} path: "{{ config_path }}/zuul/main.yaml" create: true - name: Commit file in the config repo ansible.builtin.command: "{{ item }}" args: chdir: "{{ config_path }}" loop: - "git add zuul/main.yaml" - "git commit --amend --no-edit" - name: Submit change and verify Zuul console output vars: check_zuul_console: true ansible.builtin.include_role: name: "health-check/repo-submit-change" - ansible.builtin.set_fact: zuul_config_update_build_log_url: "{{ (zuul_job_result.json | list)[0].log_url }}" check_gz_redirection: true - name: Check that Zuul has pushed the job console on the logserver ansible.builtin.include_role: name: "health-check/ensure-job-result-artifacts" vars: log_url: "{{ zuul_config_update_build_log_url }}" - name: Get Zuul projects list ansible.builtin.uri: url: "https://{{ zuul_endpoint }}/api/tenant/{{ tenant_name }}/projects" validate_certs: "{{ validate_certs }}" method: GET register: zuul_tenant_projects retries: "{{ zuul_api_retries }}" delay: "{{ zuul_api_delay }}" - name: Ensure project exists in Zuul (fail if not) ansible.builtin.fail: msg: "Project not found in Zuul" when: not (zuul_tenant_projects.json | selectattr('name', 'equalto', repository_name) | length == 1)