@catladder/pipeline 0.0.0-main-0fb24c4d → 0.0.0-main-e3289b9f

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.
@@ -28740,7 +28740,7 @@ exports.readConfigSync = readConfigSync;
28740
28740
 
28741
28741
  exports.__esModule = true;
28742
28742
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
28743
- exports.PIPELINE_IMAGE_TAG = "main-0fb24c4d" || 0;
28743
+ exports.PIPELINE_IMAGE_TAG = "main-e3289b9f" || 0;
28744
28744
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
28745
28745
 
28746
28746
  /***/ }),
@@ -30581,6 +30581,7 @@ var createArgsString_1 = __nccwpck_require__(947);
30581
30581
  var jobName_1 = __nccwpck_require__(9357);
30582
30582
  var common_1 = __nccwpck_require__(5113);
30583
30583
  var getLabels_1 = __nccwpck_require__(2101);
30584
+ var volumes_1 = __nccwpck_require__(2118);
30584
30585
  var getJobRunScriptForJob = function (context, jobName, wait) {
30585
30586
  var commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
30586
30587
  var commonArgsString = (0, createArgsString_1.createArgsString)(commonArgs);
@@ -30635,6 +30636,8 @@ var getJobCreateScripts = function (context) {
30635
30636
  exports.getJobCreateScripts = getJobCreateScripts;
30636
30637
  var getJobCreateScriptsForJob = function (context, jobName, job) {
30637
30638
  var commonDeployArgs = (0, common_1.getCommonDeployArgs)(context);
30639
+ // due to some oversight from google, jobs create does not yet accept `--add-volume` 🤦
30640
+ // lucky, update on the other hand accepts it... so let's just imediatly update it
30638
30641
  // we cannot upsert a job, so we have to create it and catch the error and then update
30639
30642
  var commandArray = Array.isArray(job.command) ? job.command : job.command.split(" ");
30640
30643
  var commonDeployArgsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
@@ -30650,8 +30653,9 @@ var getJobCreateScriptsForJob = function (context, jobName, job) {
30650
30653
  "env-vars-file": "____envvars.yaml",
30651
30654
  "max-retries": 0
30652
30655
  }));
30656
+ var requiresBeta = (job === null || job === void 0 ? void 0 : job.volumes) && Object.keys(job === null || job === void 0 ? void 0 : job.volumes).length > 0;
30653
30657
  var argsString = "".concat(jobName, " ").concat(commonDeployArgsString);
30654
- return __spreadArray(__spreadArray([], __read((0, gitlab_1.allowFailureInScripts)(["".concat((0, common_1.gcloudRunCmd)(), " jobs create ").concat(argsString)])), false), ["".concat((0, common_1.gcloudRunCmd)(), " jobs update ").concat(argsString)], false);
30658
+ return __spreadArray(__spreadArray([], __read((0, gitlab_1.allowFailureInScripts)(["".concat((0, common_1.gcloudRunCmd)(), " jobs create ").concat(argsString)])), false), ["".concat((0, common_1.gcloudRunCmd)(requiresBeta ? "beta" : undefined), " jobs update ").concat(argsString, " ").concat(createArgsString_1.createArgsString.apply(void 0, __spreadArray([], __read((0, volumes_1.createVolumeConfig)(job === null || job === void 0 ? void 0 : job.volumes, "job")), false)))], false);
30655
30659
  };
30656
30660
  var getCreateScheduleScripts = function (context) {
30657
30661
  var jobsWithSchedule = getCloudRunJobsWithSchedule(context);
@@ -30729,12 +30733,44 @@ var __assign = this && this.__assign || function () {
30729
30733
  };
30730
30734
  return __assign.apply(this, arguments);
30731
30735
  };
30736
+ var __read = this && this.__read || function (o, n) {
30737
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
30738
+ if (!m) return o;
30739
+ var i = m.call(o),
30740
+ r,
30741
+ ar = [],
30742
+ e;
30743
+ try {
30744
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
30745
+ } catch (error) {
30746
+ e = {
30747
+ error: error
30748
+ };
30749
+ } finally {
30750
+ try {
30751
+ if (r && !r.done && (m = i["return"])) m.call(i);
30752
+ } finally {
30753
+ if (e) throw e.error;
30754
+ }
30755
+ }
30756
+ return ar;
30757
+ };
30758
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
30759
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30760
+ if (ar || !(i in from)) {
30761
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
30762
+ ar[i] = from[i];
30763
+ }
30764
+ }
30765
+ return to.concat(ar || Array.prototype.slice.call(from));
30766
+ };
30732
30767
  exports.__esModule = true;
