@catladder/pipeline
Version:
Panter workflow for cloud CI/CD and DevOps
35 lines (34 loc) • 1.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSbomBuildJob = exports.SBOM_FILE = exports.SBOM_BUILD_JOB_NAME = void 0;
var _1 = require(".");
var utils_1 = require("../utils");
exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
exports.SBOM_FILE = "__sbom.json";
var createSbomBuildJob = function (context) {
var _a, _b, _c, _d;
var buildConfig = context.build.config;
var defaultImage = {
name: "aquasec/trivy:0.58.2",
entrypoint: [""]
};
var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.packageManagerInfo.componentIsInWorkspace ? "." : context.build.dir)];
var 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;
var 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: image,
script: script,
allow_failure: true,
artifacts: {
paths: [exports.SBOM_FILE]
}
};
};
exports.createSbomBuildJob = createSbomBuildJob;