Skip to content

Commit

Permalink
fix: make PURLs use oci type
Browse files Browse the repository at this point in the history
  • Loading branch information
dervoeti committed Oct 17, 2024
1 parent 0ffa976 commit 9f8c03d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions publish-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@ runs:
DIGEST=${IMAGE_REPO_DIGEST#*@}
# Construct the package url (purl)
# TODO (@Techassi): Can we use 'oci' instead of 'docker' as the type?
PURL="pkg:docker/$IMAGE_REPOSITORY@$DIGEST?repository_url=$REGISTRY_URI"
URLENCODED_DIGEST=$(echo "$DIGEST" | sed 's/:/%3A/g')
URLENCODED_IMAGE_REPOSITORY=$(echo "$IMAGE_REPOSITORY" | sed 's/\//%2F/g')
# Last item, split by /
IMAGE_NAME=$(echo "$IMAGE_REPOSITORY" | awk -F'/' '{print $NF}')
# Obtain architecture from container image
ARCH=$(docker inspect --format='{{index .Architecture}}' "${IMAGE_REPO_DIGEST}")
PURL="pkg:oci/$IMAGE_NAME@$URLENCODED_DIGEST?arch=${ARCH}&repository_url=${REGISTRY_URI}%2F${URLENCODED_IMAGE_REPOSITORY}"
# Get metadata from the image
# NOTE (@Techassi): Maybe we should run this command only once
Expand Down

0 comments on commit 9f8c03d

Please sign in to comment.