Skip to content

Commit

Permalink
fix(RELEASE-1174): leftover comments for pr #559 (#597)
Browse files Browse the repository at this point in the history
this commit addresses leftover comments of the PR #559.

1. remove one skopeo call to get image metadata and
  and also save some task time.
2. remove oras from mock.sh - this one was previously
  done in a rebase of #559.

Signed-off-by: Leandro Mendes <[email protected]>
  • Loading branch information
theflockers authored Nov 7, 2024
1 parent ee25cf0 commit f621ae9
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tasks/get-ocp-version/get-ocp-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ spec:
fbc_fragment="$(params.fbcFragment)"
# get the media type
media_type=$(skopeo inspect --raw "docker://${fbc_fragment}" | jq -r .mediaType)
# get image metadata
image_metadata=$(skopeo inspect --raw "docker://${fbc_fragment}")
media_type=$(jq -r .mediaType <<< "${image_metadata}")
image_base_name=$(jq '.annotations."org.opencontainers.image.base.name"' <<< "${image_metadata}" \
| cut -d: -f2 | sed 's/"//g')
# multiplatform images will not contain the base name with the OCP version, so it should fetch
# the manifest image
Expand All @@ -41,16 +45,11 @@ spec:
manifest_image_sha="$(jq -rs 'map(.digest)[0]' <<< "$arch_json")"
# replace the image sha with the manifests's one
manifest_image="${fbc_fragment%@*}@${manifest_image_sha}"
fbc_fragment="${fbc_fragment%@*}@${manifest_image_sha}"
# fetch the image base name containing the version for the found manifest image
image_base_name=$(skopeo inspect --raw docker://"${manifest_image}" \
| jq '.annotations."org.opencontainers.image.base.name"' | cut -d: -f2 | sed 's/"//g')
else
# fetch the image base name containing the version for a manifest image
image_base_name=$(skopeo inspect --raw docker://"${fbc_fragment}" \
| jq '.annotations."org.opencontainers.image.base.name"' | cut -d: -f2 | sed 's/"//g')
| jq '.annotations."org.opencontainers.image.base.name"' | cut -d: -f2 | sed 's/"//g')
fi
# Define the regular expression
Expand Down

0 comments on commit f621ae9

Please sign in to comment.