
The prior change Ie8fcf62706cd69f20e29bc1f2f29c5d266ff443f updated some incorrect rsync copy flags to work around AFS permissions. This was something already figured out by the upload-afs-synchronize role which was intended to be a generic way to upload things to AFS with the synchronize module (used by tarball and other artifact publishing). Use it instead to standardise the way we copy. Change-Id: I49afb49dd8301abec44c2aacddb8c62e73e0eb02
57 lines
1.8 KiB
YAML
57 lines
1.8 KiB
YAML
- hosts: localhost
|
|
vars:
|
|
src_dir: "{{ zuul.executor.work_root }}/publish"
|
|
tasks:
|
|
- name: Check execution context
|
|
when: "zuul.branch is not defined"
|
|
fail:
|
|
msg: "This playbook must be run in a branch-based pipeline (e.g., 'promote')."
|
|
- name: Create artifact staging directory
|
|
file:
|
|
state: directory
|
|
path: "{{ zuul.executor.work_root }}/artifacts"
|
|
- name: Download artifacts
|
|
include_role:
|
|
name: download-artifact
|
|
vars:
|
|
# download_artifact_job: provided by zuul job
|
|
download_artifact_api: "https://zuul.opendev.org/api/tenant/{{ zuul.tenant }}"
|
|
# download_artifact_name: provided by zuul job
|
|
download_artifact_pipeline: gate
|
|
download_artifact_directory: "{{ zuul.executor.work_root }}/artifacts"
|
|
- name: Find content tarball artifacts
|
|
find:
|
|
paths: "{{ zuul.executor.work_root }}/artifacts"
|
|
patterns: "*.tar.gz"
|
|
register: files
|
|
- name: Set target directory
|
|
set_fact:
|
|
target_dir: "{{ afs.artifacts_path }}"
|
|
- name: Get an AFS token
|
|
include_role:
|
|
name: create-afs-token
|
|
- name: Ensure unpacking dir exists
|
|
file:
|
|
path: "{{ src_dir }}"
|
|
state: directory
|
|
- name: Ensure target directory exists
|
|
file:
|
|
path: "{{ target_dir }}"
|
|
state: directory
|
|
- name: Unpack into publish dir
|
|
unarchive:
|
|
src: "{{ item.path }}"
|
|
dest: "{{ src_dir }}"
|
|
loop: "{{files.files}}"
|
|
- name: Upload to AFS
|
|
include_role:
|
|
name: upload-afs-synchronize
|
|
vars:
|
|
afs_source: '{{ src_dir }}/'
|
|
afs_target: '{{ target_dir }}/'
|
|
afs_copy_only: false
|
|
delegate_to: "{{ inventory_hostname }}"
|
|
- name: Destroy AFS token
|
|
include_role:
|
|
name: destroy-afs-token
|