Skip to content

Commit

Permalink
[1.x] Adds option to enable debug mode on deploy (#221)
Browse files Browse the repository at this point in the history
* add debug option

* revert changes to redeploy

* remove default

* update debug option
  • Loading branch information
joedixon authored May 10, 2023
1 parent 562c280 commit 9a28dc6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 22 additions & 1 deletion src/Commands/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected function configure()
->addOption('without-waiting', null, InputOption::VALUE_NONE, 'Deploy without waiting for progress')
->addOption('fresh-assets', null, InputOption::VALUE_NONE, 'Upload a fresh copy of all assets')
->addOption('build-arg', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Docker build argument')
->addOption('debug', null, InputOption::VALUE_OPTIONAL, 'Deploy with debug mode enabled', 'unset')
->setDescription('Deploy an environment');
}

Expand All @@ -60,7 +61,8 @@ public function handle()

$deployment = $this->handleCancellations($this->vapor->deploy(
$artifact['id'],
Manifest::current()
Manifest::current(),
$this->debugMode()
));

if ($this->option('without-waiting')) {
Expand Down Expand Up @@ -325,4 +327,23 @@ protected function getCoreVersion()

return ltrim($version, 'v');
}

/**
* Get the debug mode setting for the deployment.
*
* @return bool|null
*/
protected function debugMode()
{
switch ($this->option('debug')) {
case 'true':
return true;
case 'false':
return false;
case 'unset':
return null;
default:
return true;
}
}
}
4 changes: 3 additions & 1 deletion src/ConsoleVaporClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1132,12 +1132,14 @@ public function validateManifest($projectId, $environment, array $manifest, $cli
*
* @param int $artifactId
* @param array $manifest
* @param bool|null $debugMode
* @return array
*/
public function deploy($artifactId, array $manifest)
public function deploy($artifactId, array $manifest, $debugMode)
{
return $this->requestWithErrorHandling('post', '/api/artifacts/'.$artifactId.'/deployments', [
'manifest' => $manifest,
'debug_mode' => $debugMode,
]);
}

Expand Down

0 comments on commit 9a28dc6

Please sign in to comment.