|
63 | 63 | password: "{{ pulp_password }}" |
64 | 64 | register: pulp_rpm_dists_list |
65 | 65 |
|
66 | | - - vars: |
67 | | - repo_list: >- |
68 | | - {{ pulp_deb_repos_list.repositories |
69 | | - | selectattr('name', 'equalto', item.repository) |
70 | | - | list }} |
71 | | - repo: "{{ repo_list[0] if (repo_list | length > 0) else {} }}" |
72 | | - pubs: >- |
73 | | - {{ (pulp_deb_pubs_list.publications + pulp_deb_verbatim_pubs_list.publications) |
74 | | - | selectattr('repository', 'equalto', repo.get('pulp_href', '')) |
75 | | - | stackhpc.pulp.sort_publications | list }} |
76 | | - pub: "{{ pubs[0] if (pubs | length > 0) else {} }}" |
77 | | - base_name: "{{ item.name | regex_replace('-[0-9]{8}T[0-9]{6}$', '') }}" |
78 | | - safe_pattern: "^{{ base_name | regex_escape }}(-[0-9]{8}T[0-9]{6})?$" |
79 | | - existing_dists: >- |
80 | | - {{ pulp_deb_dists_list.distributions |
81 | | - | selectattr('publication', 'equalto', pub.get('pulp_href', '')) |
82 | | - | selectattr('name', 'match', safe_pattern) |
83 | | - | list }} |
84 | | - dist: "{{ existing_dists[0] if (existing_dists | length > 0) else {} }}" |
85 | | - |
86 | | - block: |
87 | | - - name: Ensure Deb distributions exist for latest publication |
88 | | - pulp.squeezer.deb_distribution: |
89 | | - pulp_url: "{{ pulp_url }}" |
90 | | - username: "{{ pulp_username }}" |
91 | | - password: "{{ pulp_password }}" |
92 | | - name: "{{ item.name }}" |
93 | | - base_path: "{{ item.base_path }}" |
94 | | - publication: "{{ pub.get('pulp_href') }}" |
95 | | - content_guard: "{{ item.content_guard | default(omit) }}" |
96 | | - state: present |
97 | | - loop: "{{ dev_pulp_distribution_deb }}" |
98 | | - loop_control: |
99 | | - label: "{{ item.repository }}" |
100 | | - when: (pub | length > 0) and (existing_dists | length == 0) |
101 | | - |
102 | | - - name: Re-query Deb distributions (to capture newly created ones) |
103 | | - pulp.squeezer.deb_distribution: |
104 | | - pulp_url: "{{ pulp_url }}" |
105 | | - username: "{{ pulp_username }}" |
106 | | - password: "{{ pulp_password }}" |
107 | | - register: pulp_deb_dists_list |
108 | | - |
109 | | - - name: Display latest Deb distributions |
110 | | - vars: |
111 | | - info: |
112 | | - repo: "{{ repo }}" |
113 | | - pub: "{{ pub }}" |
114 | | - dist: "{{ dist }}" |
115 | | - ansible.builtin.debug: |
116 | | - var: info |
117 | | - loop: "{{ dev_pulp_distribution_deb }}" |
118 | | - loop_control: |
119 | | - label: "{{ item.repository }}" |
120 | | - when: |
121 | | - - release_train_debug | bool |
122 | | - - pub | length > 0 |
123 | | - |
124 | | - - name: Set a fact about latest Deb versions |
125 | | - ansible.builtin.set_fact: |
126 | | - test_pulp_repository_deb_repo_versions: >- |
127 | | - {{ test_pulp_repository_deb_repo_versions |
128 | | - | default({}) |
129 | | - | combine({item.short_name: dist.base_path | basename}) }} |
130 | | - loop: "{{ dev_pulp_distribution_deb }}" |
131 | | - loop_control: |
132 | | - label: "{{ item.repository }}" |
133 | | - when: dist | length > 0 |
134 | | - |
135 | | - - name: Display latest versions fact |
136 | | - ansible.builtin.debug: |
137 | | - var: test_pulp_repository_deb_repo_versions |
138 | | - when: |
139 | | - - release_train_debug | bool |
140 | | - |
141 | | - - vars: |
142 | | - repo_list: >- |
143 | | - {{ pulp_rpm_repos_list.repositories |
144 | | - | selectattr('name', 'equalto', item.repository) |
145 | | - | list }} |
146 | | - repo: "{{ repo_list[0] if (repo_list | length > 0) else {} }}" |
147 | | - pubs: >- |
148 | | - {{ pulp_rpm_pubs_list.publications |
149 | | - | selectattr('repository', 'equalto', repo.get('pulp_href', '')) |
150 | | - | stackhpc.pulp.sort_publications | list }} |
151 | | - pub: "{{ pubs[0] if (pubs | length > 0) else {} }}" |
152 | | - base_name: "{{ item.name | regex_replace('-[0-9]{8}T[0-9]{6}$', '') }}" |
153 | | - safe_pattern: "^{{ base_name | regex_escape }}(-[0-9]{8}T[0-9]{6})?$" |
154 | | - existing_dists: >- |
155 | | - {{ pulp_rpm_dists_list.distributions |
156 | | - | selectattr('publication', 'equalto', pub.get('pulp_href', '')) |
157 | | - | selectattr('name', 'match', safe_pattern) |
158 | | - | list }} |
159 | | - dist: "{{ existing_dists[0] if (existing_dists | length > 0) else {} }}" |
160 | | - |
161 | | - block: |
162 | | - - name: Ensure RPM distributions exist for latest publication |
163 | | - pulp.squeezer.rpm_distribution: |
164 | | - pulp_url: "{{ pulp_url }}" |
165 | | - username: "{{ pulp_username }}" |
166 | | - password: "{{ pulp_password }}" |
167 | | - name: "{{ item.name }}" |
168 | | - base_path: "{{ item.base_path }}" |
169 | | - publication: "{{ pub.get('pulp_href') }}" |
170 | | - content_guard: "{{ item.content_guard | default(omit) }}" |
171 | | - state: present |
172 | | - loop: "{{ dev_pulp_distribution_rpm }}" |
173 | | - loop_control: |
174 | | - label: "{{ item.repository }}" |
175 | | - when: (pub | length > 0) and (existing_dists | length == 0) |
176 | | - |
177 | | - - name: Re-query RPM distributions (to capture newly created ones) |
178 | | - pulp.squeezer.rpm_distribution: |
179 | | - pulp_url: "{{ pulp_url }}" |
180 | | - username: "{{ pulp_username }}" |
181 | | - password: "{{ pulp_password }}" |
182 | | - register: pulp_rpm_dists_list |
183 | | - |
184 | | - - name: Display latest RPM distributions |
185 | | - vars: |
186 | | - info: |
187 | | - repo: "{{ repo }}" |
188 | | - pub: "{{ pub }}" |
189 | | - dist: "{{ dist }}" |
190 | | - ansible.builtin.debug: |
191 | | - var: info |
192 | | - loop: "{{ dev_pulp_distribution_rpm }}" |
193 | | - loop_control: |
194 | | - label: "{{ item.repository }}" |
195 | | - when: |
196 | | - - release_train_debug | bool |
197 | | - - pub | length > 0 |
198 | | - |
199 | | - - name: Set a fact about latest RPM versions |
200 | | - ansible.builtin.set_fact: |
201 | | - test_pulp_repository_rpm_repo_versions: >- |
202 | | - {{ test_pulp_repository_rpm_repo_versions |
203 | | - | default({}) |
204 | | - | combine({item.short_name: dist.base_path | basename}) }} |
205 | | - loop: "{{ dev_pulp_distribution_rpm }}" |
206 | | - loop_control: |
207 | | - label: "{{ item.repository }}" |
208 | | - when: dist | length > 0 |
209 | | - |
210 | | - - name: Display latest versions fact |
211 | | - ansible.builtin.debug: |
212 | | - var: test_pulp_repository_rpm_repo_versions |
213 | | - when: |
214 | | - - release_train_debug | bool |
| 66 | + - name: Create missing Deb distributions for the latest publication |
| 67 | + pulp.squeezer.deb_distribution: |
| 68 | + pulp_url: "{{ pulp_url }}" |
| 69 | + username: "{{ pulp_username }}" |
| 70 | + password: "{{ pulp_password }}" |
| 71 | + name: "{{ item.name }}" |
| 72 | + base_path: "{{ item.base_path }}" |
| 73 | + publication: "{{ item.publication }}" |
| 74 | + content_guard: "{{ item.content_guard | default(omit) }}" |
| 75 | + state: present |
| 76 | + loop: >- |
| 77 | + {{ dev_pulp_distribution_deb |
| 78 | + | distributions_to_create( |
| 79 | + pulp_deb_repos_list.repositories, |
| 80 | + pulp_deb_pubs_list.publications |
| 81 | + + pulp_deb_verbatim_pubs_list.publications, |
| 82 | + pulp_deb_dists_list.distributions) }} |
| 83 | + loop_control: |
| 84 | + label: "{{ item.repository }}" |
| 85 | + register: deb_dists_created |
| 86 | + |
| 87 | + - name: Re-query Deb distributions (to capture newly created ones) |
| 88 | + pulp.squeezer.deb_distribution: |
| 89 | + pulp_url: "{{ pulp_url }}" |
| 90 | + username: "{{ pulp_username }}" |
| 91 | + password: "{{ pulp_password }}" |
| 92 | + register: pulp_deb_dists_requery |
| 93 | + when: deb_dists_created is changed # noqa: no-handler |
| 94 | + |
| 95 | + - name: Set a fact about latest Deb versions |
| 96 | + ansible.builtin.set_fact: |
| 97 | + test_pulp_repository_deb_repo_versions: >- |
| 98 | + {{ dev_pulp_distribution_deb |
| 99 | + | latest_repo_versions( |
| 100 | + pulp_deb_repos_list.repositories, |
| 101 | + pulp_deb_pubs_list.publications |
| 102 | + + pulp_deb_verbatim_pubs_list.publications, |
| 103 | + pulp_deb_dists_requery.distributions |
| 104 | + | default(pulp_deb_dists_list.distributions, true)) }} |
| 105 | +
|
| 106 | + - name: Display latest Deb versions |
| 107 | + ansible.builtin.debug: |
| 108 | + var: test_pulp_repository_deb_repo_versions |
| 109 | + when: release_train_debug | bool |
| 110 | + |
| 111 | + - name: Create missing RPM distributions for the latest publication |
| 112 | + pulp.squeezer.rpm_distribution: |
| 113 | + pulp_url: "{{ pulp_url }}" |
| 114 | + username: "{{ pulp_username }}" |
| 115 | + password: "{{ pulp_password }}" |
| 116 | + name: "{{ item.name }}" |
| 117 | + base_path: "{{ item.base_path }}" |
| 118 | + publication: "{{ item.publication }}" |
| 119 | + content_guard: "{{ item.content_guard | default(omit) }}" |
| 120 | + state: present |
| 121 | + loop: >- |
| 122 | + {{ dev_pulp_distribution_rpm |
| 123 | + | distributions_to_create( |
| 124 | + pulp_rpm_repos_list.repositories, |
| 125 | + pulp_rpm_pubs_list.publications, |
| 126 | + pulp_rpm_dists_list.distributions) }} |
| 127 | + loop_control: |
| 128 | + label: "{{ item.repository }}" |
| 129 | + register: rpm_dists_created |
| 130 | + |
| 131 | + - name: Re-query RPM distributions (to capture newly created ones) |
| 132 | + pulp.squeezer.rpm_distribution: |
| 133 | + pulp_url: "{{ pulp_url }}" |
| 134 | + username: "{{ pulp_username }}" |
| 135 | + password: "{{ pulp_password }}" |
| 136 | + register: pulp_rpm_dists_requery |
| 137 | + when: rpm_dists_created is changed # noqa: no-handler |
| 138 | + |
| 139 | + - name: Set a fact about latest RPM versions |
| 140 | + ansible.builtin.set_fact: |
| 141 | + test_pulp_repository_rpm_repo_versions: >- |
| 142 | + {{ dev_pulp_distribution_rpm |
| 143 | + | latest_repo_versions( |
| 144 | + pulp_rpm_repos_list.repositories, |
| 145 | + pulp_rpm_pubs_list.publications, |
| 146 | + pulp_rpm_dists_requery.distributions |
| 147 | + | default(pulp_rpm_dists_list.distributions, true)) }} |
| 148 | +
|
| 149 | + - name: Display latest RPM versions |
| 150 | + ansible.builtin.debug: |
| 151 | + var: test_pulp_repository_rpm_repo_versions |
| 152 | + when: release_train_debug | bool |
| 153 | + |
| 154 | + - name: Fail if no RPM repository versions were resolved |
| 155 | + ansible.builtin.assert: |
| 156 | + that: test_pulp_repository_rpm_repo_versions | length > 0 |
| 157 | + fail_msg: "No RPM repository versions resolved from {{ pulp_url }}" |
| 158 | + when: dev_pulp_distribution_rpm | length > 0 |
| 159 | + |
| 160 | + - name: Fail if no Deb repository versions were resolved |
| 161 | + ansible.builtin.assert: |
| 162 | + that: test_pulp_repository_deb_repo_versions | length > 0 |
| 163 | + fail_msg: "No Deb repository versions resolved from {{ pulp_url }}" |
| 164 | + when: dev_pulp_distribution_deb | length > 0 |
0 commit comments