@catladder/pipeline 1.144.0 → 1.145.0
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/bash/BashExpression.d.ts +40 -0
- package/dist/bash/BashExpression.js +124 -0
- package/dist/bash/bashExpressionPerPipelineType.d.ts +6 -0
- package/dist/bash/bashExpressionPerPipelineType.js +11 -0
- package/dist/bash/bashYaml.d.ts +10 -0
- package/dist/bash/bashYaml.js +46 -0
- package/dist/bash/getInjectVarsScript.d.ts +2 -0
- package/dist/bash/getInjectVarsScript.js +45 -0
- package/dist/bash/replaceAsync.d.ts +2 -0
- package/dist/{pipeline/commitInfo/getCommitInfo.js → bash/replaceAsync.js} +49 -21
- package/dist/build/base/__tests__/createArtifactsConfig.test.js +3 -1
- package/dist/build/base/constants.js +3 -1
- package/dist/build/base/createAppBuildJob.d.ts +2 -1
- package/dist/build/base/createAppBuildJob.js +10 -6
- package/dist/build/base/createArtifactsConfig.d.ts +1 -1
- package/dist/build/base/createArtifactsConfig.js +3 -1
- package/dist/build/base/index.js +3 -1
- package/dist/build/base/writeBuildInfo.js +4 -3
- package/dist/build/base/writeDotEnv.js +12 -3
- package/dist/build/custom/__tests__/testJob.test.js +3 -1
- package/dist/build/custom/buildJob.js +4 -12
- package/dist/build/custom/index.js +3 -1
- package/dist/build/custom/testJob.d.ts +1 -1
- package/dist/build/custom/testJob.js +18 -14
- package/dist/build/docker.d.ts +5 -31
- package/dist/build/docker.js +16 -9
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +13 -7
- package/dist/build/node/buildJob.js +4 -12
- package/dist/build/node/cache.js +6 -3
- package/dist/build/node/constants.js +3 -1
- package/dist/build/node/index.js +3 -1
- package/dist/build/node/meteor.js +5 -2
- package/dist/build/node/testJob.js +18 -14
- package/dist/build/node/yarn.d.ts +3 -2
- package/dist/build/node/yarn.js +6 -3
- package/dist/build/rails/build.js +3 -1
- package/dist/build/rails/index.js +3 -1
- package/dist/build/rails/test.js +15 -11
- package/dist/build/sbom.js +3 -1
- package/dist/build/types.d.ts +24 -18
- package/dist/build/types.js +3 -1
- package/dist/bundles/catladder-gitlab/index.js +3 -3
- package/dist/catladder-gitlab.js +10 -54
- package/dist/config/__tests__/configruedEnvs.test.js +3 -1
- package/dist/config/configruedEnvs.js +3 -1
- package/dist/config/index.js +13 -7
- package/dist/config/readConfig.js +6 -5
- package/dist/constants.js +5 -3
- package/dist/context/__tests__/resolveReferences.test.js +40 -8
- package/dist/context/getBuildInfoVariables.d.ts +7 -0
- package/dist/context/getBuildInfoVariables.js +29 -0
- package/dist/context/getEnvConfig.js +3 -1
- package/dist/context/getEnvType.js +3 -1
- package/dist/context/getEnvironment.d.ts +3 -3
- package/dist/context/getEnvironment.js +10 -14
- package/dist/context/getEnvironmentContext.d.ts +7 -3
- package/dist/context/getEnvironmentContext.js +21 -11
- package/dist/context/getEnvironmentVariables.d.ts +26 -5
- package/dist/context/getEnvironmentVariables.js +41 -25
- package/dist/context/getLabels.js +4 -2
- package/dist/context/getReviewSlug.d.ts +4 -0
- package/dist/context/getReviewSlug.js +22 -0
- package/dist/context/index.d.ts +12 -3
- package/dist/context/index.js +21 -15
- package/dist/context/resolveReferences.d.ts +3 -1
- package/dist/context/resolveReferences.js +53 -21
- package/dist/context/transformJobOnlyVars.d.ts +5 -2
- package/dist/context/transformJobOnlyVars.js +4 -2
- package/dist/context/utils/envVars.d.ts +1 -1
- package/dist/context/utils/envVars.js +5 -2
- package/dist/defaults/index.js +3 -1
- package/dist/deploy/base/deploy.d.ts +1 -1
- package/dist/deploy/base/deploy.js +12 -11
- package/dist/deploy/base/index.js +3 -1
- package/dist/deploy/base/rollback.d.ts +1 -1
- package/dist/deploy/base/rollback.js +13 -9
- package/dist/deploy/base/stop.d.ts +1 -1
- package/dist/deploy/base/stop.js +16 -11
- package/dist/deploy/base/types.d.ts +1 -1
- package/dist/deploy/base/types.js +3 -1
- package/dist/deploy/base/variables.js +3 -1
- package/dist/deploy/cloudRun/artifactsRegistry.d.ts +2 -1
- package/dist/deploy/cloudRun/artifactsRegistry.js +6 -4
- package/dist/deploy/cloudRun/cleanup.js +3 -1
- package/dist/deploy/cloudRun/cloudRunRevisions.js +3 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +8 -5
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.d.ts +2 -2
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +6 -3
- package/dist/deploy/cloudRun/createJobs/common.d.ts +3 -3
- package/dist/deploy/cloudRun/createJobs/common.js +3 -1
- package/dist/deploy/cloudRun/createJobs/constants.d.ts +1 -0
- package/dist/deploy/cloudRun/createJobs/constants.js +7 -0
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +9 -2
- package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +3 -1
- package/dist/deploy/cloudRun/createJobs/index.js +25 -8
- package/dist/deploy/cloudRun/createJobs/volumes.js +3 -1
- package/dist/deploy/cloudRun/index.js +5 -3
- package/dist/deploy/cloudRun/utils/createArgsString.d.ts +2 -1
- package/dist/deploy/cloudRun/utils/createArgsString.js +3 -1
- package/dist/deploy/cloudRun/utils/database.js +13 -13
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +3 -1
- package/dist/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
- package/dist/deploy/cloudRun/utils/getServiceName.js +3 -1
- package/dist/deploy/cloudRun/utils/jobName.d.ts +2 -1
- package/dist/deploy/cloudRun/utils/jobName.js +4 -2
- package/dist/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.js +3 -1
- package/dist/deploy/cloudSql/utils.d.ts +2 -1
- package/dist/deploy/cloudSql/utils.js +7 -2
- package/dist/deploy/custom/deployJob.js +3 -1
- package/dist/deploy/custom/index.js +3 -1
- package/dist/deploy/dockerTag/deployJob.js +3 -1
- package/dist/deploy/dockerTag/index.js +3 -1
- package/dist/deploy/index.d.ts +4 -3
- package/dist/deploy/index.js +13 -7
- package/dist/deploy/kubernetes/additionalSecretKeys.js +3 -1
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +3 -2
- package/dist/deploy/kubernetes/cloudSql/index.js +6 -4
- package/dist/deploy/kubernetes/deployJob.js +22 -15
- package/dist/deploy/kubernetes/index.js +51 -14
- package/dist/deploy/kubernetes/kubeEnv.d.ts +3 -2
- package/dist/deploy/kubernetes/kubeEnv.js +7 -4
- package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeValues.js +3 -2
- package/dist/deploy/kubernetes/mongodb.js +3 -1
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +2 -1
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +3 -1
- package/dist/deploy/sbom.js +3 -1
- package/dist/deploy/types/base.d.ts +8 -2
- package/dist/deploy/types/base.js +3 -1
- package/dist/deploy/types/custom.d.ts +1 -1
- package/dist/deploy/types/custom.js +3 -1
- package/dist/deploy/types/dockerTag.d.ts +1 -1
- package/dist/deploy/types/dockerTag.js +3 -1
- package/dist/deploy/types/googleCloudRun.d.ts +19 -18
- package/dist/deploy/types/googleCloudRun.js +3 -1
- package/dist/deploy/types/index.d.ts +6 -6
- package/dist/deploy/types/index.js +13 -7
- package/dist/deploy/types/kubernetes.d.ts +22 -22
- package/dist/deploy/types/kubernetes.js +3 -1
- package/dist/deploy/utils.js +3 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +16 -9
- package/dist/packageInfos.d.ts +2 -0
- package/dist/packageInfos.js +14 -0
- package/dist/pipeline/createAllJobs.d.ts +13 -5
- package/dist/pipeline/createAllJobs.js +21 -10
- package/dist/pipeline/createChildPipeline.d.ts +1 -1
- package/dist/pipeline/createChildPipeline.js +24 -7
- package/dist/pipeline/createJobsForComponent.d.ts +3 -3
- package/dist/pipeline/createJobsForComponent.js +19 -18
- package/dist/pipeline/createMainPipeline.d.ts +3 -0
- package/dist/pipeline/createMainPipeline.js +248 -0
- package/dist/pipeline/generatePipelineFiles.d.ts +2 -0
- package/dist/pipeline/generatePipelineFiles.js +178 -0
- package/dist/pipeline/getPipelineStages.js +3 -1
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +15 -5
- package/dist/pipeline/gitlab/createGitlabJobs.js +98 -25
- package/dist/pipeline/gitlab/createGitlabPipeline.d.ts +7 -2
- package/dist/pipeline/gitlab/createGitlabPipeline.js +34 -17
- package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.d.ts +1 -0
- package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js +29 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.d.ts +33 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.js +24 -0
- package/dist/pipeline/index.d.ts +3 -1
- package/dist/pipeline/index.js +16 -8
- package/dist/pipeline/packageManager.js +4 -2
- package/dist/pipeline/yarn/yarnUtils.js +6 -4
- package/dist/rules/index.d.ts +4 -1
- package/dist/rules/index.js +25 -18
- package/dist/runner/index.d.ts +1 -1
- package/dist/runner/index.js +3 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +18 -15
- package/dist/types/config.js +5 -2
- package/dist/types/context.d.ts +37 -32
- package/dist/types/context.js +3 -1
- package/dist/types/environmentContext.d.ts +11 -7
- package/dist/types/environmentContext.js +3 -1
- package/dist/types/gitlab-ci-yml.d.ts +30 -30
- package/dist/types/gitlab-ci-yml.js +3 -2
- package/dist/types/gitlab-types.d.ts +4 -6
- package/dist/types/gitlab-types.js +3 -1
- package/dist/types/index.js +13 -7
- package/dist/types/jobs.d.ts +23 -6
- package/dist/types/jobs.js +3 -1
- package/dist/types/pipeline.d.ts +4 -3
- package/dist/types/pipeline.js +3 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/utils.js +3 -1
- package/dist/utils/gitlab.js +3 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/writeFiles.d.ts +7 -0
- package/dist/{pipeline/commitInfo/getBuildId.js → utils/writeFiles.js} +39 -22
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +462 -366
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-no-service.ts.snap +501 -393
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +489 -392
- package/examples/__snapshots__/cloud-run-service-gen2.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-service-with-volumes.ts.snap +501 -401
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +1155 -915
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1116 -888
- package/examples/__snapshots__/cloud-run-with-worker.ts.snap +482 -386
- package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +452 -356
- package/examples/__snapshots__/custom-build-job.ts.snap +434 -350
- package/examples/__snapshots__/custom-deploy.ts.snap +319 -223
- package/examples/__snapshots__/custom-envs.ts.snap +123 -81
- package/examples/__snapshots__/custom-sbom-java.ts.snap +434 -350
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +846 -969
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +886 -957
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +894 -969
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +1626 -1728
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +974 -1137
- package/examples/__snapshots__/local-dot-env.ts.snap +480 -384
- package/examples/__snapshots__/meteor-kubernetes.ts.snap +906 -1069
- package/examples/__snapshots__/multiline-var.ts.snap +4500 -0
- package/examples/__snapshots__/native-app.ts.snap +706 -578
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +480 -384
- package/examples/__snapshots__/node-build-with-docker-additions.ts.snap +488 -384
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1656 -1942
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +287 -231
- package/examples/custom-deploy.ts +7 -7
- package/examples/multiline-var.ts +64 -0
- package/package.json +5 -8
- package/src/bash/BashExpression.ts +81 -0
- package/src/bash/bashExpressionPerPipelineType.ts +16 -0
- package/src/bash/bashYaml.ts +46 -0
- package/src/bash/getInjectVarsScript.ts +12 -0
- package/src/bash/replaceAsync.ts +50 -0
- package/src/build/base/createAppBuildJob.ts +6 -2
- package/src/build/base/writeBuildInfo.ts +1 -1
- package/src/build/base/writeDotEnv.ts +6 -1
- package/src/build/custom/buildJob.ts +2 -4
- package/src/build/custom/testJob.ts +3 -2
- package/src/build/docker.ts +15 -7
- package/src/build/node/buildJob.ts +1 -3
- package/src/build/node/testJob.ts +3 -2
- package/src/build/node/yarn.ts +9 -4
- package/src/build/rails/test.ts +2 -1
- package/src/build/types.ts +8 -1
- package/src/catladder-gitlab.ts +8 -55
- package/src/config/readConfig.ts +2 -3
- package/src/constants.ts +5 -2
- package/src/context/__tests__/resolveReferences.test.ts +11 -6
- package/src/context/getBuildInfoVariables.ts +40 -0
- package/src/context/getEnvironment.ts +7 -30
- package/src/context/getEnvironmentContext.ts +25 -29
- package/src/context/getEnvironmentVariables.ts +61 -36
- package/src/context/getReviewSlug.ts +27 -0
- package/src/context/index.ts +24 -23
- package/src/context/resolveReferences.ts +28 -8
- package/src/context/transformJobOnlyVars.ts +5 -2
- package/src/context/utils/envVars.ts +2 -1
- package/src/deploy/base/deploy.ts +20 -18
- package/src/deploy/base/rollback.ts +8 -10
- package/src/deploy/base/stop.ts +8 -9
- package/src/deploy/cloudRun/artifactsRegistry.ts +9 -4
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +12 -7
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +3 -2
- package/src/deploy/cloudRun/createJobs/constants.ts +1 -0
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +20 -2
- package/src/deploy/cloudRun/createJobs/index.ts +17 -8
- package/src/deploy/cloudRun/index.ts +14 -6
- package/src/deploy/cloudRun/utils/createArgsString.ts +2 -1
- package/src/deploy/cloudRun/utils/database.ts +2 -2
- package/src/deploy/cloudRun/utils/jobName.ts +7 -2
- package/src/deploy/cloudSql/utils.ts +12 -9
- package/src/deploy/index.ts +2 -1
- package/src/deploy/kubernetes/cloudSql/index.ts +3 -2
- package/src/deploy/kubernetes/deployJob.ts +24 -10
- package/src/deploy/kubernetes/index.ts +15 -8
- package/src/deploy/kubernetes/kubeEnv.ts +8 -6
- package/src/deploy/kubernetes/kubeValues.ts +0 -1
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +2 -1
- package/src/deploy/types/base.ts +6 -0
- package/src/deploy/types/googleCloudRun.ts +2 -0
- package/src/index.ts +2 -1
- package/src/packageInfos.ts +10 -0
- package/src/pipeline/createAllJobs.ts +24 -10
- package/src/pipeline/createChildPipeline.ts +19 -8
- package/src/pipeline/createJobsForComponent.ts +14 -22
- package/src/pipeline/createMainPipeline.ts +88 -0
- package/src/pipeline/generatePipelineFiles.ts +29 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +174 -51
- package/src/pipeline/gitlab/createGitlabPipeline.ts +16 -14
- package/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.ts +46 -0
- package/src/pipeline/gitlab/gitlabReleaseJobs.ts +20 -0
- package/src/pipeline/index.ts +2 -0
- package/src/rules/index.ts +15 -9
- package/src/types/config.ts +11 -2
- package/src/types/context.ts +39 -26
- package/src/types/environmentContext.ts +12 -6
- package/src/types/gitlab-ci-yml.ts +0 -1
- package/src/types/gitlab-types.ts +5 -4
- package/src/types/jobs.ts +28 -3
- package/src/types/pipeline.ts +4 -0
- package/src/utils/writeFiles.ts +40 -0
- package/dist/deploy/cloudRun/createJobs/variables.d.ts +0 -5
- package/dist/deploy/cloudRun/createJobs/variables.js +0 -19
- package/dist/pipeline/commitInfo/getBuildId.d.ts +0 -6
- package/dist/pipeline/commitInfo/getCommitInfo.d.ts +0 -2
- package/src/deploy/cloudRun/createJobs/variables.ts +0 -21
- package/src/pipeline/commitInfo/getBuildId.ts +0 -17
- package/src/pipeline/commitInfo/getCommitInfo.ts +0 -15
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getReviewSlug = void 0;
|
|
7
|
+
var BashExpression_1 = require("../bash/BashExpression");
|
|
8
|
+
var bashExpressionPerPipelineType_1 = require("../bash/bashExpressionPerPipelineType");
|
|
9
|
+
var getEnvType_1 = require("./getEnvType");
|
|
10
|
+
var REVIEW_SLUG = {
|
|
11
|
+
default: "unknown-review-slug",
|
|
12
|
+
gitlab: new BashExpression_1.BashExpression("$([ -n \"$CI_MERGE_REQUEST_IID\" ] && echo \"mr$CI_MERGE_REQUEST_IID\" || { [ -n \"$CI_COMMIT_REF_SLUG\" ] && echo \"$CI_COMMIT_REF_SLUG\" || echo \"unknown\"; })")
|
|
13
|
+
};
|
|
14
|
+
var getReviewSlug = function (envConfig, env, pipelineType) {
|
|
15
|
+
var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
|
|
16
|
+
if (envType === "review") {
|
|
17
|
+
return (0, bashExpressionPerPipelineType_1.getBashExpressionPerPipelineType)(REVIEW_SLUG, pipelineType);
|
|
18
|
+
}
|
|
19
|
+
return null; // not a review app;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.getReviewSlug = getReviewSlug;
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PipelineType } from "../types";
|
|
2
|
+
import type { Config, PipelineTrigger } from "../types/config";
|
|
3
|
+
import type { Context, PackageManagerInfo } from "../types/context";
|
|
3
4
|
export * from "./getEnvironment";
|
|
4
5
|
export * from "./getEnvironmentVariables";
|
|
5
|
-
export
|
|
6
|
+
export type CreateContextContext = {
|
|
7
|
+
config: Config;
|
|
8
|
+
componentName: string;
|
|
9
|
+
env: string;
|
|
10
|
+
pipelineType?: PipelineType;
|
|
11
|
+
trigger?: PipelineTrigger;
|
|
12
|
+
packageManagerInfo?: PackageManagerInfo;
|
|
13
|
+
};
|
|
14
|
+
export declare const createContext: (ctx: CreateContextContext) => Promise<Context>;
|
package/dist/context/index.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
11
15
|
} : function (o, m, k, k2) {
|
|
12
16
|
if (k2 === undefined) k2 = k;
|
|
13
17
|
o[k2] = m[k];
|
|
@@ -70,7 +74,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
70
74
|
}
|
|
71
75
|
function step(op) {
|
|
72
76
|
if (f) throw new TypeError("Generator is already executing.");
|
|
73
|
-
while (_) try {
|
|
77
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
74
78
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
75
79
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
76
80
|
switch (op[0]) {
|
|
@@ -130,7 +134,9 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
130
134
|
};
|
|
131
135
|
}
|
|
132
136
|
};
|
|
133
|
-
exports
|
|
137
|
+
Object.defineProperty(exports, "__esModule", {
|
|
138
|
+
value: true
|
|
139
|
+
});
|
|
134
140
|
exports.createContext = void 0;
|
|
135
141
|
var build_1 = require("../build");
|
|
136
142
|
var deploy_1 = require("../deploy");
|
|
@@ -139,17 +145,17 @@ var getEnvironment_1 = require("./getEnvironment");
|
|
|
139
145
|
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
140
146
|
__exportStar(require("./getEnvironment"), exports);
|
|
141
147
|
__exportStar(require("./getEnvironmentVariables"), exports);
|
|
142
|
-
var createContext = function (
|
|
148
|
+
var createContext = function (ctx) {
|
|
143
149
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
144
150
|
var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
|
|
145
151
|
var _a;
|
|
146
152
|
return __generator(this, function (_b) {
|
|
147
153
|
switch (_b.label) {
|
|
148
154
|
case 0:
|
|
149
|
-
if (!/^[a-z0-9-]+$/.test(componentName)) {
|
|
155
|
+
if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
|
|
150
156
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
151
157
|
}
|
|
152
|
-
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(
|
|
158
|
+
envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
153
159
|
componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
154
160
|
defaults = componentConfigWithoutDefaults.deploy ? {
|
|
155
161
|
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
|
|
@@ -160,13 +166,13 @@ var createContext = function (config, componentName, env, commitInfo, packageMan
|
|
|
160
166
|
};
|
|
161
167
|
componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
162
168
|
_a = {
|
|
163
|
-
fullConfig: config,
|
|
169
|
+
fullConfig: ctx.config,
|
|
164
170
|
componentConfig: componentConfig,
|
|
165
|
-
componentName: componentName
|
|
171
|
+
componentName: ctx.componentName
|
|
166
172
|
};
|
|
167
|
-
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(
|
|
173
|
+
return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
|
|
168
174
|
case 1:
|
|
169
|
-
return [2 /*return*/, (_a.environment = _b.sent(), _a.
|
|
175
|
+
return [2 /*return*/, (_a.environment = _b.sent(), _a.packageManagerInfo = ctx.packageManagerInfo, _a.pipelineType = ctx.pipelineType, _a.trigger = ctx.trigger, _a)];
|
|
170
176
|
}
|
|
171
177
|
});
|
|
172
178
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type { BashExpression } from "../bash/BashExpression";
|
|
2
|
+
import type { UnspecifiedEnvVars } from "..";
|
|
3
|
+
export declare const resolveReferences: (vars: Record<string, string | BashExpression | undefined | null>, getOtherVariables?: (componentName: string, alreadyVisited: Record<string, Record<string, boolean>>) => Promise<UnspecifiedEnvVars>, alreadyVisitedBase?: Record<string, Record<string, boolean>>) => Promise<Record<string, BashExpression>>;
|
|
2
4
|
export declare const translateLegacyFromComponents: (fromComponents: Record<string, Record<string, string>>) => {
|
|
3
5
|
[k: string]: string;
|
|
4
6
|
};
|
|
@@ -55,7 +55,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
55
55
|
}
|
|
56
56
|
function step(op) {
|
|
57
57
|
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
-
while (_) try {
|
|
58
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
59
59
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
60
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
61
|
switch (op[0]) {
|
|
@@ -137,35 +137,56 @@ var __read = this && this.__read || function (o, n) {
|
|
|
137
137
|
}
|
|
138
138
|
return ar;
|
|
139
139
|
};
|
|
140
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
141
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
142
|
+
if (ar || !(i in from)) {
|
|
143
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
144
|
+
ar[i] = from[i];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
148
|
+
};
|
|
140
149
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
141
150
|
return mod && mod.__esModule ? mod : {
|
|
142
151
|
"default": mod
|
|
143
152
|
};
|
|
144
153
|
};
|
|
145
|
-
exports
|
|
154
|
+
Object.defineProperty(exports, "__esModule", {
|
|
155
|
+
value: true
|
|
156
|
+
});
|
|
146
157
|
exports.translateLegacyFromComponents = exports.resolveReferences = void 0;
|
|
147
158
|
var lodash_1 = require("lodash");
|
|
148
|
-
var
|
|
159
|
+
var replaceAsync_1 = __importDefault(require("../bash/replaceAsync"));
|
|
160
|
+
// regex to resolve references in catladder variables
|
|
161
|
+
// those expressions have the pattern ${componentName:variableName}
|
|
149
162
|
var REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
150
|
-
var resolveReferences = function (
|
|
151
|
-
|
|
152
|
-
|
|
163
|
+
var resolveReferences = function (vars_1, getOtherVariables_1) {
|
|
164
|
+
var args_1 = [];
|
|
165
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
166
|
+
args_1[_i - 2] = arguments[_i];
|
|
153
167
|
}
|
|
154
|
-
return __awaiter(void 0,
|
|
168
|
+
return __awaiter(void 0, __spreadArray([vars_1, getOtherVariables_1], __read(args_1), false), void 0, function (vars, getOtherVariables, alreadyVisitedBase) {
|
|
155
169
|
var replaceSingleValue, _a, _b;
|
|
170
|
+
if (alreadyVisitedBase === void 0) {
|
|
171
|
+
alreadyVisitedBase = {};
|
|
172
|
+
}
|
|
156
173
|
return __generator(this, function (_c) {
|
|
157
174
|
switch (_c.label) {
|
|
158
175
|
case 0:
|
|
159
|
-
replaceSingleValue = function (
|
|
160
|
-
|
|
161
|
-
|
|
176
|
+
replaceSingleValue = function (value_1) {
|
|
177
|
+
var args_1 = [];
|
|
178
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
179
|
+
args_1[_i - 1] = arguments[_i];
|
|
162
180
|
}
|
|
163
|
-
return __awaiter(void 0,
|
|
181
|
+
return __awaiter(void 0, __spreadArray([value_1], __read(args_1), false), void 0, function (value, alreadyVisited) {
|
|
182
|
+
if (alreadyVisited === void 0) {
|
|
183
|
+
alreadyVisited = alreadyVisitedBase;
|
|
184
|
+
}
|
|
164
185
|
return __generator(this, function (_a) {
|
|
165
186
|
switch (_a.label) {
|
|
166
187
|
case 0:
|
|
167
|
-
if (!REGEX.test(value)) return [3 /*break*/, 2];
|
|
168
|
-
return [4 /*yield*/, (0,
|
|
188
|
+
if (!REGEX.test(value.toString())) return [3 /*break*/, 2];
|
|
189
|
+
return [4 /*yield*/, (0, replaceAsync_1.default)(value, REGEX, function (match, _, componentName, variableName) {
|
|
169
190
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
170
191
|
var newAlreadyVisited, result, _a, replaced, _b;
|
|
171
192
|
var _c, _d;
|
|
@@ -206,6 +227,7 @@ var resolveReferences = function (vars, getOtherVariables, alreadyVisitedBase) {
|
|
|
206
227
|
});
|
|
207
228
|
})];
|
|
208
229
|
case 1:
|
|
230
|
+
// we consider variables that got references in it BashExpressions, because the replacement may be one
|
|
209
231
|
return [2 /*return*/, _a.sent()];
|
|
210
232
|
case 2:
|
|
211
233
|
return [2 /*return*/, value];
|
|
@@ -215,18 +237,28 @@ var resolveReferences = function (vars, getOtherVariables, alreadyVisitedBase) {
|
|
|
215
237
|
};
|
|
216
238
|
_b = (_a = Object).fromEntries;
|
|
217
239
|
return [4 /*yield*/, Promise.all(Object.entries(vars).map(function (_a) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return __generator(this, function (
|
|
224
|
-
switch (
|
|
240
|
+
return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
241
|
+
var _c, _d;
|
|
242
|
+
var _e = __read(_b, 2),
|
|
243
|
+
key = _e[0],
|
|
244
|
+
value = _e[1];
|
|
245
|
+
return __generator(this, function (_f) {
|
|
246
|
+
switch (_f.label) {
|
|
225
247
|
case 0:
|
|
248
|
+
if (value === null || value === undefined) {
|
|
249
|
+
return [2 /*return*/, [key, null]];
|
|
250
|
+
}
|
|
226
251
|
_c = [key];
|
|
252
|
+
if (!(value !== null && value !== undefined)) return [3 /*break*/, 2];
|
|
227
253
|
return [4 /*yield*/, replaceSingleValue(value)];
|
|
228
254
|
case 1:
|
|
229
|
-
|
|
255
|
+
_d = _f.sent();
|
|
256
|
+
return [3 /*break*/, 3];
|
|
257
|
+
case 2:
|
|
258
|
+
_d = null;
|
|
259
|
+
_f.label = 3;
|
|
260
|
+
case 3:
|
|
261
|
+
return [2 /*return*/, _c.concat([_d])];
|
|
230
262
|
}
|
|
231
263
|
});
|
|
232
264
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SecretEnvVar, UnspecifiedEnvVars } from "..";
|
|
2
2
|
import type { EnvVars } from "../types/config";
|
|
3
3
|
/**
|
|
4
4
|
* transform EnvVars for environment.
|
|
@@ -7,4 +7,7 @@ import type { EnvVars } from "../types/config";
|
|
|
7
7
|
* @param vars
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
|
-
export declare const transformJobOnlyVars: (env: string, componentName: string, vars: EnvVars | null) => Promise<
|
|
10
|
+
export declare const transformJobOnlyVars: (env: string, componentName: string, vars: EnvVars | null) => Promise<{
|
|
11
|
+
envVars: UnspecifiedEnvVars;
|
|
12
|
+
secretEnvVarKeys: SecretEnvVar[];
|
|
13
|
+
}>;
|
|
@@ -65,7 +65,7 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
65
65
|
}
|
|
66
66
|
function step(op) {
|
|
67
67
|
if (f) throw new TypeError("Generator is already executing.");
|
|
68
|
-
while (_) try {
|
|
68
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
69
69
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
70
70
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
71
71
|
switch (op[0]) {
|
|
@@ -125,7 +125,9 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
exports
|
|
128
|
+
Object.defineProperty(exports, "__esModule", {
|
|
129
|
+
value: true
|
|
130
|
+
});
|
|
129
131
|
exports.transformJobOnlyVars = void 0;
|
|
130
132
|
var envVars_1 = require("./utils/envVars");
|
|
131
133
|
/**
|
|
@@ -4,5 +4,5 @@ export declare const stringifyValues: (obj: Record<string, unknown>) => {
|
|
|
4
4
|
};
|
|
5
5
|
export declare const stringListToSecreteEnvVarList: (keys: string[]) => SecretEnvVar[];
|
|
6
6
|
export declare const makeSecretEnvVarMapping: (env: string, componentName: string, secretEnvVars: SecretEnvVar[]) => {
|
|
7
|
-
[k: string]:
|
|
7
|
+
[k: string]: import("../../bash/BashExpression").BashExpression;
|
|
8
8
|
};
|
|
@@ -22,10 +22,13 @@ var __read = this && this.__read || function (o, n) {
|
|
|
22
22
|
}
|
|
23
23
|
return ar;
|
|
24
24
|
};
|
|
25
|
-
exports
|
|
25
|
+
Object.defineProperty(exports, "__esModule", {
|
|
26
|
+
value: true
|
|
27
|
+
});
|
|
26
28
|
exports.makeSecretEnvVarMapping = exports.stringListToSecreteEnvVarList = exports.stringifyValues = void 0;
|
|
27
29
|
var lodash_1 = require("lodash");
|
|
28
30
|
var getEnvironmentVariables_1 = require("../getEnvironmentVariables");
|
|
31
|
+
var BashExpression_1 = require("../../bash/BashExpression");
|
|
29
32
|
var stringifyValues = function (obj) {
|
|
30
33
|
return Object.fromEntries(Object.entries(obj).map(function (_a) {
|
|
31
34
|
var _b = __read(_a, 2),
|
|
@@ -46,7 +49,7 @@ exports.stringListToSecreteEnvVarList = stringListToSecreteEnvVarList;
|
|
|
46
49
|
var makeSecretEnvVarMapping = function (env, componentName, secretEnvVars) {
|
|
47
50
|
return Object.fromEntries(secretEnvVars.map(function (_a) {
|
|
48
51
|
var key = _a.key;
|
|
49
|
-
return [key,
|
|
52
|
+
return [key, (0, BashExpression_1.getBashVariable)((0, getEnvironmentVariables_1.getSecretVarName)(env, componentName, key))];
|
|
50
53
|
}));
|
|
51
54
|
};
|
|
52
55
|
exports.makeSecretEnvVarMapping = makeSecretEnvVarMapping;
|
package/dist/defaults/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
export declare const DEPLOY_JOB_NAME = "\uD83D\uDE80 Deploy";
|
|
4
|
-
export
|
|
4
|
+
export type DeployJobDefinition = Pick<CatladderJob, "script" | "variables" | "image" | "cache" | "artifacts" | "services" | "runnerVariables">;
|
|
5
5
|
export declare const createDeployJob: (context: Context, jobDefinition: DeployJobDefinition) => CatladderJob;
|
|
@@ -41,7 +41,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
41
41
|
}
|
|
42
42
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
43
|
};
|
|
44
|
-
exports
|
|
44
|
+
Object.defineProperty(exports, "__esModule", {
|
|
45
|
+
value: true
|
|
46
|
+
});
|
|
45
47
|
exports.createDeployJob = exports.DEPLOY_JOB_NAME = void 0;
|
|
46
48
|
var docker_1 = require("../../build/docker");
|
|
47
49
|
var sbom_1 = require("../../build/sbom");
|
|
@@ -51,7 +53,7 @@ var stop_1 = require("./stop");
|
|
|
51
53
|
var variables_1 = require("./variables");
|
|
52
54
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
53
55
|
var createDeployJob = function (context, jobDefinition) {
|
|
54
|
-
var _a, _b, _c, _d;
|
|
56
|
+
var _a, _b, _c, _d, _e, _f;
|
|
55
57
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
56
58
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
57
59
|
var autoStop = context.environment.envType === "review" ? "1 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
|
|
@@ -70,6 +72,7 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
70
72
|
artifacts: jobDefinition.artifacts,
|
|
71
73
|
services: jobDefinition.services,
|
|
72
74
|
envMode: "stagePerEnv",
|
|
75
|
+
// makes it easier to run manual tasks er env
|
|
73
76
|
needs: __spreadArray(__spreadArray([], __read((0, sbom_2.sbomDeactivated)(context) ? [] : [{
|
|
74
77
|
job: sbom_1.SBOM_BUILD_JOB_NAME,
|
|
75
78
|
artifacts: true
|
|
@@ -83,23 +86,21 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
83
86
|
// we don't want to deploy when there is a broken test
|
|
84
87
|
needsStages: [{
|
|
85
88
|
stage: "build",
|
|
86
|
-
artifacts: hasDocker ? false : true
|
|
89
|
+
artifacts: hasDocker ? false : true // we asume that no-docker deployments need build artifacts,
|
|
87
90
|
}, {
|
|
88
91
|
stage: "test",
|
|
89
92
|
artifacts: false
|
|
90
93
|
}],
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
} : {
|
|
94
|
-
when: "manual"
|
|
95
|
-
}],
|
|
94
|
+
// workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/220758
|
|
95
|
+
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
96
96
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
97
97
|
stage: "deploy",
|
|
98
|
-
variables: __assign(__assign(__assign(__assign(__assign(
|
|
99
|
-
|
|
98
|
+
variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}), context.environment.jobOnlyVars.deploy.envVars), context.componentConfig.deploy ? (_d = context.componentConfig.deploy.extraVars) !== null && _d !== void 0 ? _d : {} : {}), jobDefinition.variables),
|
|
99
|
+
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), (_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {}), context.componentConfig.deploy ? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {} : {}),
|
|
100
|
+
environment: isStoppable ? {
|
|
100
101
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
101
102
|
auto_stop_in: autoStop
|
|
102
|
-
} :
|
|
103
|
+
} : undefined,
|
|
103
104
|
jobTags: context.componentConfig.deploy ? context.componentConfig.deploy.jobTags : undefined
|
|
104
105
|
};
|
|
105
106
|
};
|
|
@@ -31,7 +31,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
31
31
|
}
|
|
32
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
33
|
};
|
|
34
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
35
37
|
exports.createDeployementJobs = void 0;
|
|
36
38
|
var deploy_1 = require("./deploy");
|
|
37
39
|
var rollback_1 = require("./rollback");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
export declare const ROLLBACK_JOB_NAME = "\u21A9\uFE0F Rollback \u26A0\uFE0F";
|
|
4
|
-
export
|
|
4
|
+
export type RollbackJobDefinition = Pick<CatladderJob, "script" | "variables" | "runnerVariables" | "image">;
|
|
5
5
|
export declare const createRollbackJob: (context: Context, jobDefinition: RollbackJobDefinition) => CatladderJob;
|
|
@@ -10,27 +10,31 @@ var __assign = this && this.__assign || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
14
16
|
exports.createRollbackJob = exports.ROLLBACK_JOB_NAME = void 0;
|
|
15
17
|
var variables_1 = require("./variables");
|
|
16
18
|
exports.ROLLBACK_JOB_NAME = "↩️ Rollback ⚠️";
|
|
17
19
|
var createRollbackJob = function (context, jobDefinition) {
|
|
20
|
+
var _a;
|
|
18
21
|
return {
|
|
19
22
|
name: exports.ROLLBACK_JOB_NAME,
|
|
20
23
|
image: jobDefinition.image,
|
|
21
24
|
envMode: "stagePerEnv",
|
|
25
|
+
// makes it easier to run manual tasks er env
|
|
22
26
|
needs: [],
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
27
|
+
// can be executed even if the deploy job failed
|
|
28
|
+
allow_failure: true,
|
|
29
|
+
when: "manual",
|
|
30
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.deploy.envVars), jobDefinition.variables),
|
|
31
|
+
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), {
|
|
28
32
|
GIT_STRATEGY: "none"
|
|
29
|
-
}), jobDefinition.
|
|
33
|
+
}), (_a = jobDefinition.runnerVariables) !== null && _a !== void 0 ? _a : {}),
|
|
30
34
|
stage: "rollback",
|
|
31
|
-
environment:
|
|
35
|
+
environment: {
|
|
32
36
|
action: "access"
|
|
33
|
-
}
|
|
37
|
+
},
|
|
34
38
|
script: jobDefinition.script
|
|
35
39
|
};
|
|
36
40
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
export declare const STOP_JOB_NAME = "\uD83D\uDED1 Stop \u26A0\uFE0F";
|
|
4
|
-
export
|
|
4
|
+
export type StopJobDefinition = Pick<CatladderJob, "script" | "variables" | "image" | "runnerVariables">;
|
|
5
5
|
export declare const createStopJob: (context: Context, jobDefinition: StopJobDefinition) => CatladderJob;
|
package/dist/deploy/base/stop.js
CHANGED
|
@@ -10,7 +10,9 @@ var __assign = this && this.__assign || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
14
16
|
exports.createStopJob = exports.STOP_JOB_NAME = void 0;
|
|
15
17
|
var variables_1 = require("./variables");
|
|
16
18
|
exports.STOP_JOB_NAME = "🛑 Stop ⚠️";
|
|
@@ -19,22 +21,25 @@ var createStopJob = function (context, jobDefinition) {
|
|
|
19
21
|
name: exports.STOP_JOB_NAME,
|
|
20
22
|
image: jobDefinition.image,
|
|
21
23
|
envMode: "stagePerEnv",
|
|
24
|
+
// makes it easier to run manual tasks er env
|
|
22
25
|
needs: [],
|
|
26
|
+
// can be executed even if the deploy job failed
|
|
27
|
+
allow_failure: true,
|
|
28
|
+
when: "manual",
|
|
29
|
+
// stop is always manual
|
|
23
30
|
rules: [{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, {
|
|
28
|
-
when: "manual",
|
|
29
|
-
allow_failure: true
|
|
31
|
+
if: "$CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/",
|
|
32
|
+
// automatic on hotfix branches
|
|
33
|
+
when: "on_success"
|
|
30
34
|
}],
|
|
31
|
-
variables: __assign(__assign(
|
|
35
|
+
variables: __assign(__assign({}, context.environment.jobOnlyVars.deploy.envVars), jobDefinition.variables),
|
|
36
|
+
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), {
|
|
32
37
|
GIT_STRATEGY: "none"
|
|
33
|
-
}), jobDefinition.
|
|
38
|
+
}), jobDefinition.runnerVariables),
|
|
34
39
|
stage: "stop",
|
|
35
|
-
environment:
|
|
40
|
+
environment: {
|
|
36
41
|
action: "stop"
|
|
37
|
-
}
|
|
42
|
+
},
|
|
38
43
|
script: jobDefinition.script
|
|
39
44
|
};
|
|
40
45
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { CatladderJob } from "../../types/jobs";
|
|
2
|
-
export
|
|
2
|
+
export type JobWithoutScript = Omit<CatladderJob, "script">;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StringOrBashExpression } from "../../bash/BashExpression";
|
|
1
2
|
import type { Context } from "../../types/context";
|
|
2
3
|
export declare const getArtifactsRegistryHost: ({
|
|
3
4
|
componentConfig: {
|
|
@@ -9,7 +10,7 @@ export declare const getArtifactsRegistryDockerUrl: (context: Context) => string
|
|
|
9
10
|
*
|
|
10
11
|
* 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
|
|
11
12
|
*/
|
|
12
|
-
export declare const getArtifactsRegistryImageName: (context: Context, lecacyReviewImageName?: boolean) =>
|
|
13
|
+
export declare const getArtifactsRegistryImageName: (context: Context, lecacyReviewImageName?: boolean) => StringOrBashExpression;
|
|
13
14
|
export declare const getArtifactsRegistryBuildCacheImage: (context: Context) => string;
|
|
14
15
|
export declare const getArtifactsRegistryImage: (context: Context) => string;
|
|
15
16
|
/**
|
|
@@ -31,8 +31,11 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
31
31
|
}
|
|
32
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
33
|
};
|
|
34
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
35
37
|
exports.getDeleteUnusedImagesCommands = exports.getArtifactsRegistryImage = exports.getArtifactsRegistryBuildCacheImage = exports.getArtifactsRegistryImageName = exports.getArtifactsRegistryDockerUrl = exports.getArtifactsRegistryHost = void 0;
|
|
38
|
+
var BashExpression_1 = require("../../bash/BashExpression");
|
|
36
39
|
var gitlab_1 = require("../../utils/gitlab");
|
|
37
40
|
var types_1 = require("../types");
|
|
38
41
|
var removeFirstLinesFromCommandOutput_1 = require("./utils/removeFirstLinesFromCommandOutput");
|
|
@@ -60,7 +63,6 @@ exports.getArtifactsRegistryDockerUrl = getArtifactsRegistryDockerUrl;
|
|
|
60
63
|
* 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
|
|
61
64
|
*/
|
|
62
65
|
var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
|
|
63
|
-
var _a;
|
|
64
66
|
if (lecacyReviewImageName === void 0) {
|
|
65
67
|
lecacyReviewImageName = false;
|
|
66
68
|
}
|
|
@@ -68,8 +70,8 @@ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
|
|
|
68
70
|
throw new Error("lecacyReviewImageName is only allowed for review app");
|
|
69
71
|
}
|
|
70
72
|
var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
|
|
71
|
-
var gcloudImagePath = __spreadArray([dockerUrl, context.environment.shortName, context.componentName], __read(context.environment.
|
|
72
|
-
return
|
|
73
|
+
var gcloudImagePath = __spreadArray([dockerUrl, context.environment.shortName, context.componentName], __read(context.environment.reviewSlug && !lecacyReviewImageName ? [context.environment.reviewSlug] : []), false);
|
|
74
|
+
return (0, BashExpression_1.joinBashExpressions)(gcloudImagePath, "/");
|
|
73
75
|
};
|
|
74
76
|
exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
|
|
75
77
|
var getArtifactsRegistryBuildCacheImage = function (context) {
|
|
@@ -31,7 +31,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
31
31
|
}
|
|
32
32
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
33
|
};
|
|
34
|
-
exports
|
|
34
|
+
Object.defineProperty(exports, "__esModule", {
|
|
35
|
+
value: true
|
|
36
|
+
});
|
|
35
37
|
exports.getRemoveOldRevisionsAndImagesCommand = void 0;
|
|
36
38
|
var artifactsRegistry_1 = require("./artifactsRegistry");
|
|
37
39
|
var cloudRunRevisions_1 = require("./cloudRunRevisions");
|
|
@@ -10,7 +10,9 @@ var __assign = this && this.__assign || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "__esModule", {
|
|
14
|
+
value: true
|
|
15
|
+
});
|
|
14
16
|
exports.getDeleteUnusedRevisionsCommands = void 0;
|
|
15
17
|
var types_1 = require("../types");
|
|
16
18
|
var createArgsString_1 = require("./utils/createArgsString");
|