diff --git a/doc/source/misc-jobs.rst b/doc/source/misc-jobs.rst index 33685e4..8b81f9b 100644 --- a/doc/source/misc-jobs.rst +++ b/doc/source/misc-jobs.rst @@ -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 diff --git a/playbooks/artifacts/promote-deployment.yaml b/playbooks/artifacts/promote-deployment.yaml new file mode 100644 index 0000000..994cd2b --- /dev/null +++ b/playbooks/artifacts/promote-deployment.yaml @@ -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 diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 5c11652..95043d2 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -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.