Add jobs for publishing javascript content

The new javascript jobs need a new promote job for the tarballs,
but also need a new promote job for publishing the content
inside those tarballs.

Change-Id: I437795ae30384bb8d759e19907d5a91426ab3e46
This commit is contained in:
Monty Taylor 2020-05-14 09:13:22 -05:00
parent d825c505bd
commit 94afcb4057
3 changed files with 102 additions and 0 deletions

View File

@ -4,5 +4,7 @@ Miscellaneous Jobs
.. zuul:autojob:: opendev-promote-artifact-base
.. zuul:autojob:: opendev-promote-python
.. zuul:autojob:: opendev-promote-javascript-content
.. zuul:autojob:: opendev-promote-javascript-deployment
.. zuul:autojob:: opendev-promote-javascript-deployment-tarball
.. zuul:autojob:: opendev-release-python
.. zuul:autojob:: opendev-upload-git-mirror

View File

@ -0,0 +1,55 @@
- 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
synchronize:
delete: yes
recursive: yes
src: "{{ src_dir }}/"
dest: "{{ target_dir }}/"
delegate_to: "{{ inventory_hostname }}"
- name: Destroy AFS token
include_role:
name: destroy-afs-token

View File

@ -485,6 +485,51 @@
name: afs
pass-to-parent: true
- job:
name: opendev-promote-javascript-deployment-tarball
parent: opendev-promote-artifact-base
description: |
Publish a previously built branch-tip javascript content archive.
Use this in the promote pipeline to publish a branch tip
javascript content archive built in the gate pipeline.
vars:
download_artifact_job: build-javascript-deployment
download_artifact_type: javascript_content
artifact_extra_name: js-content
secrets:
- secret: opendev-zuul-tarballs
name: afs
pass-to-parent: true
- job:
name: opendev-promote-javascript-deployment
parent: opendev-promote-artifact-base
description: |
Publish previously built branch-tip javascript content
Use this in the promote pipeline to publish branch tip
javascript content built in the gate pipeline. Expects
a tarball to have been published which will be extracted
into the target location.
.. zuul:jobvar:: download_artifact_job
The name of the job which built the artifacts which this
job should download and promote.
.. zuul:jobvar:: download_artifact_type
The type of the artifact to download (as specified in the
``type`` attribute of the artifact metadata).
run: playbooks/artifacts/promote-deployment.yaml
vars:
download_artifact_job: build-javascript-deployment
download_artifact_type: javascript_content
secrets:
- secret: opendev-zuul-tarballs
name: afs
- job:
name: opendev-release-python
description: Release python tarballs / wheels to pypi.