30733
30768
  exports.getServiceDeleteScript = exports.getServiceDeployScript = void 0;
30734
30769
  var getLabels_1 = __nccwpck_require__(2101);
30735
30770
  var createArgsString_1 = __nccwpck_require__(947);
30736
30771
  var getServiceName_1 = __nccwpck_require__(5044);
30737
30772
  var common_1 = __nccwpck_require__(5113);
30773
+ var volumes_1 = __nccwpck_require__(2118);
30738
30774
  var getServiceDeployScript = function (context, service, nameSuffix) {
30739
30775
  var _a, _b, _c, _d, _e;
30740
30776
  var commonDeployArgs = (0, common_1.getCommonDeployArgs)(context);
@@ -30743,7 +30779,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
30743
30779
  var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
30744
30780
  var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
30745
30781
  var fullServiceName = "".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "");
30746
- var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
30782
+ var argsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
30747
30783
  // command as empty string resets it to default (uses the image's entrypoint)
30748
30784
  command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
30749
30785
  }, commonDeployArgs), {
@@ -30759,8 +30795,10 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
30759
30795
  ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
30760
30796
  "cpu-boost": true,
30761
30797
  "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment
30762
- }));
30763
- return "".concat((0, common_1.gcloudRunCmd)(), " deploy ").concat(fullServiceName, " ").concat(argsString);
30798
+ })], __read((0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service")), false));
30799
+ // volumes require beta
30800
+ var requiresBeta = (customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes) && Object.keys(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes).length > 0;
30801
+ return "".concat((0, common_1.gcloudRunCmd)(requiresBeta ? "beta" : undefined), " deploy ").concat(fullServiceName, " ").concat(argsString);
30764
30802
  };
30765
30803
  exports.getServiceDeployScript = getServiceDeployScript;
30766
30804
  var getServiceDeleteScript = function (context, serviceSuffix) {
@@ -31069,6 +31107,69 @@ exports.getDeployJobVariables = getDeployJobVariables;
31069
31107
 
31070
31108
  /***/ }),
31071
31109
 
31110
+ /***/ 2118:
31111
+ /***/ (function(__unused_webpack_module, exports) {
31112
+
31113
+ "use strict";
31114
+
31115
+
31116
+ var __read = this && this.__read || function (o, n) {
31117
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
31118
+ if (!m) return o;
31119
+ var i = m.call(o),
31120
+ r,
31121
+ ar = [],
31122
+ e;
31123
+ try {
31124
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
31125
+ } catch (error) {
31126
+ e = {
31127
+ error: error
31128
+ };
31129
+ } finally {
31130
+ try {
31131
+ if (r && !r.done && (m = i["return"])) m.call(i);
31132
+ } finally {
31133
+ if (e) throw e.error;
31134
+ }
31135
+ }
31136
+ return ar;
31137
+ };
31138
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
31139
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31140
+ if (ar || !(i in from)) {
31141
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
31142
+ ar[i] = from[i];
31143
+ }
31144
+ }
31145
+ return to.concat(ar || Array.prototype.slice.call(from));
31146
+ };
31147
+ exports.__esModule = true;
31148
+ exports.createVolumeConfig = void 0;
31149
+ var createVolumeConfig = function (volumes, type) {
31150
+ if (!volumes) {
31151
+ return [];
31152
+ }
31153
+ return __spreadArray(__spreadArray([], __read(Object.entries(volumes).map(function (_a) {
31154
+ var _b = __read(_a, 2),
31155
+ volumeName = _b[0],
31156
+ _c = _b[1],
31157
+ type = _c.type,
31158
+ bucket = _c.bucket,
31159
+ mountPath = _c.mountPath,
31160
+ readonly = _c.readonly;
31161
+ return {
31162
+ "add-volume": "name=".concat(volumeName, ",type=").concat(type, ",bucket=").concat(bucket).concat(readonly ? ",readonly=true" : ""),
31163
+ "add-volume-mount": "volume=".concat(volumeName, ",mount-path=").concat(mountPath)
31164
+ };
31165
+ })), false), [type === "service" ? {
31166
+ "execution-environment": "gen2"
31167
+ } : {}], false);
31168
+ };
31169
+ exports.createVolumeConfig = createVolumeConfig;
31170
+
31171
+ /***/ }),
31172
+
31072
31173
  /***/ 8718:
31073
31174
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
31074
31175
 
