@catladder/pipeline 0.0.0-refactor-gcloud-api-5bd4bbed → 0.0.0-refactor-gitlab-jobs-9e285eaf
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 -0
- package/dist/build/index.js +7 -1
- package/dist/build/rails/build.js +41 -16
- package/dist/build/rails/index.d.ts +2 -2
- package/dist/build/types.d.ts +36 -4
- package/dist/bundles/catladder-gitlab/index.js +512 -205
- package/dist/constants.js +1 -1
- package/dist/context/__tests__/resolveReferences.test.js +15 -20
- package/dist/context/getEnvironment.js +1 -0
- package/dist/context/getEnvironmentContext.js +5 -3
- package/dist/context/getEnvironmentVariables.js +2 -2
- package/dist/context/resolveReferences.d.ts +1 -1
- package/dist/context/resolveReferences.js +3 -1
- package/dist/deploy/base.js +1 -1
- package/dist/deploy/cloudRun/deployJob.js +9 -7
- package/dist/deploy/cloudRun/index.js +7 -6
- package/dist/deploy/cloudRun/utils/createArgsString.d.ts +1 -1
- package/dist/deploy/cloudRun/utils/createArgsString.js +6 -1
- package/dist/deploy/kubernetes/deployJob.js +4 -4
- package/dist/deploy/kubernetes/kubeValues.d.ts +3 -0
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +3 -0
- package/dist/deploy/types/custom.d.ts +2 -1
- package/dist/deploy/types/googleCloudRun.d.ts +11 -2
- package/dist/deploy/types/kubernetes.d.ts +11 -0
- package/dist/pipeline/createAllJobs.d.ts +8 -0
- package/dist/pipeline/createAllJobs.js +164 -0
- package/dist/pipeline/createChildPipeline.js +24 -48
- package/dist/pipeline/createJobsForComponent.d.ts +3 -0
- package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +8 -105
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
- package/dist/pipeline/gitlab/createGitlabJobs.js +256 -0
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/context.d.ts +1 -0
- package/dist/types/environmentContext.d.ts +7 -0
- package/dist/types/gitlab-types.d.ts +25 -1
- package/dist/types/jobs.d.ts +9 -2
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +1572 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +1572 -0
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +48 -48
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3116 -0
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +108 -108
- package/examples/__snapshots__/custom-build-job.ts.snap +48 -48
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +24 -24
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
- package/examples/cloud-run-memory-limit.ts +28 -0
- package/examples/cloud-run-no-cpu-throttling.ts +33 -0
- package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
- package/examples/cloud-run-with-sql.ts +1 -1
- package/examples/rails-k8s-with-worker.ts +95 -0
- package/package.json +1 -1
- package/src/build/custom/buildJob.ts +1 -0
- package/src/build/index.ts +7 -1
- package/src/build/rails/build.ts +17 -10
- package/src/build/rails/index.ts +2 -2
- package/src/build/types.ts +40 -5
- package/src/context/__tests__/resolveReferences.test.ts +15 -30
- package/src/context/getEnvironment.ts +1 -0
- package/src/context/getEnvironmentContext.ts +6 -6
- package/src/context/getEnvironmentVariables.ts +7 -5
- package/src/context/resolveReferences.ts +3 -6
- package/src/deploy/base.ts +1 -1
- package/src/deploy/cloudRun/deployJob.ts +9 -11
- package/src/deploy/cloudRun/index.ts +5 -4
- package/src/deploy/cloudRun/utils/createArgsString.ts +9 -2
- package/src/deploy/kubernetes/deployJob.ts +1 -1
- package/src/deploy/types/custom.ts +2 -1
- package/src/deploy/types/googleCloudRun.ts +14 -2
- package/src/deploy/types/kubernetes.ts +12 -0
- package/src/pipeline/createAllJobs.ts +38 -0
- package/src/pipeline/createChildPipeline.ts +6 -22
- package/src/pipeline/createJobsForComponent.ts +64 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +147 -0
- package/src/pipeline/index.ts +1 -1
- package/src/types/context.ts +1 -0
- package/src/types/environmentContext.ts +7 -0
- package/src/types/gitlab-types.ts +18 -1
- package/src/types/jobs.ts +11 -2
- package/dist/pipeline/createJobs.d.ts +0 -3
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -10
- package/dist/pipeline/gitlab/makeGitlabJob.js +0 -44
- package/src/pipeline/createJobs.ts +0 -199
- package/src/pipeline/gitlab/makeGitlabJob.ts +0 -23
|
@@ -64,6 +64,7 @@ var createCustomBuildJobs = function (context) {
|
|
|
64
64
|
var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
|
|
65
65
|
image: buildConfig.jobImage,
|
|
66
66
|
variables: __assign({}, RUNNER_BUILD_VARIABLES),
|
|
67
|
+
cache: buildConfig.jobCache,
|
|
67
68
|
services: buildConfig.jobServices,
|
|
68
69
|
script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
|
|
69
70
|
artifacts: {
|
package/dist/build/index.js
CHANGED
|
@@ -65,7 +65,13 @@ exports.BUILD_TYPES = {
|
|
|
65
65
|
rails: {
|
|
66
66
|
jobs: rails_1.createRailsJobs,
|
|
67
67
|
defaults: function () {
|
|
68
|
-
return {
|
|
68
|
+
return {
|
|
69
|
+
startCommand: "/cnb/process/web",
|
|
70
|
+
cnbBuilder: {
|
|
71
|
+
image: "heroku/buildpacks:20",
|
|
72
|
+
packVersion: "0.28.0"
|
|
73
|
+
}
|
|
74
|
+
};
|
|
69
75
|
}
|
|
70
76
|
}
|
|
71
77
|
};
|
|
@@ -1,30 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
var __read = this && this.__read || function (o, n) {
|
|
4
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
5
|
+
if (!m) return o;
|
|
6
|
+
var i = m.call(o),
|
|
7
|
+
r,
|
|
8
|
+
ar = [],
|
|
9
|
+
e;
|
|
10
|
+
try {
|
|
11
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
e = {
|
|
14
|
+
error: error
|
|
15
|
+
};
|
|
16
|
+
} finally {
|
|
17
|
+
try {
|
|
18
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
19
|
+
} finally {
|
|
20
|
+
if (e) throw e.error;
|
|
8
21
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
22
|
+
}
|
|
23
|
+
return ar;
|
|
12
24
|
};
|
|
13
25
|
exports.__esModule = true;
|
|
14
26
|
exports.createRailsBuildJobs = void 0;
|
|
27
|
+
var types_1 = require("../types");
|
|
15
28
|
var docker_1 = require("../docker");
|
|
16
29
|
var createRailsBuildJobs = function (context) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f;
|
|
31
|
+
var buildConfig = context.componentConfig.build;
|
|
32
|
+
if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
|
|
33
|
+
// should not happen
|
|
34
|
+
throw new Error("build type is not rails");
|
|
35
|
+
}
|
|
36
|
+
var cnbConf = buildConfig.cnbBuilder;
|
|
37
|
+
// backwards compatabilty with CNB_ENV_VARS
|
|
38
|
+
// TODO: remove when all projects are migrated
|
|
39
|
+
var packEnvArgs = (_c = (_b = (_a = buildConfig.extraVars) === null || _a === void 0 ? void 0 : _a.CNB_ENV_VARS) === null || _b === void 0 ? void 0 : _b.split(" ").map(function (v) {
|
|
40
|
+
return "--env '".concat(v, "'");
|
|
41
|
+
})) !== null && _c !== void 0 ? _c : Object.entries((_d = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
|
|
42
|
+
var _b = __read(_a, 2),
|
|
43
|
+
k = _b[0],
|
|
44
|
+
v = _b[1];
|
|
45
|
+
return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
|
|
46
|
+
});
|
|
17
47
|
return [(0, docker_1.createDockerBuildJobBase)(context, {
|
|
18
|
-
variables:
|
|
19
|
-
CNB_BUILDER: "heroku/buildpacks:18",
|
|
20
|
-
CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
|
|
21
|
-
CNB_EXTRA_ARGS: "",
|
|
22
|
-
CNB_PACK_VERSION: "0.20.0"
|
|
23
|
-
}, context.componentConfig.build.extraVars),
|
|
48
|
+
variables: context.componentConfig.build.extraVars,
|
|
24
49
|
// custom script
|
|
25
|
-
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v
|
|
50
|
+
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",
|
|
26
51
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
27
|
-
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "
|
|
52
|
+
"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.join(" "), " ").concat((_f = (_e = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _e === void 0 ? void 0 : _e.join(" ")) !== null && _f !== void 0 ? _f : "")]
|
|
28
53
|
})];
|
|
29
54
|
};
|
|
30
55
|
exports.createRailsBuildJobs = createRailsBuildJobs;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Context } from "../../types";
|
|
2
|
-
import { CatladderJob } from "../../types/jobs";
|
|
1
|
+
import type { Context } from "../../types";
|
|
2
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
export declare const createRailsJobs: (context: Context) => CatladderJob[];
|
package/dist/build/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { GitlabJobService } from "../types";
|
|
1
|
+
import type { GitlabJobImage, GitlabJobService } from "../types";
|
|
2
|
+
import type { CatladderJob } from "../types/jobs";
|
|
2
3
|
export declare type BuildConfigBase = {
|
|
3
4
|
/**
|
|
4
5
|
* command to run on the image to start the app (e.g. yarn start)
|
|
@@ -24,21 +25,21 @@ export declare type BuildConfigBase = {
|
|
|
24
25
|
*/
|
|
25
26
|
lint?: false | {
|
|
26
27
|
command?: string | string[];
|
|
27
|
-
jobImage?:
|
|
28
|
+
jobImage?: GitlabJobImage;
|
|
28
29
|
};
|
|
29
30
|
/**
|
|
30
31
|
* customize test, set false to disable
|
|
31
32
|
*/
|
|
32
33
|
test?: false | {
|
|
33
34
|
command?: string | string[];
|
|
34
|
-
jobImage?:
|
|
35
|
+
jobImage?: GitlabJobImage;
|
|
35
36
|
};
|
|
36
37
|
/**
|
|
37
38
|
* customize audit, set false to disable
|
|
38
39
|
*/
|
|
39
40
|
audit?: false | {
|
|
40
41
|
command?: string | string[];
|
|
41
|
-
jobImage?:
|
|
42
|
+
jobImage?: GitlabJobImage;
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
44
45
|
* additional paths for artifacts,
|
|
@@ -91,9 +92,40 @@ export declare type BuildConfigCustom = BuildConfigBase & {
|
|
|
91
92
|
jobImage: string;
|
|
92
93
|
jobServices?: GitlabJobService[];
|
|
93
94
|
docker: BuildConfigCustomDocker;
|
|
95
|
+
/**
|
|
96
|
+
* customize cache for the job
|
|
97
|
+
*/
|
|
98
|
+
jobCache?: CatladderJob["cache"];
|
|
94
99
|
};
|
|
95
100
|
export declare type BuildConfigRails = BuildConfigBase & {
|
|
96
101
|
type: "rails";
|
|
102
|
+
cnbBuilder?: {
|
|
103
|
+
/**
|
|
104
|
+
* The Cloud Native Buildpacks builder image to use.
|
|
105
|
+
* See e.g. https://github.com/heroku/builder or others.
|
|
106
|
+
* Default: heroku/buildpacks:20
|
|
107
|
+
*/
|
|
108
|
+
image?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The version of the Cloud Native Buildpacks pack command to use.
|
|
111
|
+
* See https://buildpacks.io/docs/tools/pack/
|
|
112
|
+
* Default: 0.28.0
|
|
113
|
+
*/
|
|
114
|
+
packVersion?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Additional command arguments passed to the pack command.
|
|
117
|
+
* See https://buildpacks.io/docs/tools/pack/
|
|
118
|
+
*/
|
|
119
|
+
packExtraArgs?: string[];
|
|
120
|
+
/**
|
|
121
|
+
* Variables needed for Bundler and Rails asset precompilation.
|
|
122
|
+
*
|
|
123
|
+
* Specify a key with the value `undefined` to inherit it from the EnvVars.
|
|
124
|
+
*
|
|
125
|
+
* See https://github.com/rails/rails/issues/32947
|
|
126
|
+
*/
|
|
127
|
+
buildVars?: Record<string, string | undefined>;
|
|
128
|
+
};
|
|
97
129
|
};
|
|
98
130
|
export declare type BuildConfigStorybook = BuildConfigNodeBase & {
|
|
99
131
|
type: "storybook";
|