|
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 | debug:
|
13 |
| - msg: "Image tag: {{ host_image_tag }}" |
| 13 | + msg: "artifact tag: {{ artifact_tag }}" |
14 | 14 |
|
15 | 15 | - name: Get filename
|
16 | 16 | 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
|
|
107 | 107 | pulp_url: "{{ remote_pulp_url }}"
|
108 | 108 | username: "{{ remote_pulp_username }}"
|
109 | 109 | password: "{{ remote_pulp_password }}"
|
110 |
| - name: "{{ repository_name }}_{{ host_image_tag }}" |
111 |
| - base_path: "{{ pulp_base_path }}/{{ host_image_tag }}" |
| 110 | + name: "{{ repository_name }}_{{ artifact_tag }}" |
| 111 | + base_path: "{{ pulp_base_path }}/{{ artifact_tag }}" |
112 | 112 | publication: "{{ publication_details.publication.pulp_href }}"
|
113 | 113 | content_guard: development
|
114 | 114 | state: present
|
|
118 | 118 | retries: 3
|
119 | 119 | delay: 5
|
120 | 120 |
|
121 |
| - - name: Update new images file with versioned path |
| 121 | + - name: Update new artifacts file with versioned path |
122 | 122 | lineinfile:
|
123 |
| - path: /tmp/updated_images.txt |
| 123 | + path: /tmp/updated_artifacts.txt |
124 | 124 | line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\
|
125 |
| - {{ host_image_tag }}/{{ found_files.files[0].path | basename }}" |
| 125 | + {{ artifact_tag }}/{{ found_files.files[0].path | basename }}" |
126 | 126 | create: true
|
127 | 127 |
|
128 |
| - - name: Update new images file with latest path |
| 128 | + - name: Update new artifacts file with latest path |
129 | 129 | lineinfile:
|
130 |
| - path: /tmp/updated_images.txt |
| 130 | + path: /tmp/updated_artifacts.txt |
131 | 131 | line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\
|
132 | 132 | latest/{{ found_files.files[0].path | basename }}"
|
133 | 133 | when: latest_distribution_details.changed
|
134 | 134 |
|
135 | 135 | - name: Print versioned path
|
136 | 136 | debug:
|
137 | 137 | msg: "New versioned path: {{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\
|
138 |
| - {{ host_image_tag }}/{{ found_files.files[0].path | basename }}" |
| 138 | + {{ artifact_tag }}/{{ found_files.files[0].path | basename }}" |
139 | 139 | when: latest_distribution_details.changed
|
140 | 140 |
|
141 | 141 | - name: Print latest path
|
|
146 | 146 |
|
147 | 147 | - name: Print version tag
|
148 | 148 | debug:
|
149 |
| - msg: "New tag: {{ host_image_tag }}" |
| 149 | + msg: "New tag: {{ artifact_tag }}" |
150 | 150 | when: latest_distribution_details.changed
|
0 commit comments