Skip to content

Commit

Permalink
feat(container-sensor-pull): add repository to list-tags output (#255)
Browse files Browse the repository at this point in the history
Similar to how Skopeo list tags and provides the repository path, this
commit adds that to our list-tags output.
  • Loading branch information
carlosmmatos authored Jan 29, 2024
1 parent 2b35517 commit 15dc15b
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ print_formatted_tags() {
local formatted_tags=$1

# Print a JSON object with tags properly formatted
printf "{\n \"name\": \"%s\",\n \"tags\": [\n" "${IMAGE_NAME}"
printf "{\n \"name\": \"%s\",\n \"repository\": \"%s\",\n \"tags\": [\n" "${IMAGE_NAME}" "${REPOSITORY}"
first=true
echo "$formatted_tags" | while IFS= read -r tag; do
if [ "$first" = true ]; then
Expand Down Expand Up @@ -507,6 +507,9 @@ if [ "${ERROR}" = "true" ]; then
die "ERROR: ${CONTAINER_TOOL} login failed. Error message: ${error_message}"
fi

#Construct repository path
REPOSITORY="$cs_registry/$registry_opts/$repository_name"

if [ "$LISTTAGS" ]; then
list_tags
exit 0
Expand All @@ -516,7 +519,7 @@ fi
LATESTSENSOR=$(list_tags | awk -v RS=" " '{print}' | grep "$SENSOR_VERSION" | grep -o "[0-9a-zA-Z_\.\-]*" | tail -1)

#Construct full image path
FULLIMAGEPATH="$cs_registry/$registry_opts/$repository_name:${LATESTSENSOR}"
FULLIMAGEPATH="${REPOSITORY}:${LATESTSENSOR}"

if [ "$GETIMAGEPATH" ]; then
echo "${FULLIMAGEPATH}"
Expand Down

0 comments on commit 15dc15b

Please sign in to comment.