Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@ runs:
# Install python dependencies for ansible server side
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.11.x
python-version: 3.12.x
# Cache Python dependencies
cache: pip

- name: Install Python dependencies
run: |
pip install -r requirements.txt
shell: bash
pip-install: -r requirements.txt

- name: Install Ansible collection dependencies
run: |
Expand All @@ -48,5 +44,5 @@ runs:
# everywhere. It's fine for CI purposes.
- name: Install Python dependencies
run: |
/usr/bin/python3 -m pip install setuptools --break-system-packages
/usr/bin/python3 -m pip install setuptools pulp-glue==0.33.* pulp-glue-deb==0.3.* --break-system-packages
Comment thread
Alex-Welsh marked this conversation as resolved.
shell: bash
105 changes: 94 additions & 11 deletions ansible/test-pulp-repo-version-query.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,48 @@
register: pulp_rpm_dists_list

- vars:
repo: "{{ pulp_deb_repos_list.repositories | selectattr('name', 'equalto', item.repository) | first }}"
pub: "{{ (pulp_deb_pubs_list.publications + pulp_deb_verbatim_pubs_list.publications) | selectattr('repository', 'equalto', repo.pulp_href) | stackhpc.pulp.sort_publications
| first }}"
dist: "{{ pulp_deb_dists_list.distributions | selectattr('publication', 'equalto', pub.pulp_href) | first }}"
repo_list: >-
{{ pulp_deb_repos_list.repositories
| selectattr('name', 'equalto', item.repository)
| list }}
repo: "{{ repo_list[0] if (repo_list | length > 0) else {} }}"
pubs: >-
{{ (pulp_deb_pubs_list.publications + pulp_deb_verbatim_pubs_list.publications)
| selectattr('repository', 'equalto', repo.get('pulp_href', ''))
| stackhpc.pulp.sort_publications | list }}
pub: "{{ pubs[0] if (pubs | length > 0) else {} }}"
base_name: "{{ item.name | regex_replace('-[0-9]{8}T[0-9]{6}$', '') }}"
safe_pattern: "^{{ base_name | regex_escape }}(-[0-9]{8}T[0-9]{6})?$"
existing_dists: >-
{{ pulp_deb_dists_list.distributions
| selectattr('publication', 'equalto', pub.get('pulp_href', ''))
| selectattr('name', 'match', safe_pattern)
| list }}
dist: "{{ existing_dists[0] if (existing_dists | length > 0) else {} }}"

block:
- name: Ensure Deb distributions exist for latest publication
pulp.squeezer.deb_distribution:
pulp_url: "{{ pulp_url }}"
username: "{{ pulp_username }}"
password: "{{ pulp_password }}"
name: "{{ item.name }}"
base_path: "{{ item.base_path }}"
publication: "{{ pub.get('pulp_href') }}"
content_guard: "{{ item.content_guard | default(omit) }}"
state: present
loop: "{{ dev_pulp_distribution_deb }}"
loop_control:
label: "{{ item.repository }}"
when: (pub | length > 0) and (existing_dists | length == 0)

- name: Re-query Deb distributions (to capture newly created ones)
pulp.squeezer.deb_distribution:
pulp_url: "{{ pulp_url }}"
username: "{{ pulp_username }}"
password: "{{ pulp_password }}"
register: pulp_deb_dists_list

- name: Display latest Deb distributions
vars:
info:
Expand All @@ -81,23 +117,66 @@
loop: "{{ dev_pulp_distribution_deb }}"
loop_control:
label: "{{ item.repository }}"
when: pub | length > 0

- name: Set a fact about latest Deb versions
ansible.builtin.set_fact:
test_pulp_repository_deb_repo_versions: "{{ test_pulp_repository_deb_repo_versions | default({}) | combine({item.short_name: dist.base_path | basename})
}}"
test_pulp_repository_deb_repo_versions: >-
{{ test_pulp_repository_deb_repo_versions
| default({})
| combine({item.short_name: dist.base_path | basename}) }}
loop: "{{ dev_pulp_distribution_deb }}"
loop_control:
label: "{{ item.repository }}"
when: dist | length > 0

