[stable/2023.1] Refactor collection build (#1333)
diff --git a/roles/defaults/vars/main.yml b/roles/defaults/vars/main.yml
index 6c0eba1..959fff7 100644
--- a/roles/defaults/vars/main.yml
+++ b/roles/defaults/vars/main.yml
@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
-atmosphere_release: 2023.1
+atmosphere_release: "2023.1"
_atmosphere_images:
alertmanager: quay.io/prometheus/alertmanager:v0.27.0
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 629b16c..90d4a43 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -5,17 +5,15 @@
- job:
name: atmosphere-build-collection
+ parent: build-ansible-collection
pre-run: zuul.d/playbooks/build-collection/pre.yml
- run: zuul.d/playbooks/build-collection/run.yml
irrelevant-files:
- ^doc/
- job:
name: atmosphere-publish-collection
- parent: atmosphere-build-collection
- post-run: zuul.d/playbooks/build-collection/publish.yml
- secrets:
- - ansible_galaxy_info
+ parent: publish-ansible-collection-vexxhost
+ pre-run: zuul.d/playbooks/build-collection/pre.yml
- job:
name: atmosphere-molecule
diff --git a/zuul.d/playbooks/build-collection/pre.yml b/zuul.d/playbooks/build-collection/pre.yml
index 5b3ea59..d60ccee 100644
--- a/zuul.d/playbooks/build-collection/pre.yml
+++ b/zuul.d/playbooks/build-collection/pre.yml
@@ -12,26 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
-- hosts: all
- roles:
- - ensure-python
- - ensure-pip
- - ensure-tox
-
-- name: Install Ansible
+- name: Prepare for collection build
hosts: all
- vars:
- ansible_venv_path: '{{ ansible_user_dir }}/.local/ansible'
- ensure_ansible_version: ''
tasks:
- - name: Create local venv
- command: '{{ ensure_pip_virtualenv_command }} {{ ansible_venv_path }}'
+ - name: Pin all image digests
+ ansible.builtin.include_role:
+ name: tox
+ vars:
+ tox_envlist: pin-digests
- - name: Install Ansible to local venv
- command: '{{ ansible_venv_path }}/bin/pip install ansible{{ ensure_ansible_version }}'
-
- - name: Export installed ansible paths
- set_fact:
- ansible_executable: '{{ ansible_venv_path }}/bin/ansible'
- ansible_galaxy_executable: '{{ ansible_venv_path }}/bin/ansible-galaxy'
- cacheable: true
+ - name: Print out the new image manifest file
+ ansible.builtin.command: |
+ cat {{ zuul.project.src_dir }}/roles/defaults/vars/main.yml
diff --git a/zuul.d/playbooks/build-collection/publish.yml b/zuul.d/playbooks/build-collection/publish.yml
deleted file mode 100644
index d188da4..0000000
--- a/zuul.d/playbooks/build-collection/publish.yml
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright (c) 2024 VEXXHOST, Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-- hosts: all
- tasks:
- - name: Find tarballs in the source directory.
- find:
- file_type: file
- paths: "{{ zuul.project.src_dir }}"
- patterns: "*.tar.gz"
- register: result
-
- - name: Display stat for tarballs and wheels.
- stat:
- path: "{{ item.path }}"
- with_items: "{{ result.files }}"
-
- - name: Publish content to Ansible Galaxy
- block:
- - name: Create ansible.cfg configuration file tempfile
- tempfile:
- state: file
- suffix: .cfg
- register: _ansiblecfg_tmp
-
- - name: Create ansible.cfg configuration file
- copy:
- dest: "{{ _ansiblecfg_tmp.path }}"
- mode: 0600
- content: |
- [galaxy]
- server_list = release_galaxy
-
- [galaxy_server.release_galaxy]
- url = {{ ansible_galaxy_info.url }}
- token = {{ ansible_galaxy_info.token }}
-
- - name: Publish collection to Ansible Galaxy / Automation Hub
- environment:
- ANSIBLE_CONFIG: "{{ _ansiblecfg_tmp.path }}"
- ansible.builtin.shell: |
- {{ ansible_galaxy_executable }} collection publish -vvv {{ item.path }}
- loop: "{{ result.files }}"
-
- always:
- - name: Shred ansible-galaxy credentials
- command: "shred {{ _ansiblecfg_tmp.path }}"