@catladder/cli 0.0.0-main-ee41ef85 → 0.0.0-main-7219b03f

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.
@@ -3980,6 +3980,7 @@ const getJobOrServiceArgs_1 = __nccwpck_require__(1741);
3980
3980
  const getServiceName_1 = __nccwpck_require__(8128);
3981
3981
  const common_1 = __nccwpck_require__(3325);
3982
3982
  const constants_1 = __nccwpck_require__(8865);
3983
+ const healthCheck_1 = __nccwpck_require__(193);
3983
3984
  const volumes_1 = __nccwpck_require__(847);
3984
3985
  const getServiceDeployScript = (context, service, nameSuffix) => {
3985
3986
  var _a, _b, _c, _d, _e, _f;
@@ -4025,6 +4026,7 @@ const getServiceDeployScript = (context, service, nameSuffix) => {
4025
4026
  "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment,
4026
4027
  gpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpu,
4027
4028
  "gpu-type": customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpuType,
4029
+ ...(0, healthCheck_1.healthCheckCliArgs)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.healthCheck),
4028
4030
  }, ...(0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service"));
4029
4031
  const version = requiresBeta(customConfig) ? "beta" : undefined;
4030
4032
  return `${(0, common_1.gcloudRunCmd)(version)} deploy ${fullServiceName} ${argsString}`;
@@ -4052,6 +4054,9 @@ const requiresBeta = (config) => {
4052
4054
  if (config.gpu && config.gpu > 0) {
4053
4055
  return true;
4054
4056
  }
4057
+ if (config.healthCheck !== undefined) {
4058
+ return true;
4059
+ }
4055
4060
  return false;
4056
4061
  };
4057
4062
  //# sourceMappingURL=cloudRunServices.js.map
@@ -4454,6 +4459,64 @@ exports.getCloudRunStopScripts = getCloudRunStopScripts;
4454
4459
 
4455
4460
  /***/ }),
4456
4461
 
4462
+ /***/ 193:
4463
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4464
+
4465
+ "use strict";
4466
+
4467
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4468
+ exports.healthCheckCliArgs = void 0;
4469
+ const types_1 = __nccwpck_require__(5781);
4470
+ const PORT = 8080;
4471
+ function healthCheckCliArgs(healthCheck) {
4472
+ const shouldNotSetHealthCheck = healthCheck === undefined;
4473
+ if (shouldNotSetHealthCheck) {
4474
+ return undefined;
4475
+ }
4476
+ const shouldUseDefaultProbe = healthCheck === true;
4477
+ if (shouldUseDefaultProbe) {
4478
+ return {
4479
+ "startup-probe": toArgValue(probeToKeyValuePairs(types_1.defaultStartupProbe)),
4480
+ "liveness-probe": toArgValue(probeToKeyValuePairs(types_1.defaultLivenessProbe)),
4481
+ };
4482
+ }
4483
+ return {
4484
+ "startup-probe": toArgValue(probeToKeyValuePairs(healthCheck.startupProbe)),
4485
+ "liveness-probe": healthCheck.livenessProbe
4486
+ ? toArgValue(probeToKeyValuePairs(healthCheck.livenessProbe))
4487
+ : "", // NOTE: empty string ("") removes liveness probe
4488
+ };
4489
+ }
4490
+ exports.healthCheckCliArgs = healthCheckCliArgs;
4491
+ function probeToKeyValuePairs(probe) {
4492
+ const sharedArgs = Object.entries({
4493
+ initialDelaySeconds: probe.initialDelaySeconds,
4494
+ timeoutSeconds: probe.timeoutSeconds,
4495
+ periodSeconds: probe.periodSeconds,
4496
+ failureThreshold: probe.failureThreshold,
4497
+ });
4498
+ switch (probe.type) {
4499
+ case "tcp":
4500
+ return [...sharedArgs, ["tcpSocket.port", PORT]];
4501
+ case "http1":
4502
+ return [
4503
+ ...sharedArgs,
4504
+ ["httpGet.port", PORT],
4505
+ ["httpGet.path", probe.path],
4506
+ // NOTE: headers are not supported by "gcloud beta" at the moment
4507
+ ];
4508
+ default:
4509
+ probe;
4510
+ return [];
4511
+ }
4512
+ }
4513
+ function toArgValue(keyValues) {
4514
+ return keyValues.map(([key, value]) => `${key}=${value}`).join(",");
4515
+ }
4516
+ //# sourceMappingURL=healthCheck.js.map
4517
+
4518
+ /***/ }),
4519
+
4457
4520
  /***/ 4069:
4458
4521
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4459
4522
 
