@catladder/pipeline 1.57.1 → 1.58.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.
@@ -0,0 +1,3 @@
1
+ import type { Context } from "../../types/context";
2
+ import type { CatladderJob } from "../../types/jobs";
3
+ export declare const createCustomBuildJobs: (context: Context) => CatladderJob[];
@@ -0,0 +1,101 @@
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
+
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ var __read = this && this.__read || function (o, n) {
18
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
19
+ if (!m) return o;
20
+ var i = m.call(o),
21
+ r,
22
+ ar = [],
23
+ e;
24
+
25
+ try {
26
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27
+ } catch (error) {
28
+ e = {
29
+ error: error
30
+ };
31
+ } finally {
32
+ try {
33
+ if (r && !r.done && (m = i["return"])) m.call(i);
34
+ } finally {
35
+ if (e) throw e.error;
36
+ }
37
+ }
38
+
39
+ return ar;
40
+ };
41
+
42
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
+ if (ar || !(i in from)) {
45
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
46
+ ar[i] = from[i];
47
+ }
48
+ }
49
+ return to.concat(ar || Array.prototype.slice.call(from));
50
+ };
51
+
52
+ exports.__esModule = true;
53
+ exports.createCustomBuildJobs = void 0;
54
+
55
+ var path_1 = require("path");
56
+
57
+ var utils_1 = require("../../utils");
58
+
59
+ var constants_1 = require("../base/constants");
60
+
61
+ var createBuildJob_1 = require("../base/createBuildJob");
62
+
63
+ var docker_1 = require("../docker");
64
+
65
+ var types_1 = require("../types");
66
+
67
+ var RUNNER_BUILD_VARIABLES = {
68
+ KUBERNETES_CPU_REQUEST: "0.5",
69
+ KUBERNETES_CPU_LIMIT: "2",
70
+ KUBERNETES_MEMORY_REQUEST: "2Gi",
71
+ KUBERNETES_MEMORY_LIMIT: "4Gi"
72
+ };
73
+
74
+ var createCustomBuildJobs = function (context) {
75
+ var _a, _b, _c, _d;
76
+
77
+ var buildConfig = context.componentConfig.build;
78
+
79
+ if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
80
+ throw new Error("deploy config is not custom");
81
+ }
82
+
83
+ var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
84
+ image: buildConfig.jobImage,
85
+ variables: __assign({}, RUNNER_BUILD_VARIABLES),
86
+ script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
87
+ artifacts: {
88
+ paths: __spreadArray([(0, path_1.join)(context.componentConfig.dir, "__build_info.json"), (0, path_1.join)(context.componentConfig.dir, "dist")], __read((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
89
+ return (0, path_1.join)(context.componentConfig.dir, path);
90
+ })) !== null && _c !== void 0 ? _c : []), false)
91
+ }
92
+ }) : null;
93
+ return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), __read((0, docker_1.requiresDockerBuild)(context) ? [(0, docker_1.createDockerBuildJobDefault)(context, {
94
+ script: [((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : "exit 0" // should not happen
95
+ ],
96
+ variables: {},
97
+ needs: appBuildJob ? [constants_1.APP_BUILD_JOB_NAME] : []
98
+ })] : []), false);
99
+ };
100
+
101
+ exports.createCustomBuildJobs = createCustomBuildJobs;
@@ -0,0 +1,3 @@
1
+ import type { Context } from "../../types/context";
2
+ import type { CatladderJob } from "../../types/jobs";
3
+ export declare const createCustomJobs: (context: Context) => CatladderJob[];
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
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
+
11
+ try {
12
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
13
+ } catch (error) {
14
+ e = {
15
+ error: error
16
+ };
17
+ } finally {
18
+ try {
19
+ if (r && !r.done && (m = i["return"])) m.call(i);
20
+ } finally {
21
+ if (e) throw e.error;
22
+ }
23
+ }
24
+
25
+ return ar;
26
+ };
27
+
28
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
29
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
+ if (ar || !(i in from)) {
31
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
32
+ ar[i] = from[i];
33
+ }
34
+ }
35
+ return to.concat(ar || Array.prototype.slice.call(from));
36
+ };
37
+
38
+ exports.__esModule = true;
39
+ exports.createCustomJobs = void 0;
40
+
41
+ var buildJob_1 = require("./buildJob");
42
+
43
+ var createCustomJobs = function (context) {
44
+ return __spreadArray([], __read((0, buildJob_1.createCustomBuildJobs)(context)), false);
45
+ };
46
+
47
+ exports.createCustomJobs = createCustomJobs;
@@ -20,6 +20,8 @@ var __exportStar = this && this.__exportStar || function (m, exports) {
20
20
  exports.__esModule = true;
21
21
  exports.BUILD_TYPES = void 0;
22
22
 
23
+ var custom_1 = require("./custom");
24
+
23
25
  var node_1 = require("./node");
24
26
 
25
27
  __exportStar(require("./types"), exports);
@@ -59,5 +61,11 @@ exports.BUILD_TYPES = {
59
61
  startCommand: "node main.js"
60
62
  };
61
63
  }
64
+ },
65
+ custom: {
66
+ jobs: custom_1.createCustomJobs,
67
+ defaults: function () {
68
+ return {};
69
+ }
62
70
  }
63
71
  };
@@ -66,21 +66,30 @@ export declare type BuildConfigMeteor = BuildConfigNodeBase & {
66
66
 
67
67
  installScripts?: boolean;
68
68
  };
69
+ export declare type BuildConfigCustom = BuildConfigBase & {
70
+ type: "custom";
71
+ jobImage: string;
72
+ docker: BuildConfigBase["docker"] & {
73
+ type: "nginx";
74
+ };
75
+ };
69
76
  export declare type BuildConfigStorybook = BuildConfigNodeBase & {
70
77
  type: "storybook";
71
78
  startCommand?: never;
72
79
  };
73
- export declare type BuildConfig = BuildConfigNode | BuildConfigNodeStatic | BuildConfigStorybook | BuildConfigMeteor;
80
+ export declare type BuildConfig = BuildConfigNode | BuildConfigNodeStatic | BuildConfigStorybook | BuildConfigMeteor | BuildConfigCustom;
74
81
  export declare type BuildConfigType = BuildConfig["type"];
75
82
  export declare type BuildConfigGeneric<T extends BuildConfigType> = Extract<BuildConfig, {
76
83
  type: T;
77
84
  }>;
78
- export declare const isOfBuildType: <T extends ("node" | "node-static" | "meteor" | "storybook")[]>(t: BuildConfig, ...types: T) => t is Extract<BuildConfigNode, {
85
+ export declare const isOfBuildType: <T extends ("node" | "node-static" | "meteor" | "custom" | "storybook")[]>(t: BuildConfig, ...types: T) => t is Extract<BuildConfigNode, {
79
86
  type: T[number];
80
87
  }> | Extract<BuildConfigNodeStatic, {
81
88
  type: T[number];
82
89
  }> | Extract<BuildConfigMeteor, {
83
90
  type: T[number];
91
+ }> | Extract<BuildConfigCustom, {
92
+ type: T[number];
84
93
  }> | Extract<BuildConfigStorybook, {
85
94
  type: T[number];
86
95
  }>;