
Several things have bit rotted in here that we need to take care of. First is that we updated the default nodeset to Noble which breaks our ability to install Pillow<10 for blockdiag. To fix this we need to install libjpeg-dev so that we can build a Pillow wheel locally during testing. Next old ansible-lint doesn't run on Noble's python3.12. We bump up Ansible lint to a modern version that matches Zuul's current default Ansible. We also stop installing zuul to get zuul_console and zuul_return and instead simply mock them in the linter. To make this work we have to drop the ansible-playbook syntax check run which is fine because ansible-lint runs this too, but when done via ansible-lint the mocked modules are respected [0]. Finally we have to clean up/ignore some of the new linter warnings/errors. [0] https://ansible.readthedocs.io/projects/lint/rules/syntax-check/ Change-Id: Ia0e936fefc9e2b0f2fa614c93a2f168e14b2825b
60 lines
1.9 KiB
YAML
60 lines
1.9 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
|
|
mode: "0755"
|
|
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
|
|
mode: "0755"
|
|
- name: Ensure target directory exists
|
|
file:
|
|
path: "{{ target_dir }}"
|
|
state: directory
|
|
mode: "0755"
|
|
- name: Unpack into publish dir
|
|
# TODO(clarkb) what is the proper way to set mode here?
|
|
unarchive: # noqa 208
|
|
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
|
|
- name: Destroy AFS token
|
|
include_role:
|
|
name: destroy-afs-token
|