package/dist/constants.js CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
5
- exports.PIPELINE_IMAGE_TAG = "main-0fb24c4d" || "";
5
+ exports.PIPELINE_IMAGE_TAG = "main-e3289b9f" || "";
6
6
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
@@ -48,6 +48,7 @@ var createArgsString_1 = require("../utils/createArgsString");
48
48
  var jobName_1 = require("../utils/jobName");
49
49
  var common_1 = require("./common");
50
50
  var getLabels_1 = require("../../../context/getLabels");
51
+ var volumes_1 = require("./volumes");
51
52
  var getJobRunScriptForJob = function (context, jobName, wait) {
52
53
  var commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
53
54
  var commonArgsString = (0, createArgsString_1.createArgsString)(commonArgs);
@@ -102,6 +103,8 @@ var getJobCreateScripts = function (context) {
102
103
  exports.getJobCreateScripts = getJobCreateScripts;
103
104
  var getJobCreateScriptsForJob = function (context, jobName, job) {
104
105
  var commonDeployArgs = (0, common_1.getCommonDeployArgs)(context);
106
+ // due to some oversight from google, jobs create does not yet accept `--add-volume` 🤦
107
+ // lucky, update on the other hand accepts it... so let's just imediatly update it
105
108
  // we cannot upsert a job, so we have to create it and catch the error and then update
106
109
  var commandArray = Array.isArray(job.command) ? job.command : job.command.split(" ");
107
110
  var commonDeployArgsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
@@ -117,8 +120,9 @@ var getJobCreateScriptsForJob = function (context, jobName, job) {
117
120
  "env-vars-file": "____envvars.yaml",
118
121
  "max-retries": 0
119
122
  }));
123
+ var requiresBeta = (job === null || job === void 0 ? void 0 : job.volumes) && Object.keys(job === null || job === void 0 ? void 0 : job.volumes).length > 0;
120
124
  var argsString = "".concat(jobName, " ").concat(commonDeployArgsString);
121
- return __spreadArray(__spreadArray([], __read((0, gitlab_1.allowFailureInScripts)(["".concat((0, common_1.gcloudRunCmd)(), " jobs create ").concat(argsString)])), false), ["".concat((0, common_1.gcloudRunCmd)(), " jobs update ").concat(argsString)], false);
125
+ return __spreadArray(__spreadArray([], __read((0, gitlab_1.allowFailureInScripts)(["".concat((0, common_1.gcloudRunCmd)(), " jobs create ").concat(argsString)])), false), ["".concat((0, common_1.gcloudRunCmd)(requiresBeta ? "beta" : undefined), " jobs update ").concat(argsString, " ").concat(createArgsString_1.createArgsString.apply(void 0, __spreadArray([], __read((0, volumes_1.createVolumeConfig)(job === null || job === void 0 ? void 0 : job.volumes, "job")), false)))], false);
122
126
  };
123
127
  var getCreateScheduleScripts = function (context) {
124
128
  var jobsWithSchedule = getCloudRunJobsWithSchedule(context);
@@ -10,12 +10,44 @@ var __assign = this && this.__assign || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
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
+ };
13
44
  exports.__esModule = true;
14
45
  exports.getServiceDeleteScript = exports.getServiceDeployScript = void 0;
15
46
  var getLabels_1 = require("../../../context/getLabels");
16
47
  var createArgsString_1 = require("../utils/createArgsString");
17
48
  var getServiceName_1 = require("../utils/getServiceName");
18
49
  var common_1 = require("./common");
50
+ var volumes_1 = require("./volumes");
19
51
  var getServiceDeployScript = function (context, service, nameSuffix) {
20
52
  var _a, _b, _c, _d, _e;
21
53
  var commonDeployArgs = (0, common_1.getCommonDeployArgs)(context);
@@ -24,7 +56,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
24
56
  var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
25
57
  var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
26
58
  var fullServiceName = "".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "");
27
- var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
59
+ var argsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
28
60
  // command as empty string resets it to default (uses the image's entrypoint)
29
61
  command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
