@@ -92,7 +92,11 @@ const dayjs_1 = __importDefault(__nccwpck_require__(184));
92
92
const core = __importStar(__nccwpck_require__(7733));
93
93
__nccwpck_require__(4250);
94
94
const service_1 = __nccwpck_require__(1209);
95
- const TIMEOUT_IN_MINUTES = 5;
95
+ /**
96
+ * Now that we have more robust container build processes, we should monitor...
97
+ * whether this timeout needs to be increased.
98
+ */
99
+ const TIMEOUT_IN_MINUTES = 15;
96
100
const BAD_INSTANCE_STATES = ["errored", "failed"];
97
101
const defaultConfigPaths = [
98
102
"paperspace.yaml",
@@ -168,9 +172,13 @@ function isDeploymentStable(deployment) {
168
172
const { latestSpec } = deployment;
169
173
return !!(latestSpec === null || latestSpec === void 0 ? void 0 : latestSpec.dtHealthy);
170
174
}
175
+ function maybeCheckDeploymentError(deployment) {
176
+ const { latestSpec } = deployment;
177
+ return latestSpec === null || latestSpec === void 0 ? void 0 : latestSpec.error;
178
+ }
171
179
// eslint-disable-next-line @typescript-eslint/no-explicit-any
172
180
function syncDeployment(projectId, yaml) {
173
- var _a;
181
+ var _a, _b ;
174
182
return __awaiter(this, void 0, void 0, function* () {
175
183
const deploymentId = yield (0, service_1.upsertDeployment)({
176
184
config: yaml,
@@ -184,8 +192,14 @@ function syncDeployment(projectId, yaml) {
184
192
while (!isDeploymentUpdated) {
185
193
core.info("Waiting for deployment to complete...");
186
194
const { runs, deployment } = yield (0, service_1.getDeploymentWithDetails)(deploymentId);
195
+ const error = maybeCheckDeploymentError(deployment);
196
+ // this means our pre-build steps failed.
197
+ if (!((_a = deployment.latestSpec) === null || _a === void 0 ? void 0 : _a.externalApplied) && error) {
198
+ const fatalError = `Deployment upsert failed. ${error}`;
199
+ throw new Error(fatalError);
200
+ }
187
201
// only look at deployments that were applied to the target cluster
188
- if ((_a = deployment.latestSpec) === null || _a === void 0 ? void 0 : _a .externalApplied) {
202
+ if ((_b = deployment.latestSpec) === null || _b === void 0 ? void 0 : _b .externalApplied) {
189
203
if (start.isBefore((0, dayjs_1.default)().subtract(TIMEOUT_IN_MINUTES, "minutes"))) {
190
204
throwBadDeployError(runs);
191
205
}
@@ -349,7 +363,7 @@ const upsertDeploymentFetcher = fetcher
349
363
.method("post")
350
364
.create();
351
365
const getDeploymentByProjectFetcher = fetcher
352
- .path("/projects/{handle }/deployments")
366
+ .path("/projects/{id }/deployments")
353
367
.method("get")
354
368
.create();
355
369
function upsertDeployment(config) {
@@ -372,10 +386,10 @@ function upsertDeployment(config) {
372
386
});
373
387
}
374
388
exports.upsertDeployment = upsertDeployment;
375
- function getDeploymentByProjectAndName(handle , name) {
389
+ function getDeploymentByProjectAndName(id , name) {
376
390
return __awaiter(this, void 0, void 0, function* () {
377
391
const { data } = yield getDeploymentByProjectFetcher({
378
- handle ,
392
+ id ,
379
393
name,
380
394
});
381
395
const deployments = data.items;
0 commit comments