Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Commands/Deploy.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createDeployment has no region parameter

} else {
IO::spinError();
throw $e;
Expand Down Expand Up @@ -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];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gitMessage comes from the previous explode(), so it is always a string

IO::verbose(sprintf(
'Git commit message: "%s%s"',
substr($gitMessageLog, 0, 80),
Expand Down
11 changes: 7 additions & 4 deletions src/Components/ServerlessFramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,26 @@ 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);
Comment on lines -188 to +189
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there were 3 $matches!!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I think this happened after a refactor the code makes no sense indeed

if ($outputsResults && $stackResults && $regionResults) {
try {
$stackOutputs = Yaml::parse($matches[1]);
if (! is_array($stackOutputs)) {
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,
Expand Down