@catladder/pipeline 1.94.2 โ†’ 1.96.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.
@@ -34,7 +34,8 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
34
34
  exports.__esModule = true;
35
35
  exports.createCustomJobs = void 0;
36
36
  var buildJob_1 = require("./buildJob");
37
+ var testJob_1 = require("./testJob");
37
38
  var createCustomJobs = function (context) {
38
- return __spreadArray([], __read((0, buildJob_1.createCustomBuildJobs)(context)), false);
39
+ return __spreadArray(__spreadArray([], __read((0, testJob_1.createCustomTestJobs)(context)), false), __read((0, buildJob_1.createCustomBuildJobs)(context)), false);
39
40
  };
40
41
  exports.createCustomJobs = createCustomJobs;
@@ -0,0 +1,3 @@
1
+ import type { Context } from "../../types/context";
2
+ import type { CatladderJob } from "../../types/jobs";
3
+ export declare const createCustomTestJobs: (context: Context) => CatladderJob[];
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __read = this && this.__read || function (o, n) {
14
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15
+ if (!m) return o;
16
+ var i = m.call(o),
17
+ r,
18
+ ar = [],
19
+ e;
20
+ try {
21
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
22
+ } catch (error) {
23
+ e = {
24
+ error: error
25
+ };
26
+ } finally {
27
+ try {
28
+ if (r && !r.done && (m = i["return"])) m.call(i);
29
+ } finally {
30
+ if (e) throw e.error;
31
+ }
32
+ }
33
+ return ar;
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
+ };
44
+ exports.__esModule = true;
45
+ exports.createCustomTestJobs = void 0;
46
+ var utils_1 = require("../../utils");
47
+ var types_1 = require("../types");
48
+ var RUNNER_CUSTOM_TEST_VARIABLES = {
49
+ KUBERNETES_CPU_REQUEST: "0.5",
50
+ KUBERNETES_CPU_LIMIT: "2",
51
+ KUBERNETES_MEMORY_REQUEST: "2Gi",
52
+ KUBERNETES_MEMORY_LIMIT: "4Gi"
53
+ };
54
+ var createCustomTestJobs = function (context) {
55
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
56
+ // don't run tests after release
57
+ if (((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.trigger) === "taggedRelease") {
58
+ return [];
59
+ }
60
+ var buildConfig = context.componentConfig.build;
61
+ if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
62
+ throw new Error("deploy config is not custom");
63
+ }
64
+ var base = {
65
+ variables: __assign(__assign({
66
+ APP_PATH: context.componentConfig.dir
67
+ }, RUNNER_CUSTOM_TEST_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
68
+ cache: buildConfig.jobCache,
69
+ stage: "test",
70
+ needs: [],
71
+ envMode: "none"
72
+ };
73
+ var auditJob = buildConfig.audit ? __assign(__assign({
74
+ name: "๐Ÿ›ก audit"
75
+ }, base), {
76
+ image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : buildConfig.jobImage,
77
+ cache: undefined,
78
+ script: __spreadArray([], __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : []), false),
79
+ allow_failure: true
80
+ }) : null;
81
+ var lintJob = buildConfig.lint ? __assign(__assign({
82
+ name: "๐Ÿ‘ฎ lint"
83
+ }, base), {
84
+ image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage,
85
+ script: __spreadArray([], __read((_k = (0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : []), false)
86
+ }) : null;
87
+ var testJob = buildConfig.test ? __assign(__assign({
88
+ name: "๐Ÿงช test"
89
+ }, base), {
90
+ image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : buildConfig.jobImage,
91
+ script: __spreadArray([], __read((_p = (0, utils_1.ensureArray)((_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.command)) !== null && _p !== void 0 ? _p : []), false)
92
+ }) : null;
93
+ return [auditJob, lintJob, testJob].filter(utils_1.notNil);
94
+ };
95
+ exports.createCustomTestJobs = createCustomTestJobs;
@@ -87,7 +87,7 @@ export declare type BuildConfigCustomDocker = BuildConfigBase["docker"] & ({
87
87
  */
88
88
  type: "custom";
89
89
  });
90
- export declare type BuildConfigCustom = BuildConfigBase & {
90
+ export declare type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit"> & {
91
91
  type: "custom";
92
92
  jobImage: string;
93
93
  jobServices?: GitlabJobService[];
@@ -96,6 +96,27 @@ export declare type BuildConfigCustom = BuildConfigBase & {
96
96
  * customize cache for the job
97
97
  */
98
98
  jobCache?: CatladderJob["cache"];
99
+ /**
100
+ * custom lint, disabled when not set
101
+ */
102
+ lint?: {
103
+ command?: string | string[];
104
+ jobImage?: GitlabJobImage;
105
+ };
106
+ /**
107
+ * custom test, disabled when not set
108
+ */
109
+ test?: {
110
+ command?: string | string[];
111
+ jobImage?: GitlabJobImage;
112
+ };
113
+ /**
114
+ * custom audit, disabled when not set
115
+ */
116
+ audit?: {
117
+ command?: string | string[];
118
+ jobImage?: GitlabJobImage;
119
+ };
99
120
  };
100
121
  export declare type BuildConfigRails = BuildConfigBase & {
101
122
  type: "rails";