@@ -5555,6 +5618,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
5555
5618
  "use strict";
5556
5619
 
5557
5620
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5621
+ exports.defaultLivenessProbe = exports.defaultStartupProbe = void 0;
5622
+ exports.defaultStartupProbe = {
5623
+ type: "http1",
5624
+ path: "/__health",
5625
+ initialDelaySeconds: 5,
5626
+ timeoutSeconds: 1,
5627
+ periodSeconds: 30,
5628
+ failureThreshold: 3,
5629
+ };
5630
+ exports.defaultLivenessProbe = {
5631
+ ...exports.defaultStartupProbe,
5632
+ initialDelaySeconds: 0,
5633
+ timeoutSeconds: 10,
5634
+ periodSeconds: 30,
5635
+ failureThreshold: 3,
5636
+ };
5558
5637
  //# sourceMappingURL=googleCloudRun.js.map
5559
5638
 
5560
5639
  /***/ }),
@@ -6998,6 +6998,7 @@ const getJobOrServiceArgs_1 = __nccwpck_require__(61741);
6998
6998
  const getServiceName_1 = __nccwpck_require__(38128);
6999
6999
  const common_1 = __nccwpck_require__(73325);
7000
7000
  const constants_1 = __nccwpck_require__(38865);
7001
+ const healthCheck_1 = __nccwpck_require__(30193);
7001
7002
  const volumes_1 = __nccwpck_require__(60847);
7002
7003
  const getServiceDeployScript = (context, service, nameSuffix) => {
7003
7004
  var _a, _b, _c, _d, _e, _f;
@@ -7043,6 +7044,7 @@ const getServiceDeployScript = (context, service, nameSuffix) => {
7043
7044
  "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment,
7044
7045
  gpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpu,
7045
7046
  "gpu-type": customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpuType,
7047
+ ...(0, healthCheck_1.healthCheckCliArgs)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.healthCheck),
7046
7048
  }, ...(0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service"));
7047
7049
  const version = requiresBeta(customConfig) ? "beta" : undefined;
7048
7050
  return `${(0, common_1.gcloudRunCmd)(version)} deploy ${fullServiceName} ${argsString}`;
@@ -7070,6 +7072,9 @@ const requiresBeta = (config) => {
7070
7072
  if (config.gpu && config.gpu > 0) {
7071
7073
  return true;
7072
7074
  }
7075
+ if (config.healthCheck !== undefined) {
7076
+ return true;
7077
+ }
7073
7078
  return false;
7074
7079
  };
7075
7080
  //# sourceMappingURL=cloudRunServices.js.map
@@ -7472,6 +7477,64 @@ exports.getCloudRunStopScripts = getCloudRunStopScripts;
7472
7477
 
7473
7478
  /***/ }),
7474
7479
 
7480
+ /***/ 30193:
7481
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
7482
+
7483
+ "use strict";
7484
+
7485
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
7486
+ exports.healthCheckCliArgs = void 0;
7487
+ const types_1 = __nccwpck_require__(75781);
7488
+ const PORT = 8080;
7489
+ function healthCheckCliArgs(healthCheck) {
7490
+ const shouldNotSetHealthCheck = healthCheck === undefined;
7491
+ if (shouldNotSetHealthCheck) {
7492
+ return undefined;
7493
+ }
7494
+ const shouldUseDefaultProbe = healthCheck === true;
7495
+ if (shouldUseDefaultProbe) {
7496
+ return {
7497
+ "startup-probe": toArgValue(probeToKeyValuePairs(types_1.defaultStartupProbe)),
7498
+ "liveness-probe": toArgValue(probeToKeyValuePairs(types_1.defaultLivenessProbe)),
7499
+ };
7500
+ }
7501
+ return {
7502
+ "startup-probe": toArgValue(probeToKeyValuePairs(healthCheck.startupProbe)),
7503
+ "liveness-probe": healthCheck.livenessProbe
7504
+ ? toArgValue(probeToKeyValuePairs(healthCheck.livenessProbe))
7505
+ : "", // NOTE: empty string ("") removes liveness probe
7506
+ };
7507
+ }
7508
+ exports.healthCheckCliArgs = healthCheckCliArgs;
7509
+ function probeToKeyValuePairs(probe) {
7510
+ const sharedArgs = Object.entries({
7511
+ initialDelaySeconds: probe.initialDelaySeconds,
7512
+ timeoutSeconds: probe.timeoutSeconds,
7513
+ periodSeconds: probe.periodSeconds,
7514
+ failureThreshold: probe.failureThreshold,
7515
+ });
7516
+ switch (probe.type) {
7517
+ case "tcp":
7518
+ return [...sharedArgs, ["tcpSocket.port", PORT]];
7519
+ case "http1":
7520
+ return [
7521
+ ...sharedArgs,
7522
+ ["httpGet.port", PORT],
7523
+ ["httpGet.path", probe.path],
7524
+ // NOTE: headers are not supported by "gcloud beta" at the moment
7525
+ ];
7526
+ default:
7527
+ probe;
7528
+ return [];
7529
+ }
7530
+ }
7531
+ function toArgValue(keyValues) {
7532
+ return keyValues.map(([key, value]) => `${key}=${value}`).join(",");
7533
+ }
7534
+ //# sourceMappingURL=healthCheck.js.map
7535
+
7536
+ /***/ }),
7537
+
7475
7538
  /***/ 34069:
