diff --git a/src/Commands/Deploy.php b/src/Commands/Deploy.php index 6671c6e..626a5d8 100644 --- a/src/Commands/Deploy.php +++ b/src/Commands/Deploy.php @@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $region = $this->selectAwsRegion(); IO::spin('deploying'); $config['region'] = $region; - $deployment = $brefCloud->createDeployment($environment, $config, $gitRef, $gitMessage, $awsAccountName, $region); + $deployment = $brefCloud->createDeployment($environment, $config, $gitRef, $gitMessage, $awsAccountName); } else { IO::spinError(); throw $e; @@ -253,7 +253,7 @@ private function getGitDetails(): array $gitMessage = explode("\n", $gitMessage)[0]; IO::verbose('Git ref: ' . $gitRef); - $gitMessageLog = explode("\n", $gitMessage)[0] ?? ''; + $gitMessageLog = explode("\n", $gitMessage)[0]; IO::verbose(sprintf( 'Git commit message: "%s%s"', substr($gitMessageLog, 0, 80), diff --git a/src/Components/ServerlessFramework.php b/src/Components/ServerlessFramework.php index 9a1ed7d..abb01ca 100644 --- a/src/Components/ServerlessFramework.php +++ b/src/Components/ServerlessFramework.php @@ -185,8 +185,8 @@ private function retrieveOutputs(string $environment, array $awsCredentials, ?st // If plugins add extra output afterward, it should be ignored. $outputsResults = preg_match('/Stack Outputs:\n(( {2}[ \S]+\n)+)/', $infoOutput, $matches); // Also try to extract the stack name and region - $stackResults = preg_match('/stack: (.*)\n/', $infoOutput, $matches); - $regionResults = preg_match('/region: (.*)\n/', $infoOutput, $matches); + $stackResults = preg_match('/stack: (.*)\n/', $infoOutput, $stackMatches); + $regionResults = preg_match('/region: (.*)\n/', $infoOutput, $regionMatches); if ($outputsResults && $stackResults && $regionResults) { try { $stackOutputs = Yaml::parse($matches[1]); @@ -194,14 +194,17 @@ private function retrieveOutputs(string $environment, array $awsCredentials, ?st throw new Exception('Invalid stack outputs in the "serverless info" output'); } $stackOutputs = $this->cleanupCfOutputs($stackOutputs); - $stackName = $matches[2]; + + $stackName = $stackMatches[1]; if (! is_string($stackName)) { throw new Exception('Invalid stack name in the "serverless info" output'); } - $region = $matches[3]; + + $region = $regionMatches[1]; if (! is_string($region)) { throw new Exception('Invalid region in the "serverless info" output'); } + return array_merge([ 'stack' => $stackName, 'region' => $region,