Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] Updates deployment output #238

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions src/Commands/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ protected function uploadArtifact($environment, $uuid)
Manifest::id(),
$uuid,
$environment,
Manifest::regions($environment),
Manifest::usesContainerImage($environment) ? null : Path::artifact(),
$this->option('commit') ?: Git::hash(),
$this->option('message') ?: Git::message(),
Expand Down
14 changes: 10 additions & 4 deletions src/Commands/Output/DeploymentSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ protected function displayDnsRecordsChanges(Deployment $deployment)
Helpers::line();
}

$records = collect($deployment->regions)->map(function ($region) {
return collect($region['pivot']['target_domains'])->map(function ($target, $domain) use ($region) {
return [$region['region'], $domain, $target['domain']];
})->values();
})->flatten(1)->merge(collect($deployment->target_domains)->map(function ($target, $domain) use ($deployment) {
return [$deployment->project['region'], $domain, $target['domain']];
})->values());

Helpers::table([
'Domain', 'Alias / CNAME',
], collect($deployment->target_domains)->map(function ($target, $domain) {
return [$domain, $target['domain']];
})->all());
'Region', 'Domain', 'Alias / CNAME',
], $records->all());

$vapor = Helpers::app(ConsoleVaporClient::class);

Expand Down
3 changes: 3 additions & 0 deletions src/ConsoleVaporClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ public function deleteSecret($secretId)
* @param int $projectId
* @param string $uuid
* @param string $environment
* @param array<int, string> $regions
* @param string $file
* @param string $commit
* @param string $commitMessage
Expand All @@ -1014,6 +1015,7 @@ public function createArtifact(
$projectId,
$uuid,
$environment,
$regions,
$file = null,
$commit = null,
$commitMessage = null,
Expand All @@ -1029,6 +1031,7 @@ public function createArtifact(
'cli_version' => $cliVersion,
'core_version' => $coreVersion,
'uses_container_image' => is_null($file),
'regions' => $regions,
]);

if ($file) {
Expand Down
13 changes: 13 additions & 0 deletions src/Manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ public static function name()
return static::current()['name'];
}

/**
* Get the regions from the current directory's manifest.
*
* @param string $environment
* @return array<int, string>
*/
public static function regions($environment)
{
return array_key_exists('regions', static::current()['environments'][$environment])
? static::current()['environments'][$environment]['regions']
: [];
}

/**
* Retrieve the manifest for the current working directory.
*
Expand Down