-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync speciifc repo versions to Test Pulp from Ark
- Loading branch information
Showing
4 changed files
with
167 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
name: Sync package repository versions to Test Pulp | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
repo_version: | ||
description: A repository version string maching repository versions to sync from Ark to Test Pulp | ||
type: string | ||
required: false | ||
default: "" | ||
filter: | ||
description: Space-separated list of regular expressions matching short_name of repositories to sync | ||
type: string | ||
required: false | ||
default: "" | ||
|
||
env: | ||
ANSIBLE_FORCE_COLOR: True | ||
ANSIBLE_VAULT_PASSWORD_FILE: ${{ github.workspace }}/vault-pass | ||
|
||
jobs: | ||
package-sync-version-test: | ||
name: Sync specific package repository versions from Ark to Test Pulp | ||
runs-on: [self-hosted, stackhpc-release-train] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Release Train & dependencies | ||
uses: ./.github/actions/setup | ||
with: | ||
vault-password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} | ||
vault-password-file: ${{ env.ANSIBLE_VAULT_PASSWORD_FILE }} | ||
|
||
- name: Sync and publish package repositories in test | ||
run: | | ||
ansible-playbook -i ansible/inventory \ | ||
ansible/test-pulp-repo-specific-version-query.yml \ | ||
ansible/test-pulp-repo-sync.yml \ | ||
ansible/test-pulp-repo-publication-cleanup.yml \ | ||
ansible/test-pulp-repo-publish.yml \ | ||
-e '{test_pulp_sync_repo_version: "$REPO_VERSION"}' | ||
-e deb_package_repo_filter="'$FILTER'" \ | ||
-e rpm_package_repo_filter="'$FILTER'" | ||
env: | ||
FILTER: ${{ github.event.inputs.filter }} | ||
REPO_VERSION: ${{ github.event.inputs.repo_version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--- | ||
# This playbook queries the dev Pulp server for distributions of each | ||
# repository, which match a specific version string. | ||
# The version is extracted from the base_path, and used to set the | ||
# 'test_pulp_repository_deb_repo_versions' and | ||
# 'test_pulp_repository_rpm_repo_versions' facts which contain repository | ||
# versions to sync to the test Pulp server. | ||
|
||
- name: Update test repo versions | ||
hosts: localhost | ||
gather_facts: true | ||
vars: | ||
pulp_url: "{{ dev_pulp_url }}" | ||
pulp_username: "{{ dev_pulp_username }}" | ||
pulp_password: "{{ dev_pulp_password }}" | ||
|
||
tasks: | ||
- name: Test repo version string formatting | ||
ansible.builtin.debug: | ||
msg: "{{ test_pulp_sync_repo_version | to_datetime('%Y%m%dT%H%M%S') }}" | ||
when: test_pulp_sync_repo_version | ||
register: test_formatting | ||
ignore_errors: true | ||
|
||
- name: Fail when test_pulp_sync_repo_version is not of the correct format | ||
ansible.builtin.fail: | ||
msg: "test_pulp_sync_repo_version is not correctly formatted, use %Y%m%dT%H%M%S" | ||
when: | ||
- test_formatting.failed | ||
|
||
- name: Query Deb distributions | ||
pulp.squeezer.deb_distribution: | ||
pulp_url: "{{ pulp_url }}" | ||
username: "{{ pulp_username }}" | ||
password: "{{ pulp_password }}" | ||
register: pulp_deb_dists_list | ||
|
||
- name: Query RPM distributions | ||
pulp.squeezer.rpm_distribution: | ||
pulp_url: "{{ pulp_url }}" | ||
username: "{{ pulp_username }}" | ||
password: "{{ pulp_password }}" | ||
register: pulp_rpm_dists_list | ||
|
||
- name: Set a fact about deb versions to sync | ||
ansible.builtin.set_fact: | ||
test_pulp_repository_deb_repo_versions: >- | ||
{%- set searchstring = item | dirname + '/' -%} | ||
{%- | ||
set shortname = deb_package_repos | ||
| selectattr('base_path', 'defined') | ||
| selectattr('base_path', 'equalto', searchstring) | ||
| map(attribute='short_name') | ||
-%} | ||
{{ | ||
( | ||
test_pulp_repository_deb_repo_versions | default({}) | ||
| combine( | ||
{shortname | first: item | basename} | ||
) | ||
) | ||
if shortname | length > 0 | ||
else ( | ||
test_pulp_repository_deb_repo_versions | default({}) | ||
) | ||
}} | ||
loop: "{{ pulp_deb_dists_list.distributions | selectattr('base_path', 'search', test_pulp_sync_repo_version) | map(attribute='base_path') }}" | ||
|
||
- name: Display deb versions to sync fact | ||
ansible.builtin.debug: | ||
var: test_pulp_repository_deb_repo_versions | ||
|
||
- name: Set a fact about RPM versions to sync | ||
ansible.builtin.set_fact: | ||
test_pulp_repository_rpm_repo_versions: >- | ||
{%- set searchstring = item | dirname + '/' -%} | ||
{%- | ||
set shortname = rpm_package_repos | ||
| selectattr('base_path', 'defined') | ||
| selectattr('base_path', 'equalto', searchstring) | ||
| map(attribute='short_name') | ||
-%} | ||
{{ | ||
( | ||
test_pulp_repository_rpm_repo_versions | default({}) | ||
| combine( | ||
{shortname | first: item | basename} | ||
) | ||
) | ||
if shortname | length > 0 | ||
else ( | ||
test_pulp_repository_rpm_repo_versions | default({}) | ||
) | ||
}} | ||
loop: "{{ pulp_rpm_dists_list.distributions | selectattr('base_path', 'search', test_pulp_sync_repo_version) | map(attribute='base_path') }}" | ||
|
||
- name: Display RPM versions to sync fact | ||
ansible.builtin.debug: | ||
var: test_pulp_repository_rpm_repo_versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters