@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
45 lines • 1.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createSbomBuildJob = exports.SBOM_FILE = exports.SBOM_BUILD_JOB_NAME = void 0;
const _1 = require(".");
const utils_1 = require("../utils");
exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
exports.SBOM_FILE = "__sbom.json";
const createSbomBuildJob = (context) => {
var _a, _b, _c, _d;
const buildConfig = context.build.config;
const defaultImage = {
name: "aquasec/trivy:0.58.2",
entrypoint: [""],
};
const defaultScript = [
`trivy fs --quiet --format cyclonedx --output "${exports.SBOM_FILE}" ${context.packageManagerInfo.componentIsInWorkspace
? "."
: context.build.dir}`,
];
const image = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
buildConfig.type === "custom" &&
buildConfig.sbom !== false
? ((_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage)
: defaultImage;
const script = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
buildConfig.type === "custom" &&
buildConfig.sbom !== false
? ((_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript)
: defaultScript;
return {
name: exports.SBOM_BUILD_JOB_NAME,
stage: "build",
envMode: "jobPerEnv",
variables: {},
cache: undefined,
image,
script,
allow_failure: true,
artifacts: {
paths: [exports.SBOM_FILE],
},
};
};
exports.createSbomBuildJob = createSbomBuildJob;
//# sourceMappingURL=sbom.js.map