Allow artifact promote jobs a little more control over renaming

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
This commit is contained in:
James E. Blair 2019-06-12 13:00:30 -07:00
parent c83e5243fb
commit df15c7cb44
2 changed files with 9 additions and 2 deletions

View File

@ -1,7 +1,8 @@
- hosts: localhost - hosts: localhost
vars: vars:
name_replacement: '.*?(-py.*?\.whl|\.tar\.gz)' name_replacement: '.*?(-py.*?\.whl|\.tar\.gz)'
name_target: "{{zuul.project.short_name}}-{{zuul.branch | replace('/', '-')}}\\1" 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: tasks:
- name: Check execution context - name: Check execution context
when: "zuul.branch is not defined" when: "zuul.branch is not defined"

View File

@ -466,9 +466,14 @@
The name of the job which built the artifacts which this The name of the job which built the artifacts which this
job should download and promote. job should download and promote.
.. zuul:jobvar:: download_artifact_name .. zuul:jobvar:: download_artifact_name
The name of the artifact. The name of the artifact.
.. zuul:jobvar:: artifact_extra_name
The artifact will be renamed to PROJECT-BRANCH.ext; if this
argument is present, it will be PROJECT-EXTRA-BRANCH.ext.
abstract: True abstract: True
run: playbooks/artifacts/promote.yaml run: playbooks/artifacts/promote.yaml
nodeset: nodeset:
@ -503,6 +508,7 @@
vars: vars:
download_artifact_job: build-javascript-content-tarball download_artifact_job: build-javascript-content-tarball
download_artifact_name: javascript_content download_artifact_name: javascript_content
artifact_extra_name: js-content
secrets: secrets:
- secret: opendev-zuul-tarballs - secret: opendev-zuul-tarballs
name: afs name: afs