@catladder/pipeline 2.6.3 → 2.7.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/constants.js +1 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +16 -19
- package/dist/deploy/types/googleCloudRun.d.ts +14 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +84 -16
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +84 -16
- package/examples/cloud-run-service-custom-vpc-connector.ts +8 -0
- package/examples/cloud-run-service-custom-vpc.ts +9 -0
- package/package.json +1 -1
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +18 -24
- package/src/deploy/types/googleCloudRun.ts +17 -13
package/dist/constants.js
CHANGED
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
7
|
-
exports.PIPELINE_IMAGE_TAG = "v2-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "v2-7-0-5e79963c" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -108,37 +108,34 @@ var getJobRunScripts = function (context, when) {
|
|
|
108
108
|
exports.getJobRunScripts = getJobRunScripts;
|
|
109
109
|
var getJobCreateScripts = function (context) {
|
|
110
110
|
return getCloudRunJobsWithNames(context).map(function (_a, jobIndex) {
|
|
111
|
-
var _b
|
|
112
|
-
|
|
113
|
-
image = _b.image,
|
|
114
|
-
cpu = _b.cpu,
|
|
115
|
-
_c = _b.memory,
|
|
116
|
-
memory = _c === void 0 ? "512Mi" : _c,
|
|
117
|
-
_d = _b.timeout,
|
|
118
|
-
timeout = _d === void 0 ? "10m" : _d,
|
|
119
|
-
_e = _b.parallelism,
|
|
120
|
-
parallelism = _e === void 0 ? 1 : _e,
|
|
121
|
-
volumes = _b.volumes,
|
|
111
|
+
var _b, _c, _d, _e;
|
|
112
|
+
var job = _a.job,
|
|
122
113
|
jobName = _a.jobName;
|
|
123
|
-
var commandArray = Array.isArray(command) ? command : command.split(" ");
|
|
114
|
+
var commandArray = Array.isArray(job.command) ? job.command : job.command.split(" ");
|
|
124
115
|
var _f = (0, common_1.getCommonDeployArgs)(context),
|
|
125
116
|
commonImage = _f.image,
|
|
126
117
|
project = _f.project,
|
|
127
118
|
region = _f.region,
|
|
128
119
|
deployArgs = __rest(_f, ["image", "project", "region"]);
|
|
129
|
-
var commonDeployArgsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign({
|
|
120
|
+
var commonDeployArgsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
|
|
130
121
|
command: "\"".concat(commandArray.join(","), "\""),
|
|
131
122
|
labels: "\"".concat((0, common_1.makeLabelString)((0, getLabels_1.getLabels)(context)), ",cloud-run-job-name=$current_job_name\""),
|
|
132
|
-
image: "\"".concat(image !== null &&
|
|
123
|
+
image: "\"".concat((_b = job.image) !== null && _b !== void 0 ? _b : commonImage, "\""),
|
|
133
124
|
project: project,
|
|
134
125
|
region: region,
|
|
135
|
-
cpu: cpu,
|
|
136
|
-
memory: memory,
|
|
137
|
-
parallelism: parallelism,
|
|
138
|
-
"task-timeout": timeout,
|
|
126
|
+
cpu: job.cpu,
|
|
127
|
+
memory: (_c = job.memory) !== null && _c !== void 0 ? _c : "512Mi",
|
|
128
|
+
parallelism: (_d = job.parallelism) !== null && _d !== void 0 ? _d : 1,
|
|
129
|
+
"task-timeout": (_e = job.timeout) !== null && _e !== void 0 ? _e : "10m",
|
|
139
130
|
"env-vars-file": constants_1.ENV_VARS_FILENAME,
|
|
140
131
|
"max-retries": 0
|
|
141
|
-
}, deployArgs)
|
|
132
|
+
}, deployArgs), {
|
|
133
|
+
// network
|
|
134
|
+
"vpc-connector": job === null || job === void 0 ? void 0 : job.vpcConnector,
|
|
135
|
+
"vpc-egress": job === null || job === void 0 ? void 0 : job.vpcEgress,
|
|
136
|
+
network: job === null || job === void 0 ? void 0 : job.network,
|
|
137
|
+
subnet: job === null || job === void 0 ? void 0 : job.subnet
|
|
138
|
+
})], __read((0, volumes_1.createVolumeConfig)(job.volumes, "job")), false));
|
|
142
139
|
return [jobIndex === 0 ? "exist_job_names=\"$(\n ".concat((0, common_1.gcloudRunCmd)(), " jobs list --filter='metadata.name ~ ").concat(context.env, ".*").concat(context.name, "' --format='value(name)' --limit=999 --project='").concat(project, "' --region='").concat(region, "'\n)\"") : null, "current_job_name=\"".concat(jobName, "\""), 'if grep "$current_job_name" <<<"$exist_job_names" >/dev/null; then', " ".concat((0, common_1.gcloudRunCmd)(), " jobs update \"$current_job_name\" ").concat(commonDeployArgsString), "else", " ".concat((0, common_1.gcloudRunCmd)(), " jobs create \"$current_job_name\" ").concat(commonDeployArgsString), "fi"].filter(utils_1.notNil).join("\n");
|
|
143
140
|
});
|
|
144
141
|
};
|
|
@@ -106,6 +106,18 @@ export type DeployConfigCloudRunService = {
|
|
|
106
106
|
* defaults to gen1 according to gcloud
|
|
107
107
|
*/
|
|
108
108
|
executionEnvironment?: "gen2" | "gen1";
|
|
109
|
+
/**
|
|
110
|
+
* Use http2 end-to-end. See https://cloud.google.com/run/docs/configuring/http2
|
|
111
|
+
*
|
|
112
|
+
* Defaults to false.
|
|
113
|
+
*
|
|
114
|
+
* Your service needs to be able to handle http2 requests.
|
|
115
|
+
* Its recommended to use http2 without tls, since cloud run handles the encryption for you. (so called "h2c" (http2 cleartext))
|
|
116
|
+
*
|
|
117
|
+
*/
|
|
118
|
+
http2?: boolean;
|
|
119
|
+
} & DeployConfigCloudRunWithVolumes & DeployConfigCloudRunNetworkConfig;
|
|
120
|
+
export type DeployConfigCloudRunNetworkConfig = {
|
|
109
121
|
network?: string;
|
|
110
122
|
/**
|
|
111
123
|
* vpc subnet to use, see https://cloud.google.com/sdk/gcloud/reference/run/deploy#--subnet
|
|
@@ -119,17 +131,7 @@ export type DeployConfigCloudRunService = {
|
|
|
119
131
|
* vpc connector
|
|
120
132
|
*/
|
|
121
133
|
vpcConnector?: string;
|
|
122
|
-
|
|
123
|
-
* Use http2 end-to-end. See https://cloud.google.com/run/docs/configuring/http2
|
|
124
|
-
*
|
|
125
|
-
* Defaults to false.
|
|
126
|
-
*
|
|
127
|
-
* Your service needs to be able to handle http2 requests.
|
|
128
|
-
* Its recommended to use http2 without tls, since cloud run handles the encryption for you. (so called "h2c" (http2 cleartext))
|
|
129
|
-
*
|
|
130
|
-
*/
|
|
131
|
-
http2?: boolean;
|
|
132
|
-
} & DeployConfigCloudRunWithVolumes;
|
|
134
|
+
};
|
|
133
135
|
export type DeployConfigCloudRunJobBase = {
|
|
134
136
|
/**
|
|
135
137
|
* command
|
|
@@ -157,7 +159,7 @@ export type DeployConfigCloudRunJobBase = {
|
|
|
157
159
|
* number of tasks that may run concurrently, defaults to 1
|
|
158
160
|
*/
|
|
159
161
|
parallelism?: number;
|
|
160
|
-
} & DeployConfigCloudRunWithVolumes;
|
|
162
|
+
} & DeployConfigCloudRunWithVolumes & DeployConfigCloudRunNetworkConfig;
|
|
161
163
|
type Minute = string;
|
|
162
164
|
type Hour = string;
|
|
163
165
|
type DayOfMonth = string;
|