7476
7539
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
7477
7540
 
@@ -8573,6 +8636,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
8573
8636
  "use strict";
8574
8637
 
8575
8638
  Object.defineProperty(exports, "__esModule", ({ value: true }));
8639
+ exports.defaultLivenessProbe = exports.defaultStartupProbe = void 0;
8640
+ exports.defaultStartupProbe = {
8641
+ type: "http1",
8642
+ path: "/__health",
8643
+ initialDelaySeconds: 5,
8644
+ timeoutSeconds: 1,
8645
+ periodSeconds: 30,
8646
+ failureThreshold: 3,
8647
+ };
8648
+ exports.defaultLivenessProbe = {
8649
+ ...exports.defaultStartupProbe,
8650
+ initialDelaySeconds: 0,
8651
+ timeoutSeconds: 10,
8652
+ periodSeconds: 30,
8653
+ failureThreshold: 3,
8654
+ };
8576
8655
  //# sourceMappingURL=googleCloudRun.js.map
8577
8656
 
8578
8657
  /***/ }),
@@ -7,6 +7,7 @@ const getJobOrServiceArgs_1 = require("../utils/getJobOrServiceArgs");
7
7
  const getServiceName_1 = require("../utils/getServiceName");
8
8
  const common_1 = require("./common");
9
9
  const constants_1 = require("./constants");
10
+ const healthCheck_1 = require("./healthCheck");
10
11
  const volumes_1 = require("./volumes");