30
62
  }, commonDeployArgs), {
@@ -40,8 +72,10 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
40
72
  ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
41
73
  "cpu-boost": true,
42
74
  "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment
43
- }));
44
- return "".concat((0, common_1.gcloudRunCmd)(), " deploy ").concat(fullServiceName, " ").concat(argsString);
75
+ })], __read((0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service")), false));
76
+ // volumes require beta
77
+ var requiresBeta = (customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes) && Object.keys(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes).length > 0;
78
+ return "".concat((0, common_1.gcloudRunCmd)(requiresBeta ? "beta" : undefined), " deploy ").concat(fullServiceName, " ").concat(argsString);
45
79
  };
46
80
  exports.getServiceDeployScript = getServiceDeployScript;
47
81
  var getServiceDeleteScript = function (context, serviceSuffix) {
@@ -0,0 +1,3 @@
1
+ import type { DeployConfigCloudRunVolumes } from "../../types";
2
+ import type { keyValuesArg } from "../utils/createArgsString";
3
+ export declare const createVolumeConfig: (volumes: DeployConfigCloudRunVolumes | undefined, type: "service" | "job") => keyValuesArg[];
@@ -0,0 +1,56 @@
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
+ 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;
21
+ }
22
+ }
23
+ return ar;
24
+ };
25
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
26
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
27
+ if (ar || !(i in from)) {
28
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
29
+ ar[i] = from[i];
30
+ }
31
+ }
32
+ return to.concat(ar || Array.prototype.slice.call(from));
33
+ };
34
+ exports.__esModule = true;
35
+ exports.createVolumeConfig = void 0;
36
+ var createVolumeConfig = function (volumes, type) {
37
+ if (!volumes) {
38
+ return [];
39
+ }
40
+ return __spreadArray(__spreadArray([], __read(Object.entries(volumes).map(function (_a) {
41
+ var _b = __read(_a, 2),
42
+ volumeName = _b[0],
43
+ _c = _b[1],
44
+ type = _c.type,
45
+ bucket = _c.bucket,
46
+ mountPath = _c.mountPath,
47
+ readonly = _c.readonly;
48
+ return {
49
+ "add-volume": "name=".concat(volumeName, ",type=").concat(type, ",bucket=").concat(bucket).concat(readonly ? ",readonly=true" : ""),
50
+ "add-volume-mount": "volume=".concat(volumeName, ",mount-path=").concat(mountPath)
51
+ };
52
+ })), false), [type === "service" ? {
53
+ "execution-environment": "gen2"
54
+ } : {}], false);
55
+ };
56
+ exports.createVolumeConfig = createVolumeConfig;
@@ -9,5 +9,4 @@
9
9
  * @returns
10
10
  */
11
11
  export declare const createArgsString: (...args: keyValuesArg[]) => string;
12
- declare type keyValuesArg = Record<string, string | number | true | false | undefined>;
13
- export {};
12
+ export declare type keyValuesArg = Record<string, string | number | true | false | undefined>;
@@ -79,7 +79,7 @@ export declare type DeployConfigCloudRunService = {
79
79
  * defaults to gen1 according to gcloud
80
80
  */
81
81
  executionEnvironment?: "gen2" | "gen1";
82
- };
82
+ } & DeployConfigCloudRunWithVolumes;
83
83
  export declare type DeployConfigCloudRunJobBase = {
84
84
  /**
85
85
  * command
@@ -103,7 +103,7 @@ export declare type DeployConfigCloudRunJobBase = {
103
103
  * number of tasks that may run concurrently, defaults to 1
104
104
  */
105
105
  parallelism?: number;
106
- };
106
+ } & DeployConfigCloudRunWithVolumes;
107
107
  declare type Minute = string;
108
108
  declare type Hour = string;
109
109
  declare type DayOfMonth = string;
@@ -123,6 +123,13 @@ export declare type DeployConfigCloudRunJobWithSchedule = DeployConfigCloudRunJo
123
123
  export declare type DeployConfigCloudRunJobNormal = DeployConfigCloudRunJobBase & {
124
124
  when: "manual" | "preDeploy" | "postDeploy" | "preStop" | "postStop";
125
125
  };
126
+ export declare type DeployConfigCloudRunWithVolumes = {
127
+ /**
128
+ * adds volumes to the service. This is an experimental feature and requires beta gcloud.
129
+ * sets executionEnvironment to gen2 automatically, since that is required
130
+ */
131
+ volumes?: DeployConfigCloudRunVolumes;
132
+ };
126
133
  export declare type DeployConfigCloudRunJob = DeployConfigCloudRunJobNormal | DeployConfigCloudRunJobWithSchedule;
127
134
  export declare type DeployConfigCloudRun = {
128
135
  /**
@@ -159,4 +166,11 @@ export declare type DeployConfigCloudRun = {
159
166
  */
160
167
  cloudSql?: DeployConfigCloudRunCloudSql | false;
161
168
  } & DeployConfigBase;
169
+ export declare type DeployConfigCloudRunVolumes = Record<string, DeployConfigCloudRunVolume>;
170
+ export declare type DeployConfigCloudRunVolume = {
171
+ type: "cloud-storage";
172
+ bucket: string;
173
+ mountPath: string;
174
+ readonly?: boolean;
175
+ };
162
176
  export {};