@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
47 lines • 2.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCustomDeployJobs = void 0;
const getAllCacheConfigsFromConfig_1 = require("../../build/cache/getAllCacheConfigsFromConfig");
const yarn_1 = require("../../build/node/yarn");
const runner_1 = require("../../runner");
const base_1 = require("../base");
const sbom_1 = require("../sbom");
const types_1 = require("../types");
const createCustomDeployJobs = (context) => {
var _a, _b, _c;
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
// should not happen
throw new Error("deploy config is not custom");
}
// FIXME: custom deploy currently assumes yarn-based project
const yarnInstall = (0, yarn_1.getYarnInstall)(context, {
noCustomPostInstall: true,
});
const result = (0, base_1.createDeployementJobs)(context, {
deploy: {
image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
cache: (0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, deployConfig),
script: [
`cd ${context.build.dir}`,
...(deployConfig.requiresYarnInstall ? yarnInstall : []),
...deployConfig.script,
...(0, sbom_1.getDependencyTrackUploadScript)(context),
],
variables: {},
},
stop: deployConfig.stopScript
? {
image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
script: [
...deployConfig.stopScript,
...(0, sbom_1.getDependencyTrackDeleteScript)(context),
],
variables: {},
}
: undefined,
});
return result;
};
exports.createCustomDeployJobs = createCustomDeployJobs;
//# sourceMappingURL=deployJob.js.map