Skip to content

Commit 6d45c8f

Browse files
committed
Preflight: Get certification grade of containers
1 parent 05ed8b8 commit 6d45c8f

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

roles/preflight/tasks/test_preflight_check_container_one_image.yml

+37
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,43 @@
101101
ansible.builtin.debug:
102102
msg: "Do not fail when preflight check container throws an error"
103103
always:
104+
- name: Get image digest
105+
ansible.builtin.shell: >
106+
set -eo pipefail;
107+
skopeo inspect
108+
{% if partner_creds | length %}
109+
--authfile {{ partner_creds }}
110+
{% else %}
111+
--no-creds
112+
{% endif %}
113+
docker://{{ current_operator_image }} | jq -r '.Digest'
114+
register: sha
115+
retries: 2
116+
delay: 30
117+
until: sha is succeeded
118+
119+
- name: Debug image digest
120+
ansible.builtin.debug:
121+
msg: "{{ sha.stdout }}"
122+
123+
- name: "Pull cert grade of {{ current_operator_image }}"
124+
vars:
125+
filter_params: "filter=docker_image_digest%3D%3D{{ sha.stdout }}"
126+
ansible.builtin.uri:
127+
url: >
128+
{{ catalog_url }}/images?{{ filter_params }}&page_size=100&page=0
129+
method: GET
130+
headers:
131+
X-API-KEY: "{{ PYXIS_API_TOKEN }}"
132+
status_code: 200
133+
timeout: 120
134+
register: pyxis_grade_status
135+
136+
- name: "Test_ Preflight: Get cert grade of {{ current_operator_image }}"
137+
debug:
138+
msg: "{{ pyxis_grade_status.json.data[0].freshness_grades[0].grade }}"
139+
when: pyxis_grade_status is defined
140+
104141
- name: Unset pyxis auth to not reuse by following containers
105142
ansible.builtin.set_fact:
106143
cert_project_id: ""

0 commit comments

Comments
 (0)