- name: Display latest versions fact
ansible.builtin.debug:
var: test_pulp_repository_deb_repo_versions

- vars:
repo: "{{ pulp_rpm_repos_list.repositories | selectattr('name', 'equalto', item.repository) | first }}"
pub: "{{ pulp_rpm_pubs_list.publications | selectattr('repository', 'equalto', repo.pulp_href) | stackhpc.pulp.sort_publications | first }}"
dist: "{{ pulp_rpm_dists_list.distributions | selectattr('publication', 'equalto', pub.pulp_href) | first }}"
repo_list: >-
{{ pulp_rpm_repos_list.repositories
| selectattr('name', 'equalto', item.repository)
| list }}
repo: "{{ repo_list[0] if (repo_list | length > 0) else {} }}"
pubs: >-
{{ pulp_rpm_pubs_list.publications
| selectattr('repository', 'equalto', repo.get('pulp_href', ''))
| stackhpc.pulp.sort_publications | list }}
pub: "{{ pubs[0] if (pubs | length > 0) else {} }}"
base_name: "{{ item.name | regex_replace('-[0-9]{8}T[0-9]{6}$', '') }}"
safe_pattern: "^{{ base_name | regex_escape }}(-[0-9]{8}T[0-9]{6})?$"
existing_dists: >-
{{ pulp_rpm_dists_list.distributions
| selectattr('publication', 'equalto', pub.get('pulp_href', ''))
| selectattr('name', 'match', safe_pattern)
| list }}
dist: "{{ existing_dists[0] if (existing_dists | length > 0) else {} }}"

block:
- name: Ensure RPM distributions exist for latest publication
pulp.squeezer.rpm_distribution:
pulp_url: "{{ pulp_url }}"
username: "{{ pulp_username }}"
password: "{{ pulp_password }}"
name: "{{ item.name }}"
base_path: "{{ item.base_path }}"
publication: "{{ pub.get('pulp_href') }}"
content_guard: "{{ item.content_guard | default(omit) }}"
state: present
loop: "{{ dev_pulp_distribution_rpm }}"
loop_control:
label: "{{ item.repository }}"
when: (pub | length > 0) and (existing_dists | length == 0)

- name: Re-query RPM distributions (to capture newly created ones)
pulp.squeezer.rpm_distribution:
pulp_url: "{{ pulp_url }}"
username: "{{ pulp_username }}"
password: "{{ pulp_password }}"
register: pulp_rpm_dists_list

- name: Display latest RPM distributions
vars:
info:
Expand All @@ -109,14 +188,18 @@
loop: "{{ dev_pulp_distribution_rpm }}"
loop_control:
label: "{{ item.repository }}"
when: pub | length > 0

- name: Set a fact about latest RPM versions
ansible.builtin.set_fact:
test_pulp_repository_rpm_repo_versions: "{{ test_pulp_repository_rpm_repo_versions | default({}) | combine({item.short_name: dist.base_path | basename})
}}"
test_pulp_repository_rpm_repo_versions: >-
{{ test_pulp_repository_rpm_repo_versions
| default({})
| combine({item.short_name: dist.base_path | basename}) }}
loop: "{{ dev_pulp_distribution_rpm }}"
loop_control:
label: "{{ item.repository }}"
when: dist | length > 0

- name: Display latest versions fact
ansible.builtin.debug:
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
ansible<14
jmespath==0.10.0
pulp-glue==0.33.*
pulp-glue-deb==0.3.*
Comment thread
Alex-Welsh marked this conversation as resolved.
setuptools
Comment thread
Alex-Welsh marked this conversation as resolved.
9 changes: 4 additions & 5 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
collections:
- name: stackhpc.pulp
version: 0.5.4
- name: community.crypto
version: 2.0.2
- name: https://github.com/stackhpc/ansible-collection-pulp.git
type: git
version: pub-for-dist-2
Comment thread
Alex-Welsh marked this conversation as resolved.
- name: pulp.squeezer
version: 0.0.13
version: 0.3.0
Loading