@catladder/cli 0.0.0-main-deeb54d7 → 0.0.0-main-022bac09
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catenv/index.js +302 -15
- package/dist/bundles/cli/index.js +302 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -40865,7 +40865,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
40865
40865
|
|
|
40866
40866
|
exports.__esModule = true;
|
|
40867
40867
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
40868
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
40868
|
+
exports.PIPELINE_IMAGE_TAG = "main-022bac09" || 0;
|
|
40869
40869
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
40870
40870
|
|
|
40871
40871
|
/***/ }),
|
|
@@ -42391,6 +42391,256 @@ exports.DEPLOY_RUNNER_VARIABLES = {
|
|
|
42391
42391
|
|
|
42392
42392
|
/***/ }),
|
|
42393
42393
|
|
|
42394
|
+
/***/ 8159:
|
|
42395
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
42396
|
+
|
|
42397
|
+
"use strict";
|
|
42398
|
+
|
|
42399
|
+
|
|
42400
|
+
var __read = this && this.__read || function (o, n) {
|
|
42401
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
42402
|
+
if (!m) return o;
|
|
42403
|
+
var i = m.call(o),
|
|
42404
|
+
r,
|
|
42405
|
+
ar = [],
|
|
42406
|
+
e;
|
|
42407
|
+
try {
|
|
42408
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42409
|
+
} catch (error) {
|
|
42410
|
+
e = {
|
|
42411
|
+
error: error
|
|
42412
|
+
};
|
|
42413
|
+
} finally {
|
|
42414
|
+
try {
|
|
42415
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
42416
|
+
} finally {
|
|
42417
|
+
if (e) throw e.error;
|
|
42418
|
+
}
|
|
42419
|
+
}
|
|
42420
|
+
return ar;
|
|
42421
|
+
};
|
|
42422
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
42423
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
42424
|
+
if (ar || !(i in from)) {
|
|
42425
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42426
|
+
ar[i] = from[i];
|
|
42427
|
+
}
|
|
42428
|
+
}
|
|
42429
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
42430
|
+
};
|
|
42431
|
+
exports.__esModule = true;
|
|
42432
|
+
exports.getDeleteUnusedImagesCommands = exports.getPushToArtifactsRegistryCommands = exports.getArtifactsRegistryImage = exports.getArtifactsRegistryImageName = void 0;
|
|
42433
|
+
var docker_1 = __nccwpck_require__(3219);
|
|
42434
|
+
var gitlab_1 = __nccwpck_require__(4997);
|
|
42435
|
+
var types_1 = __nccwpck_require__(3109);
|
|
42436
|
+
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(7547);
|
|
42437
|
+
/**
|
|
42438
|
+
*
|
|
42439
|
+
* lecacyReviewImageName is only temporary. In old versions the images had no reviewslug in review apps, which makes cleanup harder. We delete all those images now, but need the path
|
|
42440
|
+
*/
|
|
42441
|
+
var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
|
|
42442
|
+
var _a;
|
|
42443
|
+
if (lecacyReviewImageName === void 0) {
|
|
42444
|
+
lecacyReviewImageName = false;
|
|
42445
|
+
}
|
|
42446
|
+
var deployConfig = context.componentConfig.deploy;
|
|
42447
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
42448
|
+
// should not happen
|
|
42449
|
+
throw new Error("deploy config is wrong");
|
|
42450
|
+
}
|
|
42451
|
+
if (lecacyReviewImageName && context.environment.envType !== "review") {
|
|
42452
|
+
throw new Error("lecacyReviewImageName is only allowed for review app");
|
|
42453
|
+
}
|
|
42454
|
+
var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
|
|
42455
|
+
var dockerUrl = "".concat(deployConfig.region, "-docker.pkg.dev/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
|
|
42456
|
+
var gcloudImagePath = __spreadArray([dockerUrl, context.environment.shortName, context.componentName], __read(context.environment.envType === "review" && !lecacyReviewImageName ? [(_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.reviewSlug] : []), false);
|
|
42457
|
+
return gcloudImagePath.join("/");
|
|
42458
|
+
};
|
|
42459
|
+
exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
|
|
42460
|
+
var getArtifactsRegistryImage = function (context) {
|
|
42461
|
+
return "".concat((0, exports.getArtifactsRegistryImageName)(context), ":$DOCKER_IMAGE_TAG");
|
|
42462
|
+
};
|
|
42463
|
+
exports.getArtifactsRegistryImage = getArtifactsRegistryImage;
|
|
42464
|
+
/**
|
|
42465
|
+
* commands to pull the image from the default registry and pushes it to google artifact registry. We might build and push directly to google artifact registry in the future
|
|
42466
|
+
*/
|
|
42467
|
+
var getPushToArtifactsRegistryCommands = function (context) {
|
|
42468
|
+
var deployConfig = context.componentConfig.deploy;
|
|
42469
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
42470
|
+
// should not happen
|
|
42471
|
+
throw new Error("deploy config is wrong");
|
|
42472
|
+
}
|
|
42473
|
+
var fullImageName = (0, exports.getArtifactsRegistryImageName)(context);
|
|
42474
|
+
return [docker_1.gitlabDockerLogin, "gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(fullImageName, ":$DOCKER_IMAGE_TAG"), "docker push ".concat(fullImageName, ":$DOCKER_IMAGE_TAG")];
|
|
42475
|
+
};
|
|
42476
|
+
exports.getPushToArtifactsRegistryCommands = getPushToArtifactsRegistryCommands;
|
|
42477
|
+
var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
42478
|
+
if (keepNewest === void 0) {
|
|
42479
|
+
keepNewest = 0;
|
|
42480
|
+
}
|
|
42481
|
+
if (keepNewest === 0) {
|
|
42482
|
+
// no need to list tags, we delete the whole thing
|
|
42483
|
+
return ["gcloud artifacts docker images delete ".concat(fullImageName, " --quiet --delete-tags")];
|
|
42484
|
+
}
|
|
42485
|
+
// delete unused tags
|
|
42486
|
+
var listAllImagesCommand = "gcloud artifacts docker images list ".concat(fullImageName, " --sort-by=~CREATE_TIME --format=\"value(version)\"");
|
|
42487
|
+
var listImagesToDeletecommand = (0, removeFirstLinesFromCommandOutput_1.removeFirstLinesFromCommandOutput)(listAllImagesCommand, keepNewest);
|
|
42488
|
+
var deleteImageCommand = "gcloud artifacts docker images delete ".concat(fullImageName, "@$version --quiet --delete-tags");
|
|
42489
|
+
var deleteImagesCommand = "".concat(listImagesToDeletecommand, " | while read -r version; do ").concat(deleteImageCommand, "; done");
|
|
42490
|
+
return [deleteImagesCommand];
|
|
42491
|
+
};
|
|
42492
|
+
/**
|
|
42493
|
+
* commands to delete unused images.
|
|
42494
|
+
*
|
|
42495
|
+
* @param context
|
|
42496
|
+
* @param keep how many of the newest images to keep
|
|
42497
|
+
* @returns
|
|
42498
|
+
*/
|
|
42499
|
+
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
42500
|
+
if (keep === void 0) {
|
|
42501
|
+
keep = 0;
|
|
42502
|
+
}
|
|
42503
|
+
var deployConfig = context.componentConfig.deploy;
|
|
42504
|
+
if (deployConfig === false) {
|
|
42505
|
+
return [];
|
|
42506
|
+
}
|
|
42507
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
42508
|
+
// should not happen
|
|
42509
|
+
throw new Error("deploy config is wrong");
|
|
42510
|
+
}
|
|
42511
|
+
var fullImageName = (0, exports.getArtifactsRegistryImageName)(context);
|
|
42512
|
+
return __spreadArray(__spreadArray([], __read(getDeleteImageCommands(fullImageName, keep)), false), __read(context.environment.envType === "review" ? (0, gitlab_1.allowFailureInScripts)(getDeleteImageCommands((0, exports.getArtifactsRegistryImageName)(context, true), 0)) : []), false);
|
|
42513
|
+
};
|
|
42514
|
+
exports.getDeleteUnusedImagesCommands = getDeleteUnusedImagesCommands;
|
|
42515
|
+
|
|
42516
|
+
/***/ }),
|
|
42517
|
+
|
|
42518
|
+
/***/ 964:
|
|
42519
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
42520
|
+
|
|
42521
|
+
"use strict";
|
|
42522
|
+
|
|
42523
|
+
|
|
42524
|
+
var __read = this && this.__read || function (o, n) {
|
|
42525
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
42526
|
+
if (!m) return o;
|
|
42527
|
+
var i = m.call(o),
|
|
42528
|
+
r,
|
|
42529
|
+
ar = [],
|
|
42530
|
+
e;
|
|
42531
|
+
try {
|
|
42532
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
42533
|
+
} catch (error) {
|
|
42534
|
+
e = {
|
|
42535
|
+
error: error
|
|
42536
|
+
};
|
|
42537
|
+
} finally {
|
|
42538
|
+
try {
|
|
42539
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
42540
|
+
} finally {
|
|
42541
|
+
if (e) throw e.error;
|
|
42542
|
+
}
|
|
42543
|
+
}
|
|
42544
|
+
return ar;
|
|
42545
|
+
};
|
|
42546
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
42547
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
42548
|
+
if (ar || !(i in from)) {
|
|
42549
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42550
|
+
ar[i] = from[i];
|
|
42551
|
+
}
|
|
42552
|
+
}
|
|
42553
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
42554
|
+
};
|
|
42555
|
+
exports.__esModule = true;
|
|
42556
|
+
exports.getRemoveOldRevisionsAndImagesCommand = void 0;
|
|
42557
|
+
var artifactsRegistry_1 = __nccwpck_require__(8159);
|
|
42558
|
+
var cloudRunRevisions_1 = __nccwpck_require__(1101);
|
|
42559
|
+
var getRemoveOldRevisionsAndImagesCommand = function (context, when) {
|
|
42560
|
+
if (when === "onStop") {
|
|
42561
|
+
// service is already deleted, so we don't need to delete old revisions, just delete all images
|
|
42562
|
+
return (0, artifactsRegistry_1.getDeleteUnusedImagesCommands)(context);
|
|
42563
|
+
}
|
|
42564
|
+
// this number only targets inactive revisions
|
|
42565
|
+
var revisionsToKeep = context.environment.envType === "prod" ? 5 : 0;
|
|
42566
|
+
// this number needs to be higher than inactive after deploy, so we add one
|
|
42567
|
+
var imagesToKeep = revisionsToKeep + 1;
|
|
42568
|
+
var deleteOldRevisionsCommands = (0, cloudRunRevisions_1.getDeleteUnusedRevisionsCommands)(context, revisionsToKeep);
|
|
42569
|
+
var deleteOldImagesCommands = (0, artifactsRegistry_1.getDeleteUnusedImagesCommands)(context, imagesToKeep);
|
|
42570
|
+
return __spreadArray(__spreadArray([], __read(deleteOldRevisionsCommands), false), __read(deleteOldImagesCommands), false);
|
|
42571
|
+
};
|
|
42572
|
+
exports.getRemoveOldRevisionsAndImagesCommand = getRemoveOldRevisionsAndImagesCommand;
|
|
42573
|
+
|
|
42574
|
+
/***/ }),
|
|
42575
|
+
|
|
42576
|
+
/***/ 1101:
|
|
42577
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
42578
|
+
|
|
42579
|
+
"use strict";
|
|
42580
|
+
|
|
42581
|
+
|
|
42582
|
+
var __assign = this && this.__assign || function () {
|
|
42583
|
+
__assign = Object.assign || function (t) {
|
|
42584
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
42585
|
+
s = arguments[i];
|
|
42586
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
42587
|
+
}
|
|
42588
|
+
return t;
|
|
42589
|
+
};
|
|
42590
|
+
return __assign.apply(this, arguments);
|
|
42591
|
+
};
|
|
42592
|
+
exports.__esModule = true;
|
|
42593
|
+
exports.getDeleteUnusedRevisionsCommands = void 0;
|
|
42594
|
+
var types_1 = __nccwpck_require__(3109);
|
|
42595
|
+
var createArgsString_1 = __nccwpck_require__(8686);
|
|
42596
|
+
var getServiceName_1 = __nccwpck_require__(9391);
|
|
42597
|
+
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(7547);
|
|
42598
|
+
var getListRevisionsCommand = function (context, args) {
|
|
42599
|
+
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
42600
|
+
var deployConfig = context.componentConfig.deploy;
|
|
42601
|
+
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
42602
|
+
// should not happen
|
|
42603
|
+
throw new Error("deploy config is wrong");
|
|
42604
|
+
}
|
|
42605
|
+
var filterRevisionArgs = __assign({
|
|
42606
|
+
project: deployConfig.projectId,
|
|
42607
|
+
region: deployConfig.region,
|
|
42608
|
+
// only show inactive revisions
|
|
42609
|
+
service: serviceName,
|
|
42610
|
+
limit: "unlimited",
|
|
42611
|
+
"sort-by": "metadata.creationTimestamp"
|
|
42612
|
+
}, args);
|
|
42613
|
+
// this prints out all inactive images of the given app
|
|
42614
|
+
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
42615
|
+
};
|
|
42616
|
+
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
42617
|
+
var deployConfig = context.componentConfig.deploy;
|
|
42618
|
+
if (deployConfig === false) {
|
|
42619
|
+
return [];
|
|
42620
|
+
}
|
|
42621
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
42622
|
+
// should not happen
|
|
42623
|
+
throw new Error("deploy config is wrong");
|
|
42624
|
+
}
|
|
42625
|
+
// this prints out all inactive images of the given app
|
|
42626
|
+
var listAllInactiveRevisionsCmd = getListRevisionsCommand(context, {
|
|
42627
|
+
format: "\"value(name)\"",
|
|
42628
|
+
filter: "'(status.conditions.status=False OR status.conditions.status=Unknown)'"
|
|
42629
|
+
});
|
|
42630
|
+
// this removes the newest `revisionsToKeep` images
|
|
42631
|
+
var listRevisionsToDeleteCmd = (0, removeFirstLinesFromCommandOutput_1.removeFirstLinesFromCommandOutput)(listAllInactiveRevisionsCmd, keep);
|
|
42632
|
+
var deleteRevisionCmd = "gcloud run revisions delete ".concat((0, createArgsString_1.createArgsString)({
|
|
42633
|
+
project: deployConfig.projectId,
|
|
42634
|
+
region: deployConfig.region,
|
|
42635
|
+
quiet: true
|
|
42636
|
+
}), " $revisionname ");
|
|
42637
|
+
var deleteRevisionsCmd = "".concat(listRevisionsToDeleteCmd, " | while read -r revisionname; do ").concat(deleteRevisionCmd, "; done");
|
|
42638
|
+
return [deleteRevisionsCmd];
|
|
42639
|
+
};
|
|
42640
|
+
exports.getDeleteUnusedRevisionsCommands = getDeleteUnusedRevisionsCommands;
|
|
42641
|
+
|
|
42642
|
+
/***/ }),
|
|
42643
|
+
|
|
42394
42644
|
/***/ 2256:
|
|
42395
42645
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
42396
42646
|
|
|
@@ -42454,11 +42704,14 @@ var createArgsString_1 = __nccwpck_require__(8686);
|
|
|
42454
42704
|
var database_1 = __nccwpck_require__(1384);
|
|
42455
42705
|
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
|
|
42456
42706
|
var jobName_1 = __nccwpck_require__(7311);
|
|
42707
|
+
var artifactsRegistry_1 = __nccwpck_require__(8159);
|
|
42708
|
+
var getServiceName_1 = __nccwpck_require__(9391);
|
|
42709
|
+
var cleanup_1 = __nccwpck_require__(964);
|
|
42457
42710
|
var setExtraVarsScripts = function (deployConfig) {
|
|
42458
42711
|
return ["export GCLOUD_PROJECT_NUMBER=$(gcloud projects describe ".concat(deployConfig.projectId, " --format=\"value(projectNumber)\")"), "echo \"GCLOUD_PROJECT_NUMBER: $GCLOUD_PROJECT_NUMBER\""];
|
|
42459
42712
|
};
|
|
42460
42713
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
42461
|
-
var _a, _b, _c
|
|
42714
|
+
var _a, _b, _c;
|
|
42462
42715
|
var deployConfig = context.componentConfig.deploy;
|
|
42463
42716
|
if (deployConfig === false) {
|
|
42464
42717
|
return [];
|
|
@@ -42467,11 +42720,6 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
42467
42720
|
// should not happen
|
|
42468
42721
|
throw new Error("deploy config is wrong");
|
|
42469
42722
|
}
|
|
42470
|
-
var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
|
|
42471
|
-
var dockerUrl = "".concat(deployConfig.region, "-docker.pkg.dev/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
|
|
42472
|
-
var gcloudImagePath = __spreadArray([dockerUrl, context.environment.shortName, context.componentName], __read(context.environment.envType === "review" ? [(_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.reviewSlug] : []), false);
|
|
42473
|
-
var gcloudImageName = "".concat(gcloudImagePath.join("/"), ":$DOCKER_IMAGE_TAG");
|
|
42474
|
-
var pushImageToArtifactsRegistry = [docker_1.gitlabDockerLogin, "gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(gcloudImageName), "docker push ".concat(gcloudImageName)];
|
|
42475
42723
|
var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
|
|
42476
42724
|
var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
|
|
42477
42725
|
var _b = __read(_a, 2),
|
|
@@ -42484,16 +42732,16 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
42484
42732
|
region: deployConfig.region
|
|
42485
42733
|
};
|
|
42486
42734
|
var commonDeployArgs = __assign(__assign({
|
|
42487
|
-
image:
|
|
42735
|
+
image: (0, artifactsRegistry_1.getArtifactsRegistryImage)(context)
|
|
42488
42736
|
}, commonArgs), {
|
|
42489
42737
|
"set-cloudsql-instances": deployConfig.cloudSql ? deployConfig.cloudSql.instanceConnectionName : undefined,
|
|
42490
42738
|
labels: labelsString
|
|
42491
42739
|
});
|
|
42492
|
-
var serviceName =
|
|
42740
|
+
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
42493
42741
|
var getFullJobName = function (name) {
|
|
42494
42742
|
return (0, jobName_1.getCloudRunJobName)(context.environment.fullName, name);
|
|
42495
42743
|
};
|
|
42496
|
-
var jobsWithNames = Object.entries((
|
|
42744
|
+
var jobsWithNames = Object.entries((_a = deployConfig.jobs) !== null && _a !== void 0 ? _a : {})
|
|
42497
42745
|
// filter out disabled jobs
|
|
42498
42746
|
.filter(function (entry) {
|
|
42499
42747
|
return Boolean(entry[1]);
|
|
@@ -42605,18 +42853,19 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
42605
42853
|
"gcloud beta run jobs executions list ".concat(commonArgsString, " --job ").concat(jobName, " --format=\"value(name)\" | xargs -I {} gcloud beta run jobs executions delete {} --quiet ").concat(commonArgsString), "gcloud beta run jobs delete ".concat(jobName, " ").concat(commonArgsString)];
|
|
42606
42854
|
});
|
|
42607
42855
|
};
|
|
42608
|
-
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gitlab_1.collapseableSection)("prepare", "Prepare...")(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setExtraVarsScripts(deployConfig)), false))), false), __read((0, gitlab_1.collapseableSection)("pushToArtifactRegistry", "Pushing image to artifacts registry")(
|
|
42609
|
-
: []), false), __read(getCreateScheduleScripts()), false), __read(getJobCreateScripts()), false), __read(getJobRunScripts("preDeploy")), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(Object.entries((
|
|
42856
|
+
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gitlab_1.collapseableSection)("prepare", "Prepare...")(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setExtraVarsScripts(deployConfig)), false))), false), __read((0, gitlab_1.collapseableSection)("pushToArtifactRegistry", "Pushing image to artifacts registry")((0, artifactsRegistry_1.getPushToArtifactsRegistryCommands)(context))), false), __read((0, gitlab_1.collapseableSection)("deploy", "Deploy to cloud run")(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml"], __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
|
|
42857
|
+
: []), false), __read(getCreateScheduleScripts()), false), __read(getJobCreateScripts()), false), __read(getJobRunScripts("preDeploy")), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(Object.entries((_b = deployConfig.additionalServices) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
|
|
42610
42858
|
var _b = __read(_a, 2),
|
|
42611
42859
|
name = _b[0],
|
|
42612
42860
|
service = _b[1];
|
|
42613
42861
|
return getServiceDeployScript(service, "-" + name);
|
|
42614
|
-
})), false), __read(getJobRunScripts("postDeploy")), false))), false),
|
|
42615
|
-
|
|
42862
|
+
})), false), __read(getJobRunScripts("postDeploy")), false))), false), __read((0, gitlab_1.collapseableSection)("cleanup", "Cleanup")((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "postDeploy") // we cleanup inactive images both on deploy and stop
|
|
42863
|
+
)), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false);
|
|
42864
|
+
var stopScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName, " ").concat(commonArgsString)] : []), false), __read(Object.entries((_c = deployConfig.additionalServices) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
|
|
42616
42865
|
var _b = __read(_a, 1),
|
|
42617
42866
|
name = _b[0];
|
|
42618
42867
|
return "gcloud run services delete ".concat(serviceName, "-").concat(name, " ").concat(commonArgsString);
|
|
42619
|
-
})), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false);
|
|
42868
|
+
})), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false), __read((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "onStop")), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false);
|
|
42620
42869
|
return (0, base_1.createDeployementJobs)(context, {
|
|
42621
42870
|
deploy: (0, lodash_1.merge)((0, docker_1.getDockerJobBaseProps)(context), {
|
|
42622
42871
|
artifacts: {
|
|
@@ -42924,6 +43173,21 @@ exports.gcloudServiceAccountLoginCommands = gcloudServiceAccountLoginCommands;
|
|
|
42924
43173
|
|
|
42925
43174
|
/***/ }),
|
|
42926
43175
|
|
|
43176
|
+
/***/ 9391:
|
|
43177
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
43178
|
+
|
|
43179
|
+
"use strict";
|
|
43180
|
+
|
|
43181
|
+
|
|
43182
|
+
exports.__esModule = true;
|
|
43183
|
+
exports.getServiceName = void 0;
|
|
43184
|
+
var getServiceName = function (context) {
|
|
43185
|
+
return context.environment.fullName.toLowerCase();
|
|
43186
|
+
};
|
|
43187
|
+
exports.getServiceName = getServiceName;
|
|
43188
|
+
|
|
43189
|
+
/***/ }),
|
|
43190
|
+
|
|
42927
43191
|
/***/ 7311:
|
|
42928
43192
|
/***/ ((__unused_webpack_module, exports) => {
|
|
42929
43193
|
|
|
@@ -42939,6 +43203,29 @@ exports.getCloudRunJobName = getCloudRunJobName;
|
|
|
42939
43203
|
|
|
42940
43204
|
/***/ }),
|
|
42941
43205
|
|
|
43206
|
+
/***/ 7547:
|
|
43207
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
43208
|
+
|
|
43209
|
+
"use strict";
|
|
43210
|
+
|
|
43211
|
+
|
|
43212
|
+
exports.__esModule = true;
|
|
43213
|
+
exports.removeFirstLinesFromCommandOutput = void 0;
|
|
43214
|
+
/**
|
|
43215
|
+
*
|
|
43216
|
+
* takes a command and removes the first keep lines from the output
|
|
43217
|
+
*
|
|
43218
|
+
* @param cmd the command, its stdout is then limited
|
|
43219
|
+
* @param removeFirstN how many lines to remove at the start of the command
|
|
43220
|
+
* @returns
|
|
43221
|
+
*/
|
|
43222
|
+
var removeFirstLinesFromCommandOutput = function (cmd, removeFirstN) {
|
|
43223
|
+
return removeFirstN === 0 ? cmd : "".concat(cmd, " | tail -n +").concat(removeFirstN + 1);
|
|
43224
|
+
};
|
|
43225
|
+
exports.removeFirstLinesFromCommandOutput = removeFirstLinesFromCommandOutput;
|
|
43226
|
+
|
|
43227
|
+
/***/ }),
|
|
43228
|
+
|
|
42942
43229
|
/***/ 463:
|
|
42943
43230
|
/***/ ((__unused_webpack_module, exports) => {
|
|
42944
43231
|
|