@catladder/pipeline 0.0.0-update-docker-for-apps-e047cc44 → 0.0.0-update-node-b0c7282d
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/build/custom/buildJob.js +1 -1
- package/dist/build/docker.d.ts +26 -6
- package/dist/build/docker.js +53 -8
- package/dist/build/node/buildJob.js +1 -1
- package/dist/build/node/meteor.js +1 -1
- package/dist/build/rails/build.js +12 -3
- package/dist/bundles/catladder-gitlab/index.js +146 -49
- package/dist/constants.js +1 -1
- package/dist/deploy/base/deploy.js +1 -1
- package/dist/deploy/cloudRun/artifactsRegistry.d.ts +7 -4
- package/dist/deploy/cloudRun/artifactsRegistry.js +30 -23
- package/dist/deploy/cloudRun/deployJob.js +14 -9
- package/dist/deploy/dockerTag/deployJob.js +32 -1
- package/dist/deploy/types/googleCloudRun.d.ts +10 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +73 -77
- package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +1813 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +73 -77
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +73 -77
- package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +1855 -0
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +146 -154
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +146 -154
- package/examples/__snapshots__/cloud-run-with-worker.ts.snap +1853 -0
- package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +73 -77
- package/examples/__snapshots__/custom-build-job.ts.snap +73 -77
- package/examples/__snapshots__/custom-deploy.ts.snap +65 -53
- package/examples/__snapshots__/custom-sbom-java.ts.snap +73 -77
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +41 -29
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +41 -29
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +41 -29
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +82 -58
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +41 -29
- package/examples/__snapshots__/meteor-kubernetes.ts.snap +41 -29
- package/examples/__snapshots__/native-app.ts.snap +73 -77
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +73 -77
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +58 -54
- package/examples/cloud-run-meteor-with-worker.ts +35 -0
- package/examples/cloud-run-post-stop-job.ts +40 -0
- package/examples/cloud-run-with-worker.ts +35 -0
- package/examples/custom-deploy.ts +8 -0
- package/package.json +1 -1
- package/src/build/custom/buildJob.ts +1 -0
- package/src/build/docker.ts +56 -16
- package/src/build/node/buildJob.ts +1 -0
- package/src/build/node/meteor.ts +1 -1
- package/src/build/rails/build.ts +2 -2
- package/src/deploy/base/deploy.ts +1 -1
- package/src/deploy/cloudRun/artifactsRegistry.ts +35 -32
- package/src/deploy/cloudRun/deployJob.ts +30 -15
- package/src/deploy/dockerTag/deployJob.ts +1 -1
- package/src/deploy/types/googleCloudRun.ts +11 -6
|
@@ -75,7 +75,7 @@ var createCustomBuildJobs = function (context) {
|
|
|
75
75
|
}
|
|
76
76
|
} : undefined,
|
|
77
77
|
dockerBuild: {
|
|
78
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
78
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
79
79
|
variables: {}
|
|
80
80
|
}
|
|
81
81
|
});
|
package/dist/build/docker.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { Context } from "../types";
|
|
2
2
|
import type { CatladderJob } from "../types/jobs";
|
|
3
3
|
export declare const getDockerImageVariables: (context: Context) => {
|
|
4
|
+
DOCKER_IMAGE_TAG: string;
|
|
5
|
+
DOCKER_REGISTRY: string;
|
|
6
|
+
DOCKER_IMAGE: string;
|
|
7
|
+
DOCKER_CACHE_IMAGE: string;
|
|
8
|
+
} | {
|
|
9
|
+
DOCKER_IMAGE_TAG: string;
|
|
4
10
|
DOCKER_REGISTRY: string;
|
|
5
|
-
DOCKER_REGISTRY_IMAGE_PATH: string;
|
|
6
11
|
DOCKER_CACHE_IMAGE: string;
|
|
7
12
|
DOCKER_IMAGE_NAME: string;
|
|
8
13
|
DOCKER_IMAGE: string;
|
|
9
|
-
DOCKER_IMAGE_TAG: string;
|
|
10
14
|
};
|
|
11
15
|
/**
|
|
12
16
|
* Weather the context requires a docker build
|
|
@@ -17,12 +21,28 @@ export declare const requiresDockerBuild: ({
|
|
|
17
21
|
}
|
|
18
22
|
}: Context) => boolean;
|
|
19
23
|
export declare const getDockerBuildVariables: (context: Context) => {
|
|
24
|
+
DOCKER_IMAGE_TAG: string;
|
|
25
|
+
DOCKER_REGISTRY: string;
|
|
26
|
+
DOCKER_IMAGE: string;
|
|
27
|
+
DOCKER_CACHE_IMAGE: string;
|
|
28
|
+
DOCKER_HOST: string;
|
|
29
|
+
DOCKER_TLS_CERTDIR: string;
|
|
30
|
+
DOCKER_DRIVER: string;
|
|
31
|
+
DOCKER_BUILDKIT: string;
|
|
32
|
+
DOCKERFILE_ADDITIONS: string | undefined;
|
|
33
|
+
DOCKERFILE_ADDITIONS_END: string | undefined;
|
|
34
|
+
APP_DIR: string;
|
|
35
|
+
DOCKER_DIR: string;
|
|
36
|
+
KUBERNETES_CPU_REQUEST: string;
|
|
37
|
+
KUBERNETES_CPU_LIMIT: string;
|
|
38
|
+
KUBERNETES_MEMORY_REQUEST: string;
|
|
39
|
+
KUBERNETES_MEMORY_LIMIT: string;
|
|
40
|
+
} | {
|
|
41
|
+
DOCKER_IMAGE_TAG: string;
|
|
20
42
|
DOCKER_REGISTRY: string;
|
|
21
|
-
DOCKER_REGISTRY_IMAGE_PATH: string;
|
|
22
43
|
DOCKER_CACHE_IMAGE: string;
|
|
23
44
|
DOCKER_IMAGE_NAME: string;
|
|
24
45
|
DOCKER_IMAGE: string;
|
|
25
|
-
DOCKER_IMAGE_TAG: string;
|
|
26
46
|
DOCKER_HOST: string;
|
|
27
47
|
DOCKER_TLS_CERTDIR: string;
|
|
28
48
|
DOCKER_DRIVER: string;
|
|
@@ -55,6 +75,6 @@ export declare const createDockerBuildJobBase: (context: Context, {
|
|
|
55
75
|
script,
|
|
56
76
|
...def
|
|
57
77
|
}: Partial<CatladderJob>) => CatladderJob;
|
|
58
|
-
export declare const gitlabDockerLogin
|
|
59
|
-
export declare const getDockerBuildDefaultScript: (ensureDockerFileScript?: string | undefined) => (string | undefined)[];
|
|
78
|
+
export declare const gitlabDockerLogin: (context: Context) => string[];
|
|
79
|
+
export declare const getDockerBuildDefaultScript: (context: Context, ensureDockerFileScript?: string | undefined) => (string | undefined)[];
|
|
60
80
|
export declare const hasDockerfile: (context: Context) => boolean;
|
package/dist/build/docker.js
CHANGED
|
@@ -18,6 +18,37 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
18
18
|
}
|
|
19
19
|
return t;
|
|
20
20
|
};
|
|
21
|
+
var __read = this && this.__read || function (o, n) {
|
|
22
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
23
|
+
if (!m) return o;
|
|
24
|
+
var i = m.call(o),
|
|
25
|
+
r,
|
|
26
|
+
ar = [],
|
|
27
|
+
e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
e = {
|
|
32
|
+
error: error
|
|
33
|
+
};
|
|
34
|
+
} finally {
|
|
35
|
+
try {
|
|
36
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
37
|
+
} finally {
|
|
38
|
+
if (e) throw e.error;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return ar;
|
|
42
|
+
};
|
|
43
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
44
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
45
|
+
if (ar || !(i in from)) {
|
|
46
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
47
|
+
ar[i] = from[i];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
51
|
+
};
|
|
21
52
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
22
53
|
return mod && mod.__esModule ? mod : {
|
|
23
54
|
"default": mod
|
|
@@ -30,6 +61,9 @@ var deploy_1 = require("../deploy");
|
|
|
30
61
|
var runner_1 = require("../runner");
|
|
31
62
|
var fs_1 = require("fs");
|
|
32
63
|
var path_1 = __importDefault(require("path"));
|
|
64
|
+
var gitlab_1 = require("../utils/gitlab");
|
|
65
|
+
var artifactsRegistry_1 = require("../deploy/cloudRun/artifactsRegistry");
|
|
66
|
+
var gcloudServiceAccountLoginCommands_1 = require("../deploy/cloudRun/utils/gcloudServiceAccountLoginCommands");
|
|
33
67
|
var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
34
68
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
35
69
|
KUBERNETES_CPU_LIMIT: "1",
|
|
@@ -37,14 +71,21 @@ var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
|
37
71
|
KUBERNETES_MEMORY_LIMIT: "2Gi"
|
|
38
72
|
};
|
|
39
73
|
var getDockerImageVariables = function (context) {
|
|
40
|
-
return {
|
|
74
|
+
return __assign(__assign({}, (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? {
|
|
75
|
+
DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
|
|
76
|
+
DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
|
|
77
|
+
DOCKER_CACHE_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryBuildCacheImage)(context)
|
|
78
|
+
} :
|
|
79
|
+
// gitlab registry:
|
|
80
|
+
{
|
|
41
81
|
DOCKER_REGISTRY: "$CI_REGISTRY",
|
|
42
|
-
|
|
43
|
-
|
|
82
|
+
DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName,
|
|
83
|
+
// ONLY USED IN KUBERNETES
|
|
44
84
|
DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
|
|
45
|
-
DOCKER_IMAGE: "$
|
|
85
|
+
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE/$DOCKER_IMAGE_NAME"
|
|
86
|
+
}), {
|
|
46
87
|
DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA"
|
|
47
|
-
};
|
|
88
|
+
});
|
|
48
89
|
};
|
|
49
90
|
exports.getDockerImageVariables = getDockerImageVariables;
|
|
50
91
|
/**
|
|
@@ -99,9 +140,13 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
99
140
|
}, def);
|
|
100
141
|
};
|
|
101
142
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
143
|
+
var gitlabDockerLogin = function (context) {
|
|
144
|
+
return (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context))], false) : ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY"];
|
|
145
|
+
};
|
|
146
|
+
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
147
|
+
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
148
|
+
return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1" //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
|
|
149
|
+
])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")(["docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"])), false).filter(Boolean);
|
|
105
150
|
};
|
|
106
151
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
107
152
|
var hasDockerfile = function (context) {
|
|
@@ -79,7 +79,7 @@ var createNodeBuildJobs = function (context) {
|
|
|
79
79
|
jobTags: buildConfig.jobTags
|
|
80
80
|
} : undefined,
|
|
81
81
|
dockerBuild: {
|
|
82
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
82
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
83
83
|
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
84
84
|
variables: {
|
|
85
85
|
// only required for non static
|
|
@@ -66,7 +66,7 @@ var createMeteorBuildJobs = function (context) {
|
|
|
66
66
|
}
|
|
67
67
|
} : undefined,
|
|
68
68
|
dockerBuild: {
|
|
69
|
-
script: (0, docker_1.getDockerBuildDefaultScript)("ensureMeteorDockerfile"),
|
|
69
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
|
|
70
70
|
variables: {
|
|
71
71
|
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
|
|
72
72
|
}
|
|
@@ -32,6 +32,15 @@ var __read = this && this.__read || function (o, n) {
|
|
|
32
32
|
}
|
|
33
33
|
return ar;
|
|
34
34
|
};
|
|
35
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
36
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
37
|
+
if (ar || !(i in from)) {
|
|
38
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
39
|
+
ar[i] = from[i];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
|
+
};
|
|
35
44
|
exports.__esModule = true;
|
|
36
45
|
exports.createRailsBuildJobs = void 0;
|
|
37
46
|
var base_1 = require("../base");
|
|
@@ -48,7 +57,7 @@ var createRailsBuildJobs = function (context) {
|
|
|
48
57
|
return (0, base_1.createBuildJobs)(context, {
|
|
49
58
|
appBuild: undefined,
|
|
50
59
|
dockerBuild: {
|
|
51
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(),
|
|
60
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context),
|
|
52
61
|
variables: {}
|
|
53
62
|
}
|
|
54
63
|
});
|
|
@@ -65,9 +74,9 @@ var createRailsBuildJobs = function (context) {
|
|
|
65
74
|
dockerBuild: {
|
|
66
75
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
|
|
67
76
|
// custom script
|
|
68
|
-
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
77
|
+
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
69
78
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
70
|
-
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")]
|
|
79
|
+
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")], false)
|
|
71
80
|
}
|
|
72
81
|
});
|
|
73
82
|
};
|
|
@@ -27267,7 +27267,7 @@ var createCustomBuildJobs = function (context) {
|
|
|
27267
27267
|
}
|
|
27268
27268
|
} : undefined,
|
|
27269
27269
|
dockerBuild: {
|
|
27270
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
27270
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
27271
27271
|
variables: {}
|
|
27272
27272
|
}
|
|
27273
27273
|
});
|
|
@@ -27452,6 +27452,37 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
27452
27452
|
}
|
|
27453
27453
|
return t;
|
|
27454
27454
|
};
|
|
27455
|
+
var __read = this && this.__read || function (o, n) {
|
|
27456
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27457
|
+
if (!m) return o;
|
|
27458
|
+
var i = m.call(o),
|
|
27459
|
+
r,
|
|
27460
|
+
ar = [],
|
|
27461
|
+
e;
|
|
27462
|
+
try {
|
|
27463
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27464
|
+
} catch (error) {
|
|
27465
|
+
e = {
|
|
27466
|
+
error: error
|
|
27467
|
+
};
|
|
27468
|
+
} finally {
|
|
27469
|
+
try {
|
|
27470
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27471
|
+
} finally {
|
|
27472
|
+
if (e) throw e.error;
|
|
27473
|
+
}
|
|
27474
|
+
}
|
|
27475
|
+
return ar;
|
|
27476
|
+
};
|
|
27477
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
27478
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27479
|
+
if (ar || !(i in from)) {
|
|
27480
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27481
|
+
ar[i] = from[i];
|
|
27482
|
+
}
|
|
27483
|
+
}
|
|
27484
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
27485
|
+
};
|
|
27455
27486
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
27456
27487
|
return mod && mod.__esModule ? mod : {
|
|
27457
27488
|
"default": mod
|
|
@@ -27464,6 +27495,9 @@ var deploy_1 = __nccwpck_require__(1264);
|
|
|
27464
27495
|
var runner_1 = __nccwpck_require__(7666);
|
|
27465
27496
|
var fs_1 = __nccwpck_require__(7147);
|
|
27466
27497
|
var path_1 = __importDefault(__nccwpck_require__(1017));
|
|
27498
|
+
var gitlab_1 = __nccwpck_require__(9818);
|
|
27499
|
+
var artifactsRegistry_1 = __nccwpck_require__(998);
|
|
27500
|
+
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(818);
|
|
27467
27501
|
var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
27468
27502
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
27469
27503
|
KUBERNETES_CPU_LIMIT: "1",
|
|
@@ -27471,14 +27505,21 @@ var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
|
27471
27505
|
KUBERNETES_MEMORY_LIMIT: "2Gi"
|
|
27472
27506
|
};
|
|
27473
27507
|
var getDockerImageVariables = function (context) {
|
|
27474
|
-
return {
|
|
27508
|
+
return __assign(__assign({}, (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? {
|
|
27509
|
+
DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
|
|
27510
|
+
DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
|
|
27511
|
+
DOCKER_CACHE_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryBuildCacheImage)(context)
|
|
27512
|
+
} :
|
|
27513
|
+
// gitlab registry:
|
|
27514
|
+
{
|
|
27475
27515
|
DOCKER_REGISTRY: "$CI_REGISTRY",
|
|
27476
|
-
|
|
27477
|
-
|
|
27516
|
+
DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName,
|
|
27517
|
+
// ONLY USED IN KUBERNETES
|
|
27478
27518
|
DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
|
|
27479
|
-
DOCKER_IMAGE: "$
|
|
27519
|
+
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE/$DOCKER_IMAGE_NAME"
|
|
27520
|
+
}), {
|
|
27480
27521
|
DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA"
|
|
27481
|
-
};
|
|
27522
|
+
});
|
|
27482
27523
|
};
|
|
27483
27524
|
exports.getDockerImageVariables = getDockerImageVariables;
|
|
27484
27525
|
/**
|
|
@@ -27533,9 +27574,13 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
27533
27574
|
}, def);
|
|
27534
27575
|
};
|
|
27535
27576
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
27536
|
-
|
|
27537
|
-
|
|
27538
|
-
|
|
27577
|
+
var gitlabDockerLogin = function (context) {
|
|
27578
|
+
return (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context))], false) : ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY"];
|
|
27579
|
+
};
|
|
27580
|
+
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
27581
|
+
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
27582
|
+
return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1" //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
|
|
27583
|
+
])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")(["docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"])), false).filter(Boolean);
|
|
27539
27584
|
};
|
|
27540
27585
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
27541
27586
|
var hasDockerfile = function (context) {
|
|
@@ -27714,7 +27759,7 @@ var createNodeBuildJobs = function (context) {
|
|
|
27714
27759
|
jobTags: buildConfig.jobTags
|
|
27715
27760
|
} : undefined,
|
|
27716
27761
|
dockerBuild: {
|
|
27717
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
27762
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
27718
27763
|
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
27719
27764
|
variables: {
|
|
27720
27765
|
// only required for non static
|
|
@@ -27976,7 +28021,7 @@ var createMeteorBuildJobs = function (context) {
|
|
|
27976
28021
|
}
|
|
27977
28022
|
} : undefined,
|
|
27978
28023
|
dockerBuild: {
|
|
27979
|
-
script: (0, docker_1.getDockerBuildDefaultScript)("ensureMeteorDockerfile"),
|
|
28024
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
|
|
27980
28025
|
variables: {
|
|
27981
28026
|
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
|
|
27982
28027
|
}
|
|
@@ -28208,6 +28253,15 @@ var __read = this && this.__read || function (o, n) {
|
|
|
28208
28253
|
}
|
|
28209
28254
|
return ar;
|
|
28210
28255
|
};
|
|
28256
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
28257
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
28258
|
+
if (ar || !(i in from)) {
|
|
28259
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
28260
|
+
ar[i] = from[i];
|
|
28261
|
+
}
|
|
28262
|
+
}
|
|
28263
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
28264
|
+
};
|
|
28211
28265
|
exports.__esModule = true;
|
|
28212
28266
|
exports.createRailsBuildJobs = void 0;
|
|
28213
28267
|
var base_1 = __nccwpck_require__(6633);
|
|
@@ -28224,7 +28278,7 @@ var createRailsBuildJobs = function (context) {
|
|
|
28224
28278
|
return (0, base_1.createBuildJobs)(context, {
|
|
28225
28279
|
appBuild: undefined,
|
|
28226
28280
|
dockerBuild: {
|
|
28227
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(),
|
|
28281
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context),
|
|
28228
28282
|
variables: {}
|
|
28229
28283
|
}
|
|
28230
28284
|
});
|
|
@@ -28241,9 +28295,9 @@ var createRailsBuildJobs = function (context) {
|
|
|
28241
28295
|
dockerBuild: {
|
|
28242
28296
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
|
|
28243
28297
|
// custom script
|
|
28244
|
-
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
28298
|
+
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
28245
28299
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
28246
|
-
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")]
|
|
28300
|
+
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")], false)
|
|
28247
28301
|
}
|
|
28248
28302
|
});
|
|
28249
28303
|
};
|
|
@@ -28691,7 +28745,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
28691
28745
|
|
|
28692
28746
|
exports.__esModule = true;
|
|
28693
28747
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
28694
|
-
exports.PIPELINE_IMAGE_TAG = "update-
|
|
28748
|
+
exports.PIPELINE_IMAGE_TAG = "update-node-b0c7282d" || 0;
|
|
28695
28749
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
28696
28750
|
|
|
28697
28751
|
/***/ }),
|
|
@@ -30006,7 +30060,7 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
30006
30060
|
var _a, _b, _c, _d;
|
|
30007
30061
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
30008
30062
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
30009
|
-
var autoStop = context.environment.envType === "review" ? "
|
|
30063
|
+
var autoStop = context.environment.envType === "review" ? "1 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
|
|
30010
30064
|
// if auto or manual is configured explicitly, use that
|
|
30011
30065
|
var whenDeployDefined = context.componentConfig.deploy && context.componentConfig.deploy.when ? context.componentConfig.deploy.when : undefined;
|
|
30012
30066
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
@@ -30255,11 +30309,29 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
30255
30309
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
30256
30310
|
};
|
|
30257
30311
|
exports.__esModule = true;
|
|
30258
|
-
exports.getDeleteUnusedImagesCommands = exports.
|
|
30259
|
-
var docker_1 = __nccwpck_require__(9953);
|
|
30312
|
+
exports.getDeleteUnusedImagesCommands = exports.getArtifactsRegistryImage = exports.getArtifactsRegistryBuildCacheImage = exports.getArtifactsRegistryImageName = exports.getArtifactsRegistryDockerUrl = exports.getArtifactsRegistryHost = void 0;
|
|
30260
30313
|
var gitlab_1 = __nccwpck_require__(9818);
|
|
30261
30314
|
var types_1 = __nccwpck_require__(4436);
|
|
30262
30315
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(8981);
|
|
30316
|
+
var getArtifactsRegistryHost = function (_a) {
|
|
30317
|
+
var deploy = _a.componentConfig.deploy;
|
|
30318
|
+
if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
|
|
30319
|
+
// should not happen
|
|
30320
|
+
throw new Error("deploy config is wrong");
|
|
30321
|
+
}
|
|
30322
|
+
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
30323
|
+
};
|
|
30324
|
+
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
30325
|
+
var getArtifactsRegistryDockerUrl = function (context) {
|
|
30326
|
+
var deployConfig = context.componentConfig.deploy;
|
|
30327
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
30328
|
+
// should not happen
|
|
30329
|
+
throw new Error("deploy config is wrong");
|
|
30330
|
+
}
|
|
30331
|
+
var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
|
|
30332
|
+
return "".concat((0, exports.getArtifactsRegistryHost)(context), "/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
|
|
30333
|
+
};
|
|
30334
|
+
exports.getArtifactsRegistryDockerUrl = getArtifactsRegistryDockerUrl;
|
|
30263
30335
|
/**
|
|
30264
30336
|
*
|
|
30265
30337
|
* 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
|
|
@@ -30269,37 +30341,25 @@ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
|
|
|
30269
30341
|
if (lecacyReviewImageName === void 0) {
|
|
30270
30342
|
lecacyReviewImageName = false;
|
|
30271
30343
|
}
|
|
30272
|
-
var deployConfig = context.componentConfig.deploy;
|
|
30273
|
-
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
30274
|
-
// should not happen
|
|
30275
|
-
throw new Error("deploy config is wrong");
|
|
30276
|
-
}
|
|
30277
30344
|
if (lecacyReviewImageName && context.environment.envType !== "review") {
|
|
30278
30345
|
throw new Error("lecacyReviewImageName is only allowed for review app");
|
|
30279
30346
|
}
|
|
30280
|
-
var
|
|
30281
|
-
var dockerUrl = "".concat(deployConfig.region, "-docker.pkg.dev/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
|
|
30347
|
+
var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
|
|
30282
30348
|
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);
|
|
30283
30349
|
return gcloudImagePath.join("/");
|
|
30284
30350
|
};
|
|
30285
30351
|
exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
|
|
30352
|
+
var getArtifactsRegistryBuildCacheImage = function (context) {
|
|
30353
|
+
var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
|
|
30354
|
+
// does not include env, so that after merge, you might get more cache hits (review-->dev)
|
|
30355
|
+
var gcloudImagePath = [dockerUrl, "caches", context.componentName];
|
|
30356
|
+
return gcloudImagePath.join("/");
|
|
30357
|
+
};
|
|
30358
|
+
exports.getArtifactsRegistryBuildCacheImage = getArtifactsRegistryBuildCacheImage;
|
|
30286
30359
|
var getArtifactsRegistryImage = function (context) {
|
|
30287
30360
|
return "".concat((0, exports.getArtifactsRegistryImageName)(context), ":$DOCKER_IMAGE_TAG");
|
|
30288
30361
|
};
|
|
30289
30362
|
exports.getArtifactsRegistryImage = getArtifactsRegistryImage;
|
|
30290
|
-
/**
|
|
30291
|
-
* 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
|
|
30292
|
-
*/
|
|
30293
|
-
var getPushToArtifactsRegistryCommands = function (context) {
|
|
30294
|
-
var deployConfig = context.componentConfig.deploy;
|
|
30295
|
-
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
30296
|
-
// should not happen
|
|
30297
|
-
throw new Error("deploy config is wrong");
|
|
30298
|
-
}
|
|
30299
|
-
var fullImageName = (0, exports.getArtifactsRegistryImageName)(context);
|
|
30300
|
-
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")];
|
|
30301
|
-
};
|
|
30302
|
-
exports.getPushToArtifactsRegistryCommands = getPushToArtifactsRegistryCommands;
|
|
30303
30363
|
var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
30304
30364
|
if (keepNewest === void 0) {
|
|
30305
30365
|
keepNewest = 0;
|
|
@@ -30335,7 +30395,8 @@ var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
|
30335
30395
|
throw new Error("deploy config is wrong");
|
|
30336
30396
|
}
|
|
30337
30397
|
var fullImageName = (0, exports.getArtifactsRegistryImageName)(context);
|
|
30338
|
-
|
|
30398
|
+
var buildCacheImageName = (0, exports.getArtifactsRegistryBuildCacheImage)(context);
|
|
30399
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read(getDeleteImageCommands(fullImageName, keep)), false), __read(getDeleteImageCommands(buildCacheImageName, 1)), false), __read(context.environment.envType === "review" ? (0, gitlab_1.allowFailureInScripts)(getDeleteImageCommands((0, exports.getArtifactsRegistryImageName)(context, true), 0)) : []), false);
|
|
30339
30400
|
};
|
|
30340
30401
|
exports.getDeleteUnusedImagesCommands = getDeleteUnusedImagesCommands;
|
|
30341
30402
|
|
|
@@ -30533,7 +30594,7 @@ var jobName_1 = __nccwpck_require__(9357);
|
|
|
30533
30594
|
var artifactsRegistry_1 = __nccwpck_require__(998);
|
|
30534
30595
|
var getServiceName_1 = __nccwpck_require__(5044);
|
|
30535
30596
|
var cleanup_1 = __nccwpck_require__(5970);
|
|
30536
|
-
var
|
|
30597
|
+
var setGoogleProjectNumberScript = function (deployConfig) {
|
|
30537
30598
|
return ["export GCLOUD_PROJECT_NUMBER=$(gcloud projects describe ".concat(deployConfig.projectId, " --format=\"value(projectNumber)\")"), "echo \"GCLOUD_PROJECT_NUMBER: $GCLOUD_PROJECT_NUMBER\""];
|
|
30538
30599
|
};
|
|
30539
30600
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
@@ -30595,9 +30656,10 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
30595
30656
|
var _a, _b, _c, _d, _e;
|
|
30596
30657
|
var customConfig = service !== true ? service : undefined;
|
|
30597
30658
|
var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
|
|
30659
|
+
var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
|
|
30598
30660
|
var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
|
|
30599
30661
|
// command as empty string resets it to default (uses the image's entrypoint)
|
|
30600
|
-
command:
|
|
30662
|
+
command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
|
|
30601
30663
|
}, commonDeployArgs), {
|
|
30602
30664
|
"env-vars-file": "____envvars.yaml",
|
|
30603
30665
|
"min-instances": (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _b !== void 0 ? _b : 0,
|
|
@@ -30614,9 +30676,11 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
30614
30676
|
// due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
|
|
30615
30677
|
// lucky, update on the other hand accepts it... so let's just imediatly update it
|
|
30616
30678
|
// also we cannot upsert a job, so we have to create it and catch the error and then update
|
|
30679
|
+
var commandArray = Array.isArray(job.command) ? job.command : job.command.split(" ");
|
|
30617
30680
|
var commonDeployArgsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
|
|
30618
|
-
command: '"' +
|
|
30681
|
+
command: '"' + commandArray.join(",") + '"'
|
|
30619
30682
|
}, commonDeployArgs), {
|
|
30683
|
+
image: job.image || commonDeployArgs.image,
|
|
30620
30684
|
memory: job.memory || "512Mi",
|
|
30621
30685
|
"task-timeout": job.timeout || "10m"
|
|
30622
30686
|
}));
|
|
@@ -30631,8 +30695,8 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
30631
30695
|
return getJobCreateScriptsForJob(jobName, job);
|
|
30632
30696
|
}).flat();
|
|
30633
30697
|
};
|
|
30634
|
-
var getJobRunScriptForJob = function (jobName) {
|
|
30635
|
-
return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgsString);
|
|
30698
|
+
var getJobRunScriptForJob = function (jobName, wait) {
|
|
30699
|
+
return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgsString).concat(wait ? " --wait" : "");
|
|
30636
30700
|
};
|
|
30637
30701
|
var getJobRunScripts = function (when) {
|
|
30638
30702
|
return jobsWithNames.filter(function (_a) {
|
|
@@ -30640,7 +30704,9 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
30640
30704
|
return job.when === when;
|
|
30641
30705
|
}).map(function (_a) {
|
|
30642
30706
|
var jobName = _a.jobName;
|
|
30643
|
-
return getJobRunScriptForJob(jobName
|
|
30707
|
+
return getJobRunScriptForJob(jobName,
|
|
30708
|
+
// wait for completin on stop jobs, since stop will delete the jobs afterwards, so they will fail
|
|
30709
|
+
["preStop", "postStop"].includes(when));
|
|
30644
30710
|
});
|
|
30645
30711
|
};
|
|
30646
30712
|
var getCreateScheduleScripts = function () {
|
|
@@ -30680,7 +30746,7 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
30680
30746
|
"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)];
|
|
30681
30747
|
});
|
|
30682
30748
|
};
|
|
30683
|
-
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(
|
|
30749
|
+
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gitlab_1.collapseableSection)("prepare", "Prepare...")(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setGoogleProjectNumberScript(deployConfig)), false))), 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
|
|
30684
30750
|
: []), 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) {
|
|
30685
30751
|
var _b = __read(_a, 2),
|
|
30686
30752
|
name = _b[0],
|
|
@@ -30688,11 +30754,11 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
30688
30754
|
return getServiceDeployScript(service, "-" + name);
|
|
30689
30755
|
})), 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
|
|
30690
30756
|
)), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false);
|
|
30691
|
-
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) {
|
|
30757
|
+
var stopScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(getJobRunScripts("preStop")), 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) {
|
|
30692
30758
|
var _b = __read(_a, 1),
|
|
30693
30759
|
name = _b[0];
|
|
30694
30760
|
return "gcloud run services delete ".concat(serviceName, "-").concat(name, " ").concat(commonArgsString);
|
|
30695
|
-
})), 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);
|
|
30761
|
+
})), false), __read(getJobRunScripts("postStop")), 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);
|
|
30696
30762
|
return (0, base_1.createDeployementJobs)(context, {
|
|
30697
30763
|
deploy: (0, lodash_1.merge)((0, docker_1.getDockerJobBaseProps)(context), {
|
|
30698
30764
|
artifacts: {
|
|
@@ -31185,6 +31251,37 @@ var __assign = this && this.__assign || function () {
|
|
|
31185
31251
|
};
|
|
31186
31252
|
return __assign.apply(this, arguments);
|
|
31187
31253
|
};
|
|
31254
|
+
var __read = this && this.__read || function (o, n) {
|
|
31255
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
31256
|
+
if (!m) return o;
|
|
31257
|
+
var i = m.call(o),
|
|
31258
|
+
r,
|
|
31259
|
+
ar = [],
|
|
31260
|
+
e;
|
|
31261
|
+
try {
|
|
31262
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
31263
|
+
} catch (error) {
|
|
31264
|
+
e = {
|
|
31265
|
+
error: error
|
|
31266
|
+
};
|
|
31267
|
+
} finally {
|
|
31268
|
+
try {
|
|
31269
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
31270
|
+
} finally {
|
|
31271
|
+
if (e) throw e.error;
|
|
31272
|
+
}
|
|
31273
|
+
}
|
|
31274
|
+
return ar;
|
|
31275
|
+
};
|
|
31276
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
31277
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31278
|
+
if (ar || !(i in from)) {
|
|
31279
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
31280
|
+
ar[i] = from[i];
|
|
31281
|
+
}
|
|
31282
|
+
}
|
|
31283
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31284
|
+
};
|
|
31188
31285
|
exports.__esModule = true;
|
|
31189
31286
|
exports.createDockerTagDeployJobs = void 0;
|
|
31190
31287
|
var docker_1 = __nccwpck_require__(9953);
|
|
@@ -31202,7 +31299,7 @@ var createDockerTagDeployJobs = function (context) {
|
|
|
31202
31299
|
var tag = deployConfig.tag;
|
|
31203
31300
|
return (0, base_1.createDeployementJobs)(context, {
|
|
31204
31301
|
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(context)), {
|
|
31205
|
-
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag), "docker push $DOCKER_IMAGE:".concat(tag), "echo \"pushed as $DOCKER_IMAGE:".concat(tag, "\"")]
|
|
31302
|
+
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag), "docker push $DOCKER_IMAGE:".concat(tag), "echo \"pushed as $DOCKER_IMAGE:".concat(tag, "\"")], false)
|
|
31206
31303
|
})
|
|
31207
31304
|
});
|
|
31208
31305
|
};
|
package/dist/constants.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5
|
-
exports.PIPELINE_IMAGE_TAG = "update-
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "update-node-b0c7282d" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
|
@@ -54,7 +54,7 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
54
54
|
var _a, _b, _c, _d;
|
|
55
55
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
56
56
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
57
|
-
var autoStop = context.environment.envType === "review" ? "
|
|
57
|
+
var autoStop = context.environment.envType === "review" ? "1 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
|
|
58
58
|
// if auto or manual is configured explicitly, use that
|
|
59
59
|
var whenDeployDefined = context.componentConfig.deploy && context.componentConfig.deploy.when ? context.componentConfig.deploy.when : undefined;
|
|
60
60
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|