
In Zuul, we're publishing both the sdist and the js-content tarball, but because of the strict naming rules encoded in the promote job, they are both renamed to "zuul-master.tar.gz". Instead, let the js content job specify that it should have a slightly different name. Change-Id: I57e6173e3ee058665e908aba786f8966a8d812f4
45 lines
1.7 KiB
YAML
45 lines
1.7 KiB
YAML
- hosts: localhost
|
|
vars:
|
|
name_replacement: '.*?(-py.*?\.whl|\.tar\.gz)'
|
|
name_extra: "{{ (artifact_extra_name|default('') and '-'+artifact_extra_name or '') | regex_replace('[^a-zA-z1-9_\\-.]', '') }}"
|
|
name_target: "{{zuul.project.short_name}}{{ name_extra }}-{{zuul.branch | replace('/', '-')}}\\1"
|
|
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 artifacts
|
|
find:
|
|
paths: "{{ zuul.executor.work_root }}/artifacts"
|
|
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 target directory exists
|
|
file:
|
|
path: "{{ target_dir }}"
|
|
state: directory
|
|
- name: Upload to AFS
|
|
command: "cp {{ item.path }} {{ target_dir }}/{{ item.path | basename | regex_replace(name_replacement, name_target) }}"
|
|
when: "item.path is match(name_replacement)"
|
|
loop: "{{files.files}}"
|
|
- name: Destroy AFS token
|
|
include_role:
|
|
name: destroy-afs-token
|