@catladder/pipeline 1.148.0 → 1.149.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/bundles/catladder-gitlab/index.js +2 -2
- package/dist/config/__tests__/getAllEnvs.test.d.ts +1 -0
- package/dist/config/__tests__/getAllEnvs.test.js +79 -0
- package/dist/config/__tests__/getAllEnvsInAllComponents.test.d.ts +1 -0
- package/dist/config/__tests__/getAllEnvsInAllComponents.test.js +73 -0
- package/dist/constants.js +1 -1
- package/dist/context/getBuildInfoVariables.js +1 -1
- package/dist/deploy/cloudRun/createJobs/common.js +1 -1
- package/dist/deploy/sbom.js +2 -2
- package/dist/pipeline/__tests__/getPipelineStages.test.d.ts +1 -0
- package/dist/pipeline/__tests__/getPipelineStages.test.js +73 -0
- package/dist/pipeline/getPipelineStages.d.ts +3 -4
- package/dist/pipeline/getPipelineStages.js +6 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/writeFiles.d.ts +5 -1
- package/dist/utils/writeFiles.js +10 -2
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-no-service.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-service-gen2.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-service-with-volumes.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-storybook.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-with-ngnix.ts.snap +20 -41
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +40 -61
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +40 -61
- package/examples/__snapshots__/cloud-run-with-worker.ts.snap +20 -41
- package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +20 -41
- package/examples/__snapshots__/custom-build-job.ts.snap +20 -41
- package/examples/__snapshots__/custom-deploy.ts.snap +16 -37
- package/examples/__snapshots__/custom-envs.ts.snap +6 -27
- package/examples/__snapshots__/custom-sbom-java.ts.snap +20 -41
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +28 -49
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +28 -49
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +28 -49
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +56 -77
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +28 -49
- package/examples/__snapshots__/local-dot-env.ts.snap +20 -41
- package/examples/__snapshots__/meteor-kubernetes.ts.snap +28 -49
- package/examples/__snapshots__/multiline-var.ts.snap +48 -69
- package/examples/__snapshots__/native-app.ts.snap +36 -57
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +20 -41
- package/examples/__snapshots__/node-build-with-docker-additions.ts.snap +20 -41
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +48 -90
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +24 -45
- package/package.json +1 -1
- package/src/config/__tests__/__snapshots__/getAllEnvs.test.ts.snap +31 -0
- package/src/config/__tests__/__snapshots__/getAllEnvsInAllComponents.test.ts.snap +15 -0
- package/src/config/__tests__/getAllEnvs.test.ts +71 -0
- package/src/config/__tests__/getAllEnvsInAllComponents.test.ts +63 -0
- package/src/context/getBuildInfoVariables.ts +1 -1
- package/src/deploy/cloudRun/createJobs/common.ts +1 -1
- package/src/deploy/sbom.ts +2 -2
- package/src/pipeline/__tests__/__snapshots__/getPipelineStages.test.ts.snap +69 -0
- package/src/pipeline/__tests__/getPipelineStages.test.ts +63 -0
- package/src/pipeline/getPipelineStages.ts +6 -5
- package/src/utils/writeFiles.ts +14 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var configruedEnvs_1 = require("../configruedEnvs");
|
|
7
|
+
describe("getAllEnvs()", function () {
|
|
8
|
+
var cluster = {
|
|
9
|
+
type: "gcloud",
|
|
10
|
+
name: "mega-cluster",
|
|
11
|
+
projectId: "super-google-project",
|
|
12
|
+
region: "ch-blabla"
|
|
13
|
+
};
|
|
14
|
+
var SIMPLE_CONFIG = {
|
|
15
|
+
appName: "my-app",
|
|
16
|
+
customerName: "pan",
|
|
17
|
+
components: {
|
|
18
|
+
app1: {
|
|
19
|
+
dir: "dir1",
|
|
20
|
+
build: {
|
|
21
|
+
type: "node"
|
|
22
|
+
},
|
|
23
|
+
deploy: {
|
|
24
|
+
type: "kubernetes",
|
|
25
|
+
cluster: cluster
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
app2: {
|
|
29
|
+
dir: "dir2",
|
|
30
|
+
build: {
|
|
31
|
+
type: "node"
|
|
32
|
+
},
|
|
33
|
+
deploy: {
|
|
34
|
+
type: "kubernetes",
|
|
35
|
+
cluster: cluster
|
|
36
|
+
},
|
|
37
|
+
env: {
|
|
38
|
+
dev2: {
|
|
39
|
+
type: "dev"
|
|
40
|
+
},
|
|
41
|
+
review2: {
|
|
42
|
+
type: "review"
|
|
43
|
+
},
|
|
44
|
+
stage2: {
|
|
45
|
+
type: "stage"
|
|
46
|
+
},
|
|
47
|
+
prod2: {
|
|
48
|
+
type: "prod"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
app3: {
|
|
53
|
+
dir: "dir2",
|
|
54
|
+
build: {
|
|
55
|
+
type: "node"
|
|
56
|
+
},
|
|
57
|
+
deploy: {
|
|
58
|
+
type: "kubernetes",
|
|
59
|
+
cluster: cluster
|
|
60
|
+
},
|
|
61
|
+
env: {
|
|
62
|
+
dev: false,
|
|
63
|
+
review: false,
|
|
64
|
+
stage: false,
|
|
65
|
+
prod: false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
it("should return all envs for app1", function () {
|
|
71
|
+
expect((0, configruedEnvs_1.getAllEnvs)(SIMPLE_CONFIG, "app1")).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
it("should return all envs for app2", function () {
|
|
74
|
+
expect((0, configruedEnvs_1.getAllEnvs)(SIMPLE_CONFIG, "app2")).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
it("should return all envs for app3", function () {
|
|
77
|
+
expect((0, configruedEnvs_1.getAllEnvs)(SIMPLE_CONFIG, "app3")).toMatchSnapshot();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var configruedEnvs_1 = require("../configruedEnvs");
|
|
7
|
+
describe("getAllEnvsInAllComponents()", function () {
|
|
8
|
+
var cluster = {
|
|
9
|
+
type: "gcloud",
|
|
10
|
+
name: "mega-cluster",
|
|
11
|
+
projectId: "super-google-project",
|
|
12
|
+
region: "ch-blabla"
|
|
13
|
+
};
|
|
14
|
+
var SIMPLE_CONFIG1 = {
|
|
15
|
+
appName: "my-app",
|
|
16
|
+
customerName: "pan",
|
|
17
|
+
components: {
|
|
18
|
+
app1: {
|
|
19
|
+
dir: "dir1",
|
|
20
|
+
build: {
|
|
21
|
+
type: "node"
|
|
22
|
+
},
|
|
23
|
+
deploy: {
|
|
24
|
+
type: "kubernetes",
|
|
25
|
+
cluster: cluster
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
app2: {
|
|
29
|
+
dir: "dir2",
|
|
30
|
+
build: {
|
|
31
|
+
type: "node"
|
|
32
|
+
},
|
|
33
|
+
deploy: {
|
|
34
|
+
type: "kubernetes",
|
|
35
|
+
cluster: cluster
|
|
36
|
+
},
|
|
37
|
+
env: {
|
|
38
|
+
dev2: {
|
|
39
|
+
type: "dev"
|
|
40
|
+
},
|
|
41
|
+
review2: {
|
|
42
|
+
type: "review"
|
|
43
|
+
},
|
|
44
|
+
stage2: {
|
|
45
|
+
type: "stage"
|
|
46
|
+
},
|
|
47
|
+
prod2: {
|
|
48
|
+
type: "prod"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
app3: {
|
|
53
|
+
dir: "dir2",
|
|
54
|
+
build: {
|
|
55
|
+
type: "node"
|
|
56
|
+
},
|
|
57
|
+
deploy: {
|
|
58
|
+
type: "kubernetes",
|
|
59
|
+
cluster: cluster
|
|
60
|
+
},
|
|
61
|
+
env: {
|
|
62
|
+
dev: false,
|
|
63
|
+
review: false,
|
|
64
|
+
stage: false,
|
|
65
|
+
prod: false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
it("should return all envs for SIMPLE_CONFIG1", function () {
|
|
71
|
+
expect((0, configruedEnvs_1.getAllEnvsInAllComponents)(SIMPLE_CONFIG1)).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
});
|
package/dist/constants.js
CHANGED
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
7
|
-
exports.PIPELINE_IMAGE_TAG = "v1-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "v1-149-0-99090751" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -16,7 +16,7 @@ var BUILD_ID = {
|
|
|
16
16
|
var CURRENT_VERSION = {
|
|
17
17
|
default: new BashExpression_1.BashExpression(
|
|
18
18
|
// because we do shallow fetch, we need to ask the origin
|
|
19
|
-
"$(tag=$(git ls-remote origin \"refs/tags/v*[0-9]\" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags
|
|
19
|
+
"$(tag=$(git ls-remote origin \"refs/tags/v*[0-9]\" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z \"$tag\" ] && echo \"0.0.0\" || echo \"$tag\")")
|
|
20
20
|
};
|
|
21
21
|
var getBuildInfoVariables = function (ctx) {
|
|
22
22
|
var pipelineType = ctx.pipelineType;
|
|
@@ -51,7 +51,7 @@ var gcloudSchedulerCmd = function (version) {
|
|
|
51
51
|
};
|
|
52
52
|
exports.gcloudSchedulerCmd = gcloudSchedulerCmd;
|
|
53
53
|
var setGoogleProjectNumberScript = function (deployConfig) {
|
|
54
|
-
return ["export GCLOUD_PROJECT_NUMBER=$(".concat((0, exports.gcloudCmd)(), " projects describe ").concat(deployConfig.projectId, " --format=\"value(projectNumber)\")"),
|
|
54
|
+
return ["export GCLOUD_PROJECT_NUMBER=$(".concat((0, exports.gcloudCmd)(), " projects describe ").concat(deployConfig.projectId, " --format=\"value(projectNumber)\")"), 'echo "GCLOUD_PROJECT_NUMBER: $GCLOUD_PROJECT_NUMBER"'];
|
|
55
55
|
};
|
|
56
56
|
exports.setGoogleProjectNumberScript = setGoogleProjectNumberScript;
|
|
57
57
|
var makeLabelString = function (obj) {
|
package/dist/deploy/sbom.js
CHANGED
|
@@ -10,10 +10,10 @@ var sbomDeactivated = function (context) {
|
|
|
10
10
|
};
|
|
11
11
|
exports.sbomDeactivated = sbomDeactivated;
|
|
12
12
|
var getDependencyTrackUploadScript = function (context) {
|
|
13
|
-
return (0, exports.sbomDeactivated)(context) ? [] : ["echo Uploading SBOM to Dependency Track", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" \"").concat(sbom_1.SBOM_FILE, "\" vex.json || true")];
|
|
13
|
+
return (0, exports.sbomDeactivated)(context) ? [] : ["echo 'Uploading SBOM to Dependency Track'", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" \"").concat(sbom_1.SBOM_FILE, "\" vex.json || true")];
|
|
14
14
|
};
|
|
15
15
|
exports.getDependencyTrackUploadScript = getDependencyTrackUploadScript;
|
|
16
16
|
var getDependencyTrackDeleteScript = function (context) {
|
|
17
|
-
return (0, exports.sbomDeactivated)(context) ? [] : ["echo Disabling component in Dependency Track", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" || true")];
|
|
17
|
+
return (0, exports.sbomDeactivated)(context) ? [] : ["echo 'Disabling component in Dependency Track'", "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" || true")];
|
|
18
18
|
};
|
|
19
19
|
exports.getDependencyTrackDeleteScript = getDependencyTrackDeleteScript;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var getPipelineStages_1 = require("../getPipelineStages");
|
|
7
|
+
describe("getPipelineStages()", function () {
|
|
8
|
+
var cluster = {
|
|
9
|
+
type: "gcloud",
|
|
10
|
+
name: "mega-cluster",
|
|
11
|
+
projectId: "super-google-project",
|
|
12
|
+
region: "ch-blabla"
|
|
13
|
+
};
|
|
14
|
+
var SIMPLE_CONFIG1 = {
|
|
15
|
+
appName: "my-app",
|
|
16
|
+
customerName: "pan",
|
|
17
|
+
components: {
|
|
18
|
+
app1: {
|
|
19
|
+
dir: "dir1",
|
|
20
|
+
build: {
|
|
21
|
+
type: "node"
|
|
22
|
+
},
|
|
23
|
+
deploy: {
|
|
24
|
+
type: "kubernetes",
|
|
25
|
+
cluster: cluster
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
app2: {
|
|
29
|
+
dir: "dir2",
|
|
30
|
+
build: {
|
|
31
|
+
type: "node"
|
|
32
|
+
},
|
|
33
|
+
deploy: {
|
|
34
|
+
type: "kubernetes",
|
|
35
|
+
cluster: cluster
|
|
36
|
+
},
|
|
37
|
+
env: {
|
|
38
|
+
dev2: {
|
|
39
|
+
type: "dev"
|
|
40
|
+
},
|
|
41
|
+
review2: {
|
|
42
|
+
type: "review"
|
|
43
|
+
},
|
|
44
|
+
stage2: {
|
|
45
|
+
type: "stage"
|
|
46
|
+
},
|
|
47
|
+
prod2: {
|
|
48
|
+
type: "prod"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
app3: {
|
|
53
|
+
dir: "dir2",
|
|
54
|
+
build: {
|
|
55
|
+
type: "node"
|
|
56
|
+
},
|
|
57
|
+
deploy: {
|
|
58
|
+
type: "kubernetes",
|
|
59
|
+
cluster: cluster
|
|
60
|
+
},
|
|
61
|
+
env: {
|
|
62
|
+
dev: false,
|
|
63
|
+
review: false,
|
|
64
|
+
stage: false,
|
|
65
|
+
prod: false
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
it("should return all envs for SIMPLE_CONFIG1", function () {
|
|
71
|
+
expect((0, getPipelineStages_1.getPipelineStages)(SIMPLE_CONFIG1)).toMatchSnapshot();
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Config } from "../types/config";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
this is just so that it looks nicer in gitlab and makes running mutliple manual tasks more easy to use
|
|
3
|
+
* while technically not required, we group different envs in its own stage
|
|
4
|
+
* each job from `createJobs` that is defined as `envMode: "stagePerEnv"` will have `deploy dev`, etc. instead of just `deploy`
|
|
5
|
+
* this is just so that it looks nicer in gitlab and makes running mutliple manual tasks more easy to use
|
|
7
6
|
*/
|
|
8
7
|
export declare function getPipelineStages(config: Config): string[];
|
|
@@ -38,13 +38,14 @@ exports.getPipelineStages = void 0;
|
|
|
38
38
|
var config_1 = require("../config");
|
|
39
39
|
var jobs_1 = require("../types/jobs");
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this is just so that it looks nicer in gitlab and makes running mutliple manual tasks more easy to use
|
|
41
|
+
* while technically not required, we group different envs in its own stage
|
|
42
|
+
* each job from `createJobs` that is defined as `envMode: "stagePerEnv"` will have `deploy dev`, etc. instead of just `deploy`
|
|
43
|
+
* this is just so that it looks nicer in gitlab and makes running mutliple manual tasks more easy to use
|
|
45
44
|
*/
|
|
46
45
|
function getPipelineStages(config) {
|
|
47
|
-
var allEnvs = (0, config_1.getAllEnvsInAllComponents)(config)
|
|
46
|
+
var allEnvs = (0, config_1.getAllEnvsInAllComponents)(config).filter(function (e) {
|
|
47
|
+
return e !== "local";
|
|
48
|
+
});
|
|
48
49
|
var stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
|
|
49
50
|
return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
|
|
50
51
|
return "".concat(baseStage, " ").concat(e);
|