@catladder/cli 0.0.0-main-33d45924 → 0.0.0-main-1b2054de

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.
@@ -62,85 +62,111 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
62
62
  .command("cloud-sql-restore-db", "restore a db from one source to another target")
63
63
  .action(function restoreDb() {
64
64
  return __awaiter(this, void 0, void 0, function () {
65
- var sourceInstance, SOURCE_INSTANCE_PORT, TARGET_INSTANCE_PORT, sourceProxy, sourcePassword, sourceDbName, targetInstance, targetProxy, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
65
+ var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
66
66
  return __generator(this, function (_a) {
67
67
  switch (_a.label) {
68
68
  case 0: return [4 /*yield*/, this.prompt({
69
69
  type: "input",
70
70
  name: "sourceInstance",
71
- message: "Source instance (connection string)? 🤔 "
71
+ message: "Source instance (connection string or 'local')? 🤔 "
72
72
  })];
73
73
  case 1:
74
74
  sourceInstance = (_a.sent()).sourceInstance;
75
- SOURCE_INSTANCE_PORT = 54399;
76
- TARGET_INSTANCE_PORT = 54499;
77
- return [4 /*yield*/, createProxy(sourceInstance, SOURCE_INSTANCE_PORT)];
78
- case 2:
79
- sourceProxy = _a.sent();
75
+ if (!(sourceInstance === "local")) return [3 /*break*/, 3];
80
76
  return [4 /*yield*/, this.prompt({
81
- type: "input",
82
- name: "sourcePassword",
83
- message: "Source Password? 🤔 "
77
+ type: "number",
78
+ name: "sourceLocalPort",
79
+ "default": 5432,
80
+ message: "Local Port for source? 🤔 "
84
81
  })];
82
+ case 2:
83
+ sourceLocalPort = (_a.sent()).sourceLocalPort;
84
+ sourcePort = sourceLocalPort;
85
+ return [3 /*break*/, 5];
85
86
  case 3:
87
+ sourcePort = 54399;
88
+ return [4 /*yield*/, createProxy(sourceInstance, sourcePort)];
89
+ case 4:
90
+ sourceProxy = _a.sent();
91
+ _a.label = 5;
92
+ case 5: return [4 /*yield*/, this.prompt({
93
+ type: "input",
94
+ name: "sourcePassword",
95
+ message: "Source Password? 🤔 "
96
+ })];
97
+ case 6:
86
98
  sourcePassword = (_a.sent()).sourcePassword;
87
99
  return [4 /*yield*/, this.prompt({
88
100
  type: "input",
89
101
  name: "sourceDbName",
90
102
  message: "Source DB name? 🤔 "
91
103
  })];
92
- case 4:
104
+ case 7:
93
105
  sourceDbName = (_a.sent()).sourceDbName;
94
106
  return [4 /*yield*/, this.prompt({
95
107
  type: "input",
96
108
  name: "targetInstance",
97
- message: "Targe INSTANCE (connection string)? 🤔 "
109
+ message: "Targe INSTANCE (connection string or 'local')? 🤔 "
98
110
  })];
99
- case 5:
111
+ case 8:
100
112
  targetInstance = (_a.sent()).targetInstance;
101
- return [4 /*yield*/, createProxy(targetInstance, TARGET_INSTANCE_PORT)];
102
- case 6:
103
- targetProxy = _a.sent();
113
+ if (!(targetInstance === "local")) return [3 /*break*/, 10];
104
114
  return [4 /*yield*/, this.prompt({
105
- type: "input",
106
- name: "targetPassword",
107
- message: "Target Password? 🤔 "
115
+ type: "number",
116
+ name: "targetLocalPort",
117
+ "default": 5432,
118
+ message: "Local Port for target? 🤔 "
108
119
  })];
109
- case 7:
120
+ case 9:
121
+ targetLocalPort = (_a.sent()).targetLocalPort;
122
+ targetPort = targetLocalPort;
123
+ return [3 /*break*/, 12];
124
+ case 10:
125
+ targetPort = 54499;
126
+ return [4 /*yield*/, createProxy(targetInstance, targetPort)];
127
+ case 11:
128
+ targetProxy = _a.sent();
129
+ _a.label = 12;
130
+ case 12: return [4 /*yield*/, this.prompt({
131
+ type: "input",
132
+ name: "targetPassword",
133
+ message: "Target Password? 🤔 "
134
+ })];
135
+ case 13:
110
136
  targetPassword = (_a.sent()).targetPassword;
111
137
  return [4 /*yield*/, this.prompt({
112
138
  type: "input",
113
139
  name: "targetDbName",
114
140
  message: "Target DB name? 🤔 "
115
141
  })];
116
- case 8:
142
+ case 14:
117
143
  targetDbName = (_a.sent()).targetDbName;
118
144
  return [4 /*yield*/, this.prompt({
119
145
  type: "confirm",
120
146
  name: "shouldContinue",
121
147
  message: "This will drop ".concat(targetInstance, "/").concat(targetDbName, " and replace it with ").concat(sourceInstance, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
122
148
  })];
123
- case 9:
149
+ case 15:
124
150
  shouldContinue = (_a.sent()).shouldContinue;
125
151
  if (!shouldContinue) {
126
152
  return [2 /*return*/];
127
153
  }
128
154
  targetPSQL = function (command) {
129
- return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(TARGET_INSTANCE_PORT, " --host=localhost --user=postgres -q ").concat(command);
155
+ return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(targetPort, " --host=localhost --user=postgres -q ").concat(command);
130
156
  };
131
- copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://postgres:".concat(sourcePassword, "@localhost:").concat(SOURCE_INSTANCE_PORT, "/").concat(sourceDbName, " --no-owner --no-privileges > $dumptmp\n echo \"dump done\"\n ").concat(targetPSQL("-c 'drop database \"".concat(targetDbName, "\" WITH (FORCE)' 1> /dev/null || true")), "\n ").concat(targetPSQL("-c 'create database \"".concat(targetDbName, "\"' 1> /dev/null")), "\n echo \"Restoring dump...\"\n ").concat(targetPSQL("\"".concat(targetDbName, "\" < $dumptmp 1> /dev/null")), "\n \n\n echo \"Clean up...\"\n set +e\n rm $dumptmp\n echo \"\n\uD83D\uDC31 Done!\"\n ");
132
- _a.label = 10;
133
- case 10:
134
- _a.trys.push([10, , 12, 13]);
157
+ copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://postgres:".concat(sourcePassword, "@localhost:").concat(sourcePort, "/").concat(sourceDbName, " --no-owner --no-privileges > $dumptmp\n echo \"dump done\"\n ").concat(targetPSQL("-c 'drop database \"".concat(targetDbName, "\" WITH (FORCE)' 1> /dev/null || true")), "\n ").concat(targetPSQL("-c 'create database \"".concat(targetDbName, "\"' 1> /dev/null")), "\n echo \"Restoring dump...\"\n ").concat(targetPSQL("\"".concat(targetDbName, "\" < $dumptmp 1> /dev/null")), "\n \n\n echo \"Clean up...\"\n set +e\n rm $dumptmp\n echo \"\n\uD83D\uDC31 Done!\"\n ");
158
+ _a.label = 16;
159
+ case 16:
160
+ _a.trys.push([16, , 18, 19]);
135
161
  return [4 /*yield*/, (0, child_process_promise_1.spawn)(copyDBScript, [], { shell: "bash", stdio: "inherit" })];
136
- case 11:
162
+ case 17:
137
163
  _a.sent();
138
- return [3 /*break*/, 13];
139
- case 12:
140
- sourceProxy.stop();
141
- targetProxy.stop();
164
+ return [3 /*break*/, 19];
165
+ case 18:
166
+ sourceProxy === null || sourceProxy === void 0 ? void 0 : sourceProxy.stop();
167
+ targetProxy === null || targetProxy === void 0 ? void 0 : targetProxy.stop();
142
168
  return [7 /*endfinally*/];
143
- case 13: return [2 /*return*/];
169
+ case 19: return [2 /*return*/];
144
170
  }
145
171
  });
146
172
  });
@@ -1 +1 @@
1
- {"version":3,"file":"commandRestoreDb.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/cloudSQL/commandRestoreDb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAG9C,IAAM,WAAW,GAAG,UAAO,QAAgB,EAAE,IAAY;;;;;gBACjD,KAAK,GAAG,IAAA,6BAAK,EACjB,qCAA8B,QAAQ,kBAAQ,IAAI,CAAE,EACpD,EAAE,EACF,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;gBACF,uBAAuB;gBACvB,qBAAM,IAAA,6BAAK,EACT,+EACoC,IAAI,2EAGrB,E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K,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAA;;gCAAlE,SAAkE,CAAC;;;gCAEnE,WAAW,CAAC,IAAI,EAAE,CAAC;gCACnB,WAAW,CAAC,IAAI,EAAE,CAAC;;;;;;aAEtB,CAAC,EAAA;;KAAA,EAAC"}
1
+ {"version":3,"file":"commandRestoreDb.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/cloudSQL/commandRestoreDb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA8C;AAG9C,IAAM,WAAW,GAAG,UAAO,QAAgB,EAAE,IAAY;;;;;gBACjD,KAAK,GAAG,IAAA,6BAAK,EACjB,qCAA8B,QAAQ,kBAAQ,IAAI,CAAE,EACpD,EAAE,EACF,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAC;gBACF,uBAAuB;gBACvB,qBAAM,IAAA,6BAAK,EACT,+EACoC,IAAI,2EAGrB,EACnB,EAAE,EACF,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,EAAA;;gBATD,uBAAuB;gBACvB,SAQC,CAAC;gBACI,IAAI,GAAG,cAAM,OAAA,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,EAAzB,CAAyB,CAAC;gBAC7C,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;gBAE/B,sBAAO;wBACL,IAAI,MAAA;qBACL,EAAC;;;KACH,CAAC;AAEF,sBAAe,UAAO,MAAc;;QAClC,sBAAA,MAAM;iBACH,OAAO,CACN,sBAAsB,EACtB,gDAAgD,CACjD;iBACA,MAAM,CAAC,SAAe,SAAS;;;;;oCACH,qBAAM,IAAI,CAAC,MAAM,CAAC;oCAC3C,IAAI,EAAE,OAAO;oCACb,IAAI,EAAE,gBAAgB;oCAEtB,OAAO,EAAE,qDAAqD;iCAC/D,CAAC,EAAA;;gCALM,cAAc,GAAK,CAAA,SAKzB,CAAA,eALoB;qC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M,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAA;;gCAAlE,SAAkE,CAAC;;;gCAEnE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;gCACpB,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;;;;;;aAEvB,CAAC,EAAA;;KAAA,EAAC"}
@@ -40296,7 +40296,7 @@ exports.readConfigSync = readConfigSync;
40296
40296
 
40297
40297
  exports.__esModule = true;
40298
40298
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
40299
- exports.PIPELINE_IMAGE_TAG = "main-33d45924" || 0;
40299
+ exports.PIPELINE_IMAGE_TAG = "main-1b2054de" || 0;
40300
40300
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
40301
40301
 
40302
40302
  /***/ }),
@@ -42285,7 +42285,7 @@ var base_1 = __nccwpck_require__(9177);
42285
42285
  var types_1 = __nccwpck_require__(3109);
42286
42286
 
42287
42287
  var createCustomDeployJobs = function (context) {
42288
- var _a;
42288
+ var _a, _b;
42289
42289
 
42290
42290
  var deployConfig = context.componentConfig.deploy;
42291
42291
 
@@ -42302,6 +42302,7 @@ var createCustomDeployJobs = function (context) {
42302
42302
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
42303
42303
  return [(0, lodash_1.merge)({}, baseDeploymentJob, {
42304
42304
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
42305
+ cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
42305
42306
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
42306
42307
  })];
42307
42308
  };
@@ -159,85 +159,111 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
159
159
  .command("cloud-sql-restore-db", "restore a db from one source to another target")
160
160
  .action(function restoreDb() {
161
161
  return __awaiter(this, void 0, void 0, function () {
162
- var sourceInstance, SOURCE_INSTANCE_PORT, TARGET_INSTANCE_PORT, sourceProxy, sourcePassword, sourceDbName, targetInstance, targetProxy, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
162
+ var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
163
163
  return __generator(this, function (_a) {
164
164
  switch (_a.label) {
165
165
  case 0: return [4 /*yield*/, this.prompt({
166
166
  type: "input",
167
167
  name: "sourceInstance",
168
- message: "Source instance (connection string)? 🤔 "
168
+ message: "Source instance (connection string or 'local')? 🤔 "
169
169
  })];
170
170
  case 1:
171
171
  sourceInstance = (_a.sent()).sourceInstance;
172
- SOURCE_INSTANCE_PORT = 54399;
173
- TARGET_INSTANCE_PORT = 54499;
174
- return [4 /*yield*/, createProxy(sourceInstance, SOURCE_INSTANCE_PORT)];
175
- case 2:
176
- sourceProxy = _a.sent();
172
+ if (!(sourceInstance === "local")) return [3 /*break*/, 3];
177
173
  return [4 /*yield*/, this.prompt({
178
- type: "input",
179
- name: "sourcePassword",
180
- message: "Source Password? 🤔 "
174
+ type: "number",
175
+ name: "sourceLocalPort",
176
+ "default": 5432,
177
+ message: "Local Port for source? 🤔 "
181
178
  })];
179
+ case 2:
180
+ sourceLocalPort = (_a.sent()).sourceLocalPort;
181
+ sourcePort = sourceLocalPort;
182
+ return [3 /*break*/, 5];
182
183
  case 3:
184
+ sourcePort = 54399;
185
+ return [4 /*yield*/, createProxy(sourceInstance, sourcePort)];
186
+ case 4:
187
+ sourceProxy = _a.sent();
188
+ _a.label = 5;
189
+ case 5: return [4 /*yield*/, this.prompt({
190
+ type: "input",
191
+ name: "sourcePassword",
192
+ message: "Source Password? 🤔 "
193
+ })];
194
+ case 6:
183
195
  sourcePassword = (_a.sent()).sourcePassword;
184
196
  return [4 /*yield*/, this.prompt({
185
197
  type: "input",
186
198
  name: "sourceDbName",
187
199
  message: "Source DB name? 🤔 "
188
200
  })];
189
- case 4:
201
+ case 7:
190
202
  sourceDbName = (_a.sent()).sourceDbName;
191
203
  return [4 /*yield*/, this.prompt({
192
204
  type: "input",
193
205
  name: "targetInstance",
194
- message: "Targe INSTANCE (connection string)? 🤔 "
206
+ message: "Targe INSTANCE (connection string or 'local')? 🤔 "
195
207
  })];
196
- case 5:
208
+ case 8:
197
209
  targetInstance = (_a.sent()).targetInstance;
198
- return [4 /*yield*/, createProxy(targetInstance, TARGET_INSTANCE_PORT)];
199
- case 6:
200
- targetProxy = _a.sent();
210
+ if (!(targetInstance === "local")) return [3 /*break*/, 10];
201
211
  return [4 /*yield*/, this.prompt({
202
- type: "input",
203
- name: "targetPassword",
204
- message: "Target Password? 🤔 "
212
+ type: "number",
213
+ name: "targetLocalPort",
214
+ "default": 5432,
215
+ message: "Local Port for target? 🤔 "
205
216
  })];
206
- case 7:
217
+ case 9:
218
+ targetLocalPort = (_a.sent()).targetLocalPort;
219
+ targetPort = targetLocalPort;
220
+ return [3 /*break*/, 12];
221
+ case 10:
222
+ targetPort = 54499;
223
+ return [4 /*yield*/, createProxy(targetInstance, targetPort)];
224
+ case 11:
225
+ targetProxy = _a.sent();
226
+ _a.label = 12;
227
+ case 12: return [4 /*yield*/, this.prompt({
228
+ type: "input",
229
+ name: "targetPassword",
230
+ message: "Target Password? 🤔 "
231
+ })];
232
+ case 13:
207
233
  targetPassword = (_a.sent()).targetPassword;
208
234
  return [4 /*yield*/, this.prompt({
209
235
  type: "input",
210
236
  name: "targetDbName",
211
237
  message: "Target DB name? 🤔 "
212
238
  })];
213
- case 8:
239
+ case 14:
214
240
  targetDbName = (_a.sent()).targetDbName;
215
241
  return [4 /*yield*/, this.prompt({
216
242
  type: "confirm",
217
243
  name: "shouldContinue",
218
244
  message: "This will drop ".concat(targetInstance, "/").concat(targetDbName, " and replace it with ").concat(sourceInstance, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
219
245
  })];
220
- case 9:
246
+ case 15:
221
247
  shouldContinue = (_a.sent()).shouldContinue;
222
248
  if (!shouldContinue) {
223
249
  return [2 /*return*/];
224
250
  }
225
251
  targetPSQL = function (command) {
226
- return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(TARGET_INSTANCE_PORT, " --host=localhost --user=postgres -q ").concat(command);
252
+ return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(targetPort, " --host=localhost --user=postgres -q ").concat(command);
227
253
  };
228
- copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://postgres:".concat(sourcePassword, "@localhost:").concat(SOURCE_INSTANCE_PORT, "/").concat(sourceDbName, " --no-owner --no-privileges > $dumptmp\n echo \"dump done\"\n ").concat(targetPSQL("-c 'drop database \"".concat(targetDbName, "\" WITH (FORCE)' 1> /dev/null || true")), "\n ").concat(targetPSQL("-c 'create database \"".concat(targetDbName, "\"' 1> /dev/null")), "\n echo \"Restoring dump...\"\n ").concat(targetPSQL("\"".concat(targetDbName, "\" < $dumptmp 1> /dev/null")), "\n \n\n echo \"Clean up...\"\n set +e\n rm $dumptmp\n echo \"\n\uD83D\uDC31 Done!\"\n ");
229
- _a.label = 10;
230
- case 10:
231
- _a.trys.push([10, , 12, 13]);
254
+ copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://postgres:".concat(sourcePassword, "@localhost:").concat(sourcePort, "/").concat(sourceDbName, " --no-owner --no-privileges > $dumptmp\n echo \"dump done\"\n ").concat(targetPSQL("-c 'drop database \"".concat(targetDbName, "\" WITH (FORCE)' 1> /dev/null || true")), "\n ").concat(targetPSQL("-c 'create database \"".concat(targetDbName, "\"' 1> /dev/null")), "\n echo \"Restoring dump...\"\n ").concat(targetPSQL("\"".concat(targetDbName, "\" < $dumptmp 1> /dev/null")), "\n \n\n echo \"Clean up...\"\n set +e\n rm $dumptmp\n echo \"\n\uD83D\uDC31 Done!\"\n ");
255
+ _a.label = 16;
256
+ case 16:
257
+ _a.trys.push([16, , 18, 19]);
232
258
  return [4 /*yield*/, (0, child_process_promise_1.spawn)(copyDBScript, [], { shell: "bash", stdio: "inherit" })];
233
- case 11:
259
+ case 17:
234
260
  _a.sent();
235
- return [3 /*break*/, 13];
236
- case 12:
237
- sourceProxy.stop();
238
- targetProxy.stop();
261
+ return [3 /*break*/, 19];
262
+ case 18:
263
+ sourceProxy === null || sourceProxy === void 0 ? void 0 : sourceProxy.stop();
264
+ targetProxy === null || targetProxy === void 0 ? void 0 : targetProxy.stop();
239
265
  return [7 /*endfinally*/];
240
- case 13: return [2 /*return*/];
266
+ case 19: return [2 /*return*/];
241
267
  }
242
268
  });
243
269
  });
@@ -351374,7 +351400,7 @@ exports.readConfigSync = readConfigSync;
351374
351400
 
351375
351401
  exports.__esModule = true;
351376
351402
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
351377
- exports.PIPELINE_IMAGE_TAG = "main-33d45924" || 0;
351403
+ exports.PIPELINE_IMAGE_TAG = "main-1b2054de" || 0;
351378
351404
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
351379
351405
 
351380
351406
  /***/ }),
@@ -353363,7 +353389,7 @@ var base_1 = __nccwpck_require__(89177);
353363
353389
  var types_1 = __nccwpck_require__(63109);
353364
353390
 
353365
353391
  var createCustomDeployJobs = function (context) {
353366
- var _a;
353392
+ var _a, _b;
353367
353393
 
353368
353394
  var deployConfig = context.componentConfig.deploy;
353369
353395
 
@@ -353380,6 +353406,7 @@ var createCustomDeployJobs = function (context) {
353380
353406
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
353381
353407
  return [(0, lodash_1.merge)({}, baseDeploymentJob, {
353382
353408
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
353409
+ cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
353383
353410
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
353384
353411
  })];
353385
353412
  };