Skip to content

Commit bd4c054

Browse files
committed
feat(cli): Adding link to failed deployments
1 parent d816f79 commit bd4c054

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

templates/cli/lib/commands/push.js.twig

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const inquirer = require("inquirer");
22
const JSONbig = require("json-bigint")({ storeAsString: false });
33
const { Command } = require("commander");
4-
const { localConfig } = require("../config");
4+
const { localConfig, globalConfig } = require("../config");
55
const { Spinner, SPINNER_ARC, SPINNER_DOTS } = require('../spinner');
66
const { paginate } = require('../paginate');
77
const { questionsPushBuckets, questionsPushTeams, questionsPushFunctions, questionsGetEntrypoint, questionsPushCollections, questionsConfirmPushCollections } = require("../questions");
@@ -314,6 +314,7 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
314314
Spinner.start(false);
315315
let successfullyPushed = 0;
316316
let successfullyDeployed = 0;
317+
const failedDeployments = [];
317318

318319
await Promise.all(functions.map(async (func) => {
319320
const ignore = func.ignore ? 'appwrite.json' : '.gitignore';
@@ -479,7 +480,8 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
479480

480481
break;
481482
} else if (status === 'failed') {
482-
updaterRow.fail({ errorMessage: 'Failed to deploy.' });
483+
failedDeployments.push({ name: func['name'], $id: func['$id'], deployment: response['$id'] });
484+
updaterRow.fail({ errorMessage: `Failed to deploy` });
483485

484486
break;
485487
} else {
@@ -498,6 +500,14 @@ const pushFunction = async ({ functionId, all, yes } = {}) => {
498500
}));
499501

500502
Spinner.stop();
503+
console.log('\n');
504+
505+
failedDeployments.forEach((failed) => {
506+
const { name, deployment, $id } = failed;
507+
const failUrl = `${globalConfig.getEndpoint().replace('/v1', '')}/console/project-${localConfig.getProject().projectId}/functions/function-${$id}/deployment-${deployment}`;
508+
509+
error(`Deployment of ${name} has failed. Check at ${failUrl} for more details\n`);
510+
})
501511

502512
success(`Pushed ${successfullyPushed} functions with ${successfullyDeployed} successfully deployed`);
503513
}

0 commit comments

Comments
 (0)