Skip to content

Commit f62b7d4

Browse files
Add checksum support
1 parent 1c5d937 commit f62b7d4

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

etc/kayobe/ansible/pulp-artifact-upload.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
remote_pulp_password: "{{ stackhpc_release_pulp_password }}"
88
repository_name: "{{ artifact_type }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}"
99
pulp_base_path: "{{ artifact_type }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}"
10+
upload_checksum: false
1011
tasks:
1112
- name: Print artifact tag
1213
debug:
@@ -36,6 +37,25 @@
3637
checksum_algorithm: sha256
3738
register: file_stats
3839

40+
- name: Write checksum to file
41+
ansible.builtin.copy:
42+
content: "{{ file_stats.stat.checksum }}"
43+
dest: "/tmp/{{ found_files.files[0].path | basename }}.sha256"
44+
when: upload_checksum
45+
46+
- name: Upload checksum artifact
47+
pulp.squeezer.artifact:
48+
pulp_url: "{{ remote_pulp_url }}"
49+
username: "{{ remote_pulp_username }}"
50+
password: "{{ remote_pulp_password }}"
51+
file: "/tmp/{{ found_files.files[0].path | basename }}.sha256"
52+
state: present
53+
register: checksum_upload_result
54+
until: checksum_upload_result is success
55+
retries: 3
56+
delay: 60
57+
when: upload_checksum
58+
3959
- name: Create file content from artifact
4060
pulp.squeezer.file_content:
4161
pulp_url: "{{ remote_pulp_url }}"
@@ -49,6 +69,19 @@
4969
retries: 3
5070
delay: 5
5171

72+
- name: Create checksum content from artifact
73+
pulp.squeezer.file_content:
74+
pulp_url: "{{ remote_pulp_url }}"
75+
username: "{{ remote_pulp_username }}"
76+
password: "{{ remote_pulp_password }}"
77+
relative_path: "{{ found_files.files[0].path | basename }}.sha256"
78+
state: present
79+
register: checksum_content_result
80+
until: checksum_content_result is success
81+
retries: 3
82+
delay: 5
83+
when: upload_checksum
84+
5285
- name: Ensure file repo exists
5386
pulp.squeezer.file_repository:
5487
pulp_url: "{{ remote_pulp_url }}"
@@ -75,6 +108,20 @@
75108
retries: 3
76109
delay: 5
77110

111+
- name: Add checksum content to file repo
112+
pulp.squeezer.file_repository_content:
113+
pulp_url: "{{ remote_pulp_url }}"
114+
username: "{{ remote_pulp_username }}"
115+
password: "{{ remote_pulp_password }}"
116+
repository: "{{ repository_name }}"
117+
present_content:
118+
- relative_path: "{{ found_files.files[0].path | basename }}.sha256"
119+
register: checksum_repo_content_result
120+
until: checksum_repo_content_result is success
121+
retries: 3
122+
delay: 5
123+
when: upload_checksum
124+
78125
- name: Create a new publication to point to this version
79126
pulp.squeezer.file_publication:
80127
pulp_url: "{{ remote_pulp_url }}"

0 commit comments

Comments
 (0)