- block:
    - name: Fetch archive
      synchronize:
        dest: "{{ zuul.executor.log_root }}/{{ fetch_doc_artifacts_name }}.{{ patch_type }}.patch"
        mode: pull
        src: "{{ patch_file }}"
        verify_host: true
        owner: no
        group: no
  when: not zuul_use_fetch_output

- block:
    - name: Copy archive
      copy:
        dest: "{{ zuul_output_dir }}/logs/{{ fetch_doc_artifacts_name }}.{{ patch_type }}.patch"
        src: "{{ patch_file }}"
        mode: 0644
        remote_src: true
  when: zuul_use_fetch_output

- name: Return artifact to Zuul
  zuul_return:
    data:
      zuul:
        artifacts:
          - name: "{{ fetch_doc_artifacts_name }} {{ patch_type }} patch"
            url: "{{ fetch_doc_artifacts_name }}.{{ patch_type }}.patch"
            metadata:
              type: "patch"
              doc_service: "{{ doc.service_type }}"
              doc_type: "{{ doc.doc_type }}"
              patch_type: "{{ patch_type }}"
