Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: oci image support for multiple src files #696

Merged
merged 8 commits into from
Feb 5, 2024
30 changes: 30 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3659,6 +3659,7 @@ export const createContainerSpecLikeBom = async (path, options) => {
let parentComponent = {};
let dependencies = [];
const doneimages = [];
const skippedImageSrcs = [];
const doneservices = [];
const origProjectType = options.projectType;
let dcFiles = getAllFiles(
Expand Down Expand Up @@ -3791,6 +3792,9 @@ export const createContainerSpecLikeBom = async (path, options) => {
if (DEBUG_MODE) {
console.log("Skipping", img.image);
}

skippedImageSrcs.push({ image: img.image, src: f });

continue;
}
if (DEBUG_MODE) {
Expand Down Expand Up @@ -3845,6 +3849,32 @@ export const createContainerSpecLikeBom = async (path, options) => {
} // for img
}
} // for

// Add additional SrcFile property to skipped image components
for (const skippedImage of skippedImageSrcs) {
for (const co of components) {
let srcFileValues = [];
let srcImageValue;
co.properties.forEach(function (property) {
if (property.name === "SrcFile") {
srcFileValues.push(property.value);
}
if (property.name === "oci:SrcImage") {
srcImageValue = property.value;
}
});

if (
srcImageValue === skippedImage.image &&
!srcFileValues.includes(skippedImage.src)
) {
co.properties = co.properties.concat({
name: "SrcFile",
value: skippedImage.src
});
}
}
}
} // if
// Parse openapi files
if (oapiFiles.length) {
Expand Down
Loading