|
1 | 1 | ---
|
2 |
| -- name: Upload and create a distribution for an image |
| 2 | +- name: Upload and create a distribution for an artifact |
3 | 3 | hosts: seed
|
4 | 4 | vars:
|
5 | 5 | remote_pulp_url: "{{ stackhpc_release_pulp_url }}"
|
6 |
| - remote_pulp_username: "{{ stackhpc_image_repository_username }}" |
7 |
| - remote_pulp_password: "{{ stackhpc_image_repository_password }}" |
8 |
| - repository_name: kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }} |
9 |
| - pulp_base_path: kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }} |
| 6 | + remote_pulp_username: "{{ stackhpc_release_pulp_username }}" |
| 7 | + remote_pulp_password: "{{ stackhpc_release_pulp_password }}" |
| 8 | + repository_name: "{{ artifact_type }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" |
| 9 | + pulp_base_path: "{{ artifact_type }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" |
10 | 10 | tasks:
|
11 |
| - - name: Print image tag |
| 11 | + - name: Print artifact tag |
12 | 12 | ansible.builtin.debug:
|
13 |
| - msg: "Image tag: {{ host_image_tag }}" |
| 13 | + msg: "artifact tag: {{ artifact_tag }}" |
14 | 14 |
|
15 | 15 | - name: Get filename
|
16 | 16 | ansible.builtin.find:
|
17 |
| - paths: "{{ image_path }}" |
18 |
| - patterns: "*.qcow2" |
| 17 | + paths: "{{ artifact_path }}" |
| 18 | + patterns: "{{ file_regex }}" |
19 | 19 | register: found_files
|
20 | 20 |
|
21 | 21 | - name: Upload an artifact
|
|
109 | 109 | pulp_url: "{{ remote_pulp_url }}"
|
110 | 110 | username: "{{ remote_pulp_username }}"
|
111 | 111 | password: "{{ remote_pulp_password }}"
|
112 |
| - name: "{{ repository_name }}_{{ host_image_tag }}" |
113 |
| - base_path: "{{ pulp_base_path }}/{{ host_image_tag }}" |
| 112 | + name: "{{ repository_name }}_{{ artifact_tag }}" |
| 113 | + base_path: "{{ pulp_base_path }}/{{ artifact_tag }}" |
114 | 114 | publication: "{{ publication_details.publication.pulp_href }}"
|
115 | 115 | content_guard: development
|
116 | 116 | state: present
|
|
120 | 120 | retries: 3
|
121 | 121 | delay: 5
|
122 | 122 |
|
123 |
| - - name: Update new images file with versioned path |
| 123 | + - name: Update new artifacts file with versioned path |
124 | 124 | ansible.builtin.lineinfile:
|
125 |
| - path: /tmp/updated_images.txt |
126 |
| - line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/{{ host_image_tag }}/{{ found_files.files[0].path | basename }}" |
| 125 | + path: /tmp/updated_artifacts.txt |
| 126 | + line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/{{ artifact_tag }}/{{ found_files.files[0].path | basename }}" |
127 | 127 | create: true
|
128 | 128 | listen: Latest distribution details changed
|
129 | 129 |
|
130 |
| - - name: Update new images file with latest path |
| 130 | + - name: Update new artifacts file with latest path |
131 | 131 | ansible.builtin.lineinfile:
|
132 |
| - path: /tmp/updated_images.txt |
| 132 | + path: /tmp/updated_artifacts.txt |
133 | 133 | line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/latest/{{ found_files.files[0].path | basename }}"
|
134 |
| - listen: Latest distribution details changed |
| 134 | + when: latest_distribution_details.changed |
135 | 135 |
|
136 | 136 | - name: Print versioned path
|
137 | 137 | ansible.builtin.debug:
|
138 |
| - msg: "New versioned path: {{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/{{ host_image_tag }}/{{ found_files.files[0].path | basename }}" |
139 |
| - listen: Latest distribution details changed |
| 138 | + msg: "New versioned path: {{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/{{ artifact_tag }}/{{ found_files.files[0].path | basename }}" |
| 139 | + when: latest_distribution_details.changed |
140 | 140 |
|
141 | 141 | - name: Print latest path
|
142 | 142 | ansible.builtin.debug:
|
|
145 | 145 |
|
146 | 146 | - name: Print version tag
|
147 | 147 | ansible.builtin.debug:
|
148 |
| - msg: "New tag: {{ host_image_tag }}" |
149 |
| - listen: Latest distribution details changed |
| 148 | + msg: "New tag: {{ artifact_tag }}" |
| 149 | + when: latest_distribution_details.changed |
0 commit comments