Skip to content

Commit

Permalink
[CI] check-params-env.sh prints also time of creation of the checked …
Browse files Browse the repository at this point in the history
…image
  • Loading branch information
jstourac committed Jun 15, 2024
1 parent 51ab41b commit e8b721c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ci/check-params-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ function check_image() {
local image_name
local image_commit_id
local image_commitref
local image_created

image_metadata="$(skopeo inspect --config "docker://${image_url}")" || {
echo "Couldn't download image metadata with skopeo tool!"
Expand All @@ -265,6 +266,10 @@ function check_image() {
echo "Couldn't parse '.config.Labels."io.openshift.build.commit.ref"' from image metadata!"
return 1
}
image_created=$(echo "${image_metadata}" | jq --raw-output '.created') || {
echo "Couldn't parse '.created' from image metadata!"
return 1
}

local config_env
local build_name_raw
Expand All @@ -289,6 +294,7 @@ function check_image() {
}

echo "Image name retrieved: '${image_name}'"
echo "Image created: '${image_created}'"

check_image_variable_matches_name_and_commitref "${image_variable}" "${image_name}" "${image_commitref}" "${openshift_build_name}" || return 1

Expand Down
8 changes: 8 additions & 0 deletions ci/check-runtime-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function check_image() {
local img_tag
local img_url
local img_metadata
local img_created

img_tag=$(jq -r '.metadata.tags[0]' "${runtime_image_file}") || {
echo "ERROR: Couldn't parse image tags metadata for '${runtime_image_file}' runtime image file!"
Expand All @@ -42,13 +43,20 @@ function check_image() {
return 1
}

img_created=$(echo "${img_metadata}" | jq --raw-output '.created') || {
echo "Couldn't parse '.created' from image metadata!"
return 1
}

local expected_string="runtime-${img_tag}-ubi"
echo "Checking that '${expected_string}' is present in the image metadata"
echo "${img_metadata}" | grep --quiet "${expected_string}" || {
echo "ERROR: The string '${expected_string}' isn't present in the image metadata at all. Please check that the referenced image '${img_url}' is the correct one!"
return 1
}

echo "Image created: '${img_created}'"

# TODO: we shall extend this check to check also Label "io.openshift.build.commit.ref" value (e.g. '2024a') or something similar
}

Expand Down

0 comments on commit e8b721c

Please sign in to comment.