Skip to content

Commit

Permalink
feat: enhance oci purl spec compliance
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Setch <[email protected]>
  • Loading branch information
setchy committed Nov 29, 2023
1 parent c8a8bf6 commit fa5e0d0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3833,19 +3833,24 @@ export const createContainerSpecLikeBom = async (path, options) => {
}
const imageObj = parseImageName(img.image);
const pkg = {
name: imageObj.repo,
name: imageObj.repo.split("/").pop().toLowerCase(),
version:
imageObj.tag ||
(imageObj.digest ? "sha256:" + imageObj.digest : "latest"),
(imageObj.digest ? "sha256:" + imageObj.digest : "latest"), // TODO - this may not work if both a tag and digest are provided
qualifiers: {},
properties: commonProperties
properties: commonProperties,
type: "container"
};
if (imageObj.registry) {
pkg["qualifiers"]["repository_url"] = imageObj.registry;
pkg["qualifiers"]["repository_url"] =
imageObj.registry + "/" + imageObj.repo;
}
if (imageObj.platform) {
pkg["qualifiers"]["platform"] = imageObj.platform;
}
if (imageObj.tag) {
pkg["qualifiers"]["tag"] = imageObj.tag;
}
// Create an entry for the oci image
const imageBomData = buildBomNSData(options, [pkg], "oci", {
src: img.image,
Expand Down

0 comments on commit fa5e0d0

Please sign in to comment.