Skip to content

Commit c48557a

Browse files
committed
Mark the deployment as failed when the failure happens in the CLI
1 parent b399ba2 commit c48557a

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/Commands/Deploy.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\Console\Question\ChoiceQuestion;
2424
use Symfony\Component\HttpClient\HttpClient;
2525
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
26+
use Throwable;
2627
use ZipArchive;
2728
use function Amp\async;
2829
use function Amp\ByteStream\buffer;
@@ -126,16 +127,21 @@ protected function execute(InputInterface $input, OutputInterface $output): int
126127
IO::spin('deploying');
127128
(new ServerlessFramework())->deploy($deploymentId, $environment, $credentials, $brefCloud, $input);
128129
} else {
129-
// Upload artifacts
130-
if (isset($deployment['packageUrls'])) {
131-
$brefCloud->pushDeploymentLogs($deploymentId, 'Packaging and uploading artifacts');
130+
try {
131+
// Upload artifacts
132+
if (isset($deployment['packageUrls'])) {
133+
$brefCloud->pushDeploymentLogs($deploymentId, 'Packaging and uploading artifacts');
132134

133-
$this->uploadArtifacts($config, $deployment['packageUrls']);
134-
}
135+
$this->uploadArtifacts($config, $deployment['packageUrls']);
136+
}
135137

136-
// Start the deployment now that the artifacts are uploaded
137-
IO::spin('deploying');
138-
$brefCloud->startDeployment($deploymentId);
138+
// Start the deployment now that the artifacts are uploaded
139+
IO::spin('deploying');
140+
$brefCloud->startDeployment($deploymentId);
141+
} catch (Throwable $e) {
142+
$brefCloud->markDeploymentFinished($deploymentId, false, 'Error: ' . $e->getMessage(), '');
143+
throw $e;
144+
}
139145
}
140146

141147
$startTime = time();

0 commit comments

Comments
 (0)