@@ -88,24 +88,43 @@ function check_image() {
88
88
echo " ---------------------------------------------"
89
89
echo " Checking file: '${runtime_image_file} '"
90
90
91
+ local runtime_image_metadata
91
92
local img_tag
92
93
local img_url
93
94
local img_metadata_config
94
95
local img_created
95
96
local img_commit_ref
96
97
local img_name
97
98
98
- img_tag=$( jq -r ' .metadata.tags[0]' " ${runtime_image_file} " ) || {
99
+ runtime_image_metadata=$( yq -r ' .spec.tags[0].annotations."opendatahub.io/runtime-image-metadata"' " ${runtime_image_file} " ) || {
100
+ echo " ERROR: Couldn't parse runtime image metadata for '${runtime_image_file} ' file!"
101
+ return 1
102
+ }
103
+ echo " Runtime image metadata: '${runtime_image_metadata} '"
104
+
105
+ # There are 2 places in the current runtime imagestreams where the image url is saved today.
106
+ img_url_from=$( yq -r ' .spec.tags[0].from.name' " ${runtime_image_file} " ) || {
107
+ echo " ERROR: Couldn't parse image URL from '.spec.tags[0].from.name' field for '${runtime_image_file} ' file!"
108
+ return 1
109
+ }
110
+ echo " Image URL from '.spec.tags[0].from.name' field: '${img_url_from} '"
111
+
112
+ img_tag=$( echo " ${runtime_image_metadata} " | jq -r ' .[0].metadata.tags[0]' ) || {
99
113
echo " ERROR: Couldn't parse image tags metadata for '${runtime_image_file} ' runtime image file!"
100
114
return 1
101
115
}
102
116
echo " Image tag: '${img_tag} '"
103
117
104
- img_url=$( jq -r ' .metadata.image_name' " ${runtime_image_file} " ) || {
105
- echo " ERROR: Couldn't parse image URL metadata for '${runtime_image_file} ' runtime image file!"
118
+ img_url=$( echo " ${runtime_image_metadata} " | jq -r ' .[0].metadata.image_name' ) || {
119
+ echo " ERROR: Couldn't parse image URL from image JSON metadata for '${runtime_image_file} ' runtime image file!"
120
+ return 1
121
+ }
122
+ echo " Image URL from JSON metadata: '${img_url} '"
123
+
124
+ test " ${img_url_from} " == " ${img_url} " || {
125
+ echo " ERROR: The image URL in '.spec.tags[0].from.name' doesn't match what is provide in JSON metadata in '${runtime_image_file} ' runtime image file!"
106
126
return 1
107
127
}
108
- echo " Image URL: '${img_url} '"
109
128
110
129
img_metadata_config=" $( skopeo inspect --retry-times " ${SKOPEO_RETRY} " --config " docker://${img_url} " ) " || {
111
130
echo " ERROR: Couldn't download '${img_url} ' image config metadata with skopeo tool!"
@@ -175,8 +194,7 @@ function check_image() {
175
194
function main() {
176
195
ret_code=0
177
196
178
- # If name of the directory isn't good enough, maybe we can improve this to search for the: `"schema_name": "runtime-image"` string.
179
- runtime_image_files=$( find . -name " *.json" | grep " runtime-images" | sort --unique)
197
+ runtime_image_files=$( find . -name " *imagestream.yaml" | grep " runtime" | sort --unique)
180
198
181
199
IFS=$' \n '
182
200
for file in ${runtime_image_files} ; do
0 commit comments