11
12
  const getServiceDeployScript = (context, service, nameSuffix) => {
12
13
  var _a, _b, _c, _d, _e, _f;
@@ -52,6 +53,7 @@ const getServiceDeployScript = (context, service, nameSuffix) => {
52
53
  "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment,
53
54
  gpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpu,
54
55
  "gpu-type": customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpuType,
56
+ ...(0, healthCheck_1.healthCheckCliArgs)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.healthCheck),
55
57
  }, ...(0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service"));
56
58
  const version = requiresBeta(customConfig) ? "beta" : undefined;
57
59
  return `${(0, common_1.gcloudRunCmd)(version)} deploy ${fullServiceName} ${argsString}`;
@@ -79,6 +81,9 @@ const requiresBeta = (config) => {
79
81
  if (config.gpu && config.gpu > 0) {
80
82
  return true;
81
83
  }
84
+ if (config.healthCheck !== undefined) {
85
+ return true;
86
+ }
82
87
  return false;
83
88
  };
84
89
  //# sourceMappingURL=cloudRunServices.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cloudRunServices.js","sourceRoot":"","sources":["../../../../../../../pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.ts"],"names":[],"mappings":";;;AAAA,0DAAuD;AAIvD,gEAA6D;AAC7D,sEAA8E;AAC9E,4DAAyD;AACzD,qCAKkB;AAClB,2CAAgD;AAChD,uCAA+C;AAExC,MAAM,sBAAsB,GAAG,CACpC,OAAyB,EACzB,OAAuD,EACvD,UAAmB,EACnB,EAAE;;IACF,MAAM,gBAAgB,GAAG,IAAA,4BAAmB,EAAC,OAAO,CAAC,CAAC;IAEtD,MAAM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BAiBjC;AACF,MAAM,YAAY,GAAG,CAAC,MAA+C,EAAE,EAAE;IACvE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type DeployConfigCloudRunService } from "../../types";
2
+ export declare function healthCheckCliArgs(healthCheck: DeployConfigCloudRunService["healthCheck"]): {
3
+ "startup-probe": string;
4
+ "liveness-probe": string;
5
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.healthCheckCliArgs = void 0;
4
+ const types_1 = require("../../types");
5
+ const PORT = 8080;
6
+ function healthCheckCliArgs(healthCheck) {
7
+ const shouldNotSetHealthCheck = healthCheck === undefined;
8
+ if (shouldNotSetHealthCheck) {
9
+ return undefined;
10
+ }
11
+ const shouldUseDefaultProbe = healthCheck === true;
12
+ if (shouldUseDefaultProbe) {
13
+ return {
14
+ "startup-probe": toArgValue(probeToKeyValuePairs(types_1.defaultStartupProbe)),
15
+ "liveness-probe": toArgValue(probeToKeyValuePairs(types_1.defaultLivenessProbe)),
16
+ };
17
+ }
18
+ return {
19
+ "startup-probe": toArgValue(probeToKeyValuePairs(healthCheck.startupProbe)),
20
+ "liveness-probe": healthCheck.livenessProbe
21
+ ? toArgValue(probeToKeyValuePairs(healthCheck.livenessProbe))
22
+ : "", // NOTE: empty string ("") removes liveness probe
23
+ };
24
+ }
25
+ exports.healthCheckCliArgs = healthCheckCliArgs;
26
+ function probeToKeyValuePairs(probe) {
27
+ const sharedArgs = Object.entries({
28
+ initialDelaySeconds: probe.initialDelaySeconds,
29
+ timeoutSeconds: probe.timeoutSeconds,
30
+ periodSeconds: probe.periodSeconds,
31
+ failureThreshold: probe.failureThreshold,
32
+ });
33
+ switch (probe.type) {
34
+ case "tcp":
35
+ return [...sharedArgs, ["tcpSocket.port", PORT]];
36
+ case "http1":
37
+ return [
38
+ ...sharedArgs,
39
+ ["httpGet.port", PORT],
40
+ ["httpGet.path", probe.path],
41
+ // NOTE: headers are not supported by "gcloud beta" at the moment
42
+ ];
43
+ default:
44
+ probe;
45
+ return [];
46
+ }
47
+ }
48
+ function toArgValue(keyValues) {
49
+ return keyValues.map(([key, value]) => `${key}=${value}`).join(",");
50
+ }
51
+ //# sourceMappingURL=healthCheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"healthCheck.js","sourceRoot":"","sources":["../../../../../../../pipeline/src/deploy/cloudRun/createJobs/healthCheck.ts"],"names":[],"mappings":";;;AACA,uCAKqB;AAErB,MAAM,IAAI,GAAG,IAAI,CAAC;AAElB,SAAgB,kBAAkB,CAChC,WAAuD;IAEvD,MAAM,uBAAuB,GAAG,WAAW,KAAK,SAAS,CAAC;IAC1D,IAAI,uBAAuB,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,qBAAqB,GAAG,WAAW,KAAK,IAAI,CAAC;IAEnD,IAAI,qBAAqB,EAAE,CAAC;QAC1B,OAAO;YACL,eAAe,EAAE,UAAU,CAAC,oBAAoB,CAAC,2BAAmB,CAAC,CAAC;YACtE,gBAAgB,EAAE,UAAU,CAAC,oBAAoB,CAAC,4BAAoB,CAAC,CAAC;SACzE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,eAAe,EAAE,UAAU,CAAC,oBAAoB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAC3E,gBAAgB,EAAE,WAAW,CAAC,aAAa;YACzC,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;YAC7D,CAAC,CAAC,EAAE,EAAE,iDAAiD;KAC1D,CAAC;AACJ,CAAC;AAvBD,gDAuBC;AAED,SAAS,oBAAoB,CAC3B,KAAgC;IAEhC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC;QAChC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;QAC9C,cAAc,EAAE,KAAK,CAAC,cAAc;QACpC,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;KACC,CAAC,CAAC;IAE7C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,KAAK;YACR,OAAO,CAAC,GAAG,UAAU,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC;QACnD,KAAK,OAAO;YACV,OAAO;gBACL,GAAG,UAAU;gBACb,CAAC,cAAc,EAAE,IAAI,CAAC;gBACtB,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,CAAC;gBAC5B,iEAAiE;aAClE,CAAC;QACJ;YACE,KAAqB,CAAC;YACtB,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,SAA8B;IAChD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC"}
@@ -136,7 +136,77 @@ export type DeployConfigCloudRunService = {
136
136
  * args to pass to the command
137
137
  */
138
138
  args?: string[];
139
+ /**
140
+ * Configuration of the health check.
141
+ *
142
+ * When set to `true`, startup and liveness probes will be
143
+ * configured to `defaultStartupProbe` and `defaultLivenessProbe`.
144
+ *
145
+ * When not set, default Cloud Run's health check
146
+ * configuration is used (startup TCP probe and no liveness probe).
147
+ */
148
+ healthCheck?: true | {
149
+ /**
150
+ * Startup probe configuration.
151
+ */
152
+ startupProbe: DeployConfigCloudRunProbe;
153
+ /**
154
+ * Liveness probe configuration.
155
+ * `false` disables the liveness probe.
156
+ */
157
+ livenessProbe: false | DeployConfigCloudRunProbe;
158
+ };
139
159
  } & DeployConfigCloudRunWithVolumes & DeployConfigCloudRunNetworkConfig;
160
+ export declare const defaultStartupProbe: DeployConfigCloudRunProbe;
161
+ export declare const defaultLivenessProbe: DeployConfigCloudRunProbe;
162
+ export type DeployConfigCloudRunProbe = DeployConfigCloudRunHttp1Probe | DeployConfigCloudRunTcpProbe;
163
+ export type DeployConfigCloudRunProbeShared = {
164
+ /**
165
+ * The period in seconds at which to perform the probe.
166
+ * For example 2 to perform the probe every 2 seconds.
167
+ * Specify a value **from 1 second to 240** seconds.
168
+ */
169
+ periodSeconds: number;
170
+ /**
171
+ * The number of seconds to wait after the container has started before performing the first probe.
172
+ * Specify a value **from 0 seconds to 240** seconds.
173
+ */
174
+ initialDelaySeconds: number;
175
+ /**
176
+ * The number of seconds to wait until the probe times out.
177
+ * This value cannot exceed the value specified for `period`.
178
+ * Specify a value **from 1 to 240**.
179
+ */
180
+ timeoutSeconds: number;
181
+ /**
182
+ * The number of times to retry the probe before shutting down the container.
183
+ */
184
+ failureThreshold: number;
185
+ };
186
+ export type DeployConfigCloudRunTcpProbe = DeployConfigCloudRunProbeShared & {
187
+ /**
188
+ * Cloud Run makes a TCP connection to open the TCP Socket on the specified port.
189
+ * If Cloud Run is unable to establish a connection, it indicates a failure.
190
+ */
191
+ type: "tcp";
192
+ };
193
+ export type DeployConfigCloudRunHttp1Probe = DeployConfigCloudRunProbeShared & {
194
+ /**
195
+ * **This will NOT work with http2 enabled services**
196
+ *
197
+ * Cloud Run makes an HTTP GET request to the service health check endpoint (for example, /ready).
198
+ * Any response between 200 and 400 is a success, everything else indicates failure.
199
+ *
200
+ * If a startup probe does not succeed within the specified time (failureThreshold * period), which cannot exceed 240 seconds, the container is shut down.
201
+ *
202
+ * If the HTTP startup probe succeeds within the specified time, and you have enabled liveness probe, the HTTP liveness probe is started.
203
+ */
204
+ type: "http1";
205
+ /**
206
+ * the route path to check for health status of the service starting with a `/`.
207
+ */
208
+ path: string;
209
+ };
140
210
  export type DeployConfigCloudRunNetworkConfig = {
141
211
  network?: string;
142
212
  /**
@@ -1,3 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultLivenessProbe = exports.defaultStartupProbe = void 0;
4
+ exports.defaultStartupProbe = {
5
+ type: "http1",
6
+ path: "/__health",
7
+ initialDelaySeconds: 5,
8
+ timeoutSeconds: 1,
9
+ periodSeconds: 30,
10
+ failureThreshold: 3,
11
+ };
12
+ exports.defaultLivenessProbe = {
13
+ ...exports.defaultStartupProbe,
14
+ initialDelaySeconds: 0,
15
+ timeoutSeconds: 10,
16
+ periodSeconds: 30,
17
+ failureThreshold: 3,
18
+ };
3
19
  //# sourceMappingURL=googleCloudRun.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"googleCloudRun.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/types/googleCloudRun.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"googleCloudRun.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/types/googleCloudRun.ts"],"names":[],"mappings":";;;AA4Na,QAAA,mBAAmB,GAA8B;IAC5D,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,WAAW;IAEjB,mBAAmB,EAAE,CAAC;IACtB,cAAc,EAAE,CAAC;IACjB,aAAa,EAAE,EAAE;IACjB,gBAAgB,EAAE,CAAC;CACpB,CAAC;AAEW,QAAA,oBAAoB,GAA8B;IAC7D,GAAG,2BAAmB;IAEtB,mBAAmB,EAAE,CAAC;IACtB,cAAc,EAAE,EAAE;IAClB,aAAa,EAAE,EAAE;IACjB,gBAAgB,EAAE,CAAC;CACpB,CAAC"}