@catladder/pipeline 1.165.1 → 1.166.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/build/base/createAppBuildJob.d.ts +3 -1
- package/dist/build/base/createAppBuildJob.js +6 -4
- package/dist/build/base/createBuildJobDefinition.d.ts +7 -0
- package/dist/build/base/createBuildJobDefinition.js +58 -0
- package/dist/build/cache/createJobCache.d.ts +6 -0
- package/dist/build/cache/createJobCache.js +109 -0
- package/dist/build/cache/getAllCacheConfigsFromConfig.d.ts +3 -0
- package/dist/build/cache/getAllCacheConfigsFromConfig.js +66 -0
- package/dist/build/cache/transformLegacyJobCache.d.ts +3 -0
- package/dist/build/cache/transformLegacyJobCache.js +29 -0
- package/dist/build/custom/buildJob.js +2 -45
- package/dist/build/custom/testJob.d.ts +1 -1
- package/dist/build/custom/testJob.js +12 -11
- package/dist/build/docker.d.ts +4 -3
- package/dist/build/docker.js +5 -2
- package/dist/build/node/buildJob.js +5 -17
- package/dist/build/node/cache.d.ts +6 -6
- package/dist/build/node/cache.js +8 -9
- package/dist/build/node/meteor.js +2 -3
- package/dist/build/node/testJob.js +6 -5
- package/dist/build/node/yarn.js +1 -2
- package/dist/build/rails/test.js +3 -3
- package/dist/build/sbom.js +1 -1
- package/dist/build/types.d.ts +43 -4
- package/dist/bundles/catladder-gitlab/index.js +2 -2
- package/dist/constants.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/gitlab-types.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/jobDefinition.d.ts +5 -0
- package/dist/types/jobDefinition.js +5 -0
- package/dist/types/jobs.d.ts +3 -2
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +7 -2
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +817 -1717
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +0 -4
- package/examples/__snapshots__/custom-build-job.test.ts.snap +0 -4
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +0 -4
- package/examples/__snapshots__/native-app.test.ts.snap +24 -20
- package/examples/__snapshots__/workspace-api-www-custom-cache.test.ts.snap +2374 -0
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +2354 -0
- package/examples/cloud-run-with-sql.ts +1 -23
- package/examples/workspace-api-www-custom-cache.test.ts +11 -0
- package/examples/workspace-api-www-custom-cache.ts +51 -0
- package/examples/workspace-api-www.test.ts +11 -0
- package/examples/workspace-api-www.ts +45 -0
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +6 -4
- package/src/build/base/createBuildJobDefinition.ts +38 -0
- package/src/build/cache/createJobCache.ts +85 -0
- package/src/build/cache/getAllCacheConfigsFromConfig.ts +33 -0
- package/src/build/cache/transformLegacyJobCache.ts +14 -0
- package/src/build/custom/buildJob.ts +2 -14
- package/src/build/custom/testJob.ts +7 -6
- package/src/build/docker.ts +5 -3
- package/src/build/node/buildJob.ts +6 -29
- package/src/build/node/cache.ts +20 -21
- package/src/build/node/meteor.ts +7 -8
- package/src/build/node/testJob.ts +7 -6
- package/src/build/node/yarn.ts +1 -1
- package/src/build/rails/test.ts +4 -4
- package/src/build/sbom.ts +2 -2
- package/src/build/types.ts +54 -4
- package/src/types/gitlab-types.ts +2 -2
- package/src/types/index.ts +1 -0
- package/src/types/jobDefinition.ts +9 -0
- package/src/types/jobs.ts +5 -8
- package/src/utils/index.ts +4 -1
|
@@ -35,7 +35,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
35
35
|
value: true
|
|
36
36
|
});
|
|
37
37
|
exports.createMeteorBuildJobs = void 0;
|
|
38
|
-
var path_1 = require("path");
|
|
39
38
|
var runner_1 = require("../../runner");
|
|
40
39
|
var base_1 = require("../base");
|
|
41
40
|
var docker_1 = require("../docker");
|
|
@@ -44,9 +43,9 @@ var cache_1 = require("./cache");
|
|
|
44
43
|
var yarn_1 = require("./yarn");
|
|
45
44
|
var getMeteorCache = function (context) {
|
|
46
45
|
return [{
|
|
47
|
-
key:
|
|
46
|
+
key: "meteor-build-cache",
|
|
48
47
|
policy: "pull-push",
|
|
49
|
-
paths: [
|
|
48
|
+
paths: [".meteor/local/resolver-result-cache.json", ".meteor/local/plugin-cache", ".meteor/local/isopacks", ".meteor/local/bundler-cache/scanner"]
|
|
50
49
|
}];
|
|
51
50
|
};
|
|
52
51
|
var createMeteorBuildJobs = function (context) {
|
|
@@ -52,6 +52,7 @@ var createArtifactsConfig_1 = require("../base/createArtifactsConfig");
|
|
|
52
52
|
var cache_1 = require("./cache");
|
|
53
53
|
var constants_1 = require("./constants");
|
|
54
54
|
var yarn_1 = require("./yarn");
|
|
55
|
+
var createJobCache_1 = require("../cache/createJobCache");
|
|
55
56
|
var createNodeTestJobs = function (context) {
|
|
56
57
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
57
58
|
// don't run tests after release
|
|
@@ -80,7 +81,7 @@ var createNodeTestJobs = function (context) {
|
|
|
80
81
|
}, base), {
|
|
81
82
|
image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
|
|
82
83
|
cache: undefined,
|
|
83
|
-
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.
|
|
84
|
+
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
|
|
84
85
|
]), false),
|
|
85
86
|
allow_failure: true
|
|
86
87
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
|
|
@@ -88,15 +89,15 @@ var createNodeTestJobs = function (context) {
|
|
|
88
89
|
name: "👮 lint"
|
|
89
90
|
}, base), {
|
|
90
91
|
image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
|
|
91
|
-
cache: (0, cache_1.getNodeCache)(context),
|
|
92
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_l = (0, utils_1.
|
|
92
|
+
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
|
|
93
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["yarn lint"]), false)
|
|
93
94
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
|
|
94
95
|
var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
|
|
95
96
|
name: "🧪 test"
|
|
96
97
|
}, base), {
|
|
97
98
|
image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
98
|
-
cache: (0, cache_1.getNodeCache)(context),
|
|
99
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_s = (0, utils_1.
|
|
99
|
+
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
|
|
100
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn test"]), false)
|
|
100
101
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
|
|
101
102
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
102
103
|
};
|
package/dist/build/node/yarn.js
CHANGED
|
@@ -52,9 +52,8 @@ var ensureNodeVersion = function (context) {
|
|
|
52
52
|
};
|
|
53
53
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
54
54
|
var getYarnInstall = function (context, options) {
|
|
55
|
-
var _a;
|
|
56
55
|
var postInstall = context.type !== "workspace" && "postInstall" in context.build.config ? context.build.config.postInstall : null;
|
|
57
|
-
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((
|
|
56
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall)) : []), false);
|
|
58
57
|
};
|
|
59
58
|
exports.getYarnInstall = getYarnInstall;
|
|
60
59
|
var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
|
package/dist/build/rails/test.js
CHANGED
|
@@ -81,7 +81,7 @@ var createRailsTestJobs = function (context) {
|
|
|
81
81
|
}, base), {
|
|
82
82
|
cache: undefined,
|
|
83
83
|
image: (_d = (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
|
|
84
|
-
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_f = (0, utils_1.
|
|
84
|
+
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["gem install bundler-audit", "bundle audit check"]), false),
|
|
85
85
|
allow_failure: true
|
|
86
86
|
}) : null;
|
|
87
87
|
var lintJob = buildConfig.lint !== false ? __assign(__assign({
|
|
@@ -89,14 +89,14 @@ var createRailsTestJobs = function (context) {
|
|
|
89
89
|
}, base), {
|
|
90
90
|
cache: bundlerCache,
|
|
91
91
|
image: (_j = (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
|
|
92
|
-
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_l = (0, utils_1.
|
|
92
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["bundle exec rubocop"]), false)
|
|
93
93
|
}) : null;
|
|
94
94
|
var testJob = buildConfig.test !== false ? __assign(__assign({
|
|
95
95
|
name: "🧪 test"
|
|
96
96
|
}, base), {
|
|
97
97
|
cache: bundlerCache,
|
|
98
98
|
image: (_p = (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
|
|
99
|
-
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_r = (0, utils_1.
|
|
99
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["bundle exec rspec"]), false)
|
|
100
100
|
}) : null;
|
|
101
101
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
102
102
|
};
|
package/dist/build/sbom.js
CHANGED
|
@@ -14,7 +14,7 @@ var createSbomBuildJob = function (context) {
|
|
|
14
14
|
var defaultImage = "aquasec/trivy:0.38.3";
|
|
15
15
|
var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.packageManagerInfo.componentIsInWorkspace ? "." : context.build.dir)];
|
|
16
16
|
var image = (0, _1.isStandaloneBuildConfig)(buildConfig) && buildConfig.type === "custom" && buildConfig.sbom !== false ? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage : defaultImage;
|
|
17
|
-
var script = (0, _1.isStandaloneBuildConfig)(buildConfig) && buildConfig.type === "custom" && buildConfig.sbom !== false ? (_d = (0, utils_1.
|
|
17
|
+
var script = (0, _1.isStandaloneBuildConfig)(buildConfig) && buildConfig.type === "custom" && buildConfig.sbom !== false ? (_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript : defaultScript;
|
|
18
18
|
return {
|
|
19
19
|
name: exports.SBOM_BUILD_JOB_NAME,
|
|
20
20
|
stage: "build",
|
package/dist/build/types.d.ts
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import type { Artifacts, EnvVars, GitlabJobImage } from "../types";
|
|
2
2
|
import type { Services } from "../types/gitlab-ci-yml";
|
|
3
|
-
import type { CatladderJob } from "../types/jobs";
|
|
3
|
+
import type { CatladderJob, CatladderJobCache } from "../types/jobs";
|
|
4
|
+
export type CacheConfigAdvanced = Omit<CatladderJobCache, "paths" | "key"> & {
|
|
5
|
+
/**
|
|
6
|
+
* if you set a key, the cache is scoped to the key. Be aware that there is a limit in gitlab of 4 caches.
|
|
7
|
+
*
|
|
8
|
+
* see https://gitlab.com/gitlab-org/gitlab/-/issues/421962
|
|
9
|
+
*/
|
|
10
|
+
key: Required<CatladderJobCache>["key"];
|
|
11
|
+
/**
|
|
12
|
+
* whether the cache is scoped to the context (component or workspace) or the build directory.
|
|
13
|
+
*
|
|
14
|
+
* defaults to context
|
|
15
|
+
*/
|
|
16
|
+
scope?: "context" | "buildDir" | "global";
|
|
17
|
+
} & CacheConfigSimple;
|
|
18
|
+
export type CacheConfigSimple = {
|
|
19
|
+
/**
|
|
20
|
+
* paths to cache. All Paths are relative to the context dir.
|
|
21
|
+
*/
|
|
22
|
+
paths: string[];
|
|
23
|
+
/**
|
|
24
|
+
* whether paths are relative to the base dir. defaults to relative.
|
|
25
|
+
*/
|
|
26
|
+
pathMode?: "relative" | "absolute";
|
|
27
|
+
/**
|
|
28
|
+
* custom base dir
|
|
29
|
+
*/
|
|
30
|
+
baseDir?: string;
|
|
31
|
+
};
|
|
32
|
+
export type CacheConfig = CacheConfigSimple | CacheConfigAdvanced;
|
|
4
33
|
export type BuildConfigArtifactsReports = {
|
|
5
34
|
/**
|
|
6
35
|
* The junit report collects JUnit report format XML files.
|
|
@@ -10,6 +39,9 @@ export type BuildConfigArtifactsReports = {
|
|
|
10
39
|
*/
|
|
11
40
|
junit?: string[];
|
|
12
41
|
};
|
|
42
|
+
export type WithCacheConfig = {
|
|
43
|
+
cache?: CacheConfig | CacheConfig[];
|
|
44
|
+
};
|
|
13
45
|
export type TestJobCustom = {
|
|
14
46
|
command?: string | string[];
|
|
15
47
|
jobImage?: GitlabJobImage;
|
|
@@ -75,6 +107,8 @@ export type BuildConfigBase = {
|
|
|
75
107
|
artifactsReports?: BuildConfigArtifactsReports;
|
|
76
108
|
/**
|
|
77
109
|
* customize cache for the job
|
|
110
|
+
*
|
|
111
|
+
* @deprecated use cache
|
|
78
112
|
*/
|
|
79
113
|
jobCache?: CatladderJob["cache"];
|
|
80
114
|
/**
|
|
@@ -85,7 +119,7 @@ export type BuildConfigBase = {
|
|
|
85
119
|
* custom image to use
|
|
86
120
|
*/
|
|
87
121
|
jobImage?: GitlabJobImage;
|
|
88
|
-
};
|
|
122
|
+
} & WithCacheConfig;
|
|
89
123
|
export type BuildConfigNodeBase = BuildConfigBase & {
|
|
90
124
|
/**
|
|
91
125
|
* runs a command after yarn install. postinstall in package.json won't work for yarn plug and play.
|
|
@@ -239,7 +273,7 @@ export type BuildConfigFromWorkspace = {
|
|
|
239
273
|
* by default "dist" and ".next" are allways included
|
|
240
274
|
*/
|
|
241
275
|
artifactsPaths?: string[];
|
|
242
|
-
};
|
|
276
|
+
} & WithCacheConfig;
|
|
243
277
|
export type BuildConfigStandalone = BuildConfigNode | BuildConfigNodeStatic | BuildConfigStorybook | BuildConfigMeteor | BuildConfigCustom | BuildConfigRails;
|
|
244
278
|
export type BuildConfig = BuildConfigFromWorkspace | BuildConfigStandalone;
|
|
245
279
|
export type BuildConfigStandaloneType = BuildConfigStandalone["type"];
|
|
@@ -285,7 +319,12 @@ export type WorkspaceBuildConfigBase = {
|
|
|
285
319
|
* use to display information in merge requests, pipeline views and security dashboards.
|
|
286
320
|
*/
|
|
287
321
|
artifactsReports?: BuildConfigArtifactsReports;
|
|
288
|
-
|
|
322
|
+
jobImage?: GitlabJobImage;
|
|
323
|
+
/**
|
|
324
|
+
* tags for the underlying job runner (e.g gitlab)
|
|
325
|
+
*/
|
|
326
|
+
jobTags?: string[];
|
|
327
|
+
} & WithCacheConfig;
|
|
289
328
|
export type WorkspaceBuildConfigNode = {
|
|
290
329
|
type: "node";
|
|
291
330
|
buildCommand?: string | string[];
|