@catladder/pipeline
Version:
Panter workflow for cloud CI/CD and DevOps
57 lines (56 loc) • 1.98 kB
JavaScript
;
var __assign = this && this.__assign || function () {
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createGoogleCloudRunDeployJobs = void 0;
var runner_1 = require("../../../runner");
var gitlab_1 = require("../../../utils/gitlab");
var base_1 = require("../../base");
var types_1 = require("../../types");
var constants_1 = require("./constants");
var getCloudRunDeployScripts_1 = require("./getCloudRunDeployScripts");
var getCloudRunStopScripts_1 = require("./getCloudRunStopScripts");
var createGoogleCloudRunDeployJobs = function (context) {
var _a;
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
// should not happen
throw new Error("deploy config is wrong");
}
var deployScripts = (0, getCloudRunDeployScripts_1.getCloudRunDeployScripts)(context);
var stopScripts = (0, getCloudRunStopScripts_1.getCloudRunStopScripts)(context);
return (0, base_1.createDeployementJobs)(context, {
deploy: __assign(__assign({
variables: {
CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
}
}, deployConfig.debug ? {
artifacts: {
paths: [constants_1.ENV_VARS_FILENAME // debug
],
when: "always"
}
} : {}), {
image: (0, runner_1.getRunnerImage)("gcloud"),
script: deployScripts
}),
stop: {
image: (0, runner_1.getRunnerImage)("gcloud"),
variables: {
CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
},
script: (0, gitlab_1.allowFailureInScripts)(stopScripts)
}
});
};
exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;