Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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/Command/CodeStudio/CodeStudioCiCdVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static function getList(): array
/**
* @return array<mixed>
*/
public static function getDefaultsForNode(?string $cloudApplicationUuid = null, ?string $cloudKey = null, ?string $cloudSecret = null, ?string $projectAccessTokenName = null, ?string $projectAccessToken = null, ?string $nodeVersion = null, ?string $nodeHosting = null): array
public static function getDefaultsForNode(?string $cloudApplicationUuid = null, ?string $cloudKey = null, ?string $cloudSecret = null, ?string $projectAccessTokenName = null, ?string $projectAccessToken = null, ?string $nodeVersion = null, ?string $nodeHostingType = null): array
{
return [
[
Expand Down Expand Up @@ -67,7 +67,7 @@ public static function getDefaultsForNode(?string $cloudApplicationUuid = null,
'key' => 'NODE_HOSTING_TYPE',
'masked' => false,
'protected' => false,
'value' => $nodeHosting,
'value' => $nodeHostingType,
'variable_type' => 'env_var',
],
];
Expand Down
14 changes: 10 additions & 4 deletions src/Command/CodeStudio/CodeStudioWizardCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->reAuthenticate($cloudKey, $cloudSecret, $this->cloudCredentials->getBaseUri(), $this->cloudCredentials->getAccountsUri());
$phpVersion = null;
$nodeVersion = null;
$nodeHostingType = null;
$projectType = $this->getListOfProjectType();
$projectSelected = $this->io->choice('Select a project type', $projectType, "Drupal_project");
$nodeHosting = "basic";

switch ($projectSelected) {
case "Drupal_project":
Expand All @@ -63,6 +63,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$phpVersion = $phpVersions[$project];
break;
case "Node_project":
$nodeHostingTypes = [
'advanced' => "Advanced Frontend Hosting",
'basic' => "Basic Frontend Hosting",
];
$project = $this->io->choice('Select a NODE hosting type', array_values($nodeHostingTypes), "Basic Frontend Hosting");
$nodeHostingType = array_search($project, $nodeHostingTypes, true);
$nodeVersions = [
'NODE_version_18' => "18",
'NODE_version_20' => "20",
Expand Down Expand Up @@ -131,7 +137,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
];
$client = $this->getGitLabClient();
$client->projects()->update($project['id'], $parameters);
$this->setGitLabCiCdVariablesForNodeProject($project, $appUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion, $nodeHosting);
$this->setGitLabCiCdVariablesForNodeProject($project, $appUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion, $nodeHostingType);
break;
}

Expand Down Expand Up @@ -244,10 +250,10 @@ private function setGitLabCiCdVariablesForPhpProject(array $project, string $clo
}
}

private function setGitLabCiCdVariablesForNodeProject(array $project, string $cloudApplicationUuid, string $cloudKey, string $cloudSecret, string $projectAccessTokenName, string $projectAccessToken, string $nodeVersion, string $nodeHosting): void
private function setGitLabCiCdVariablesForNodeProject(array $project, string $cloudApplicationUuid, string $cloudKey, string $cloudSecret, string $projectAccessTokenName, string $projectAccessToken, string $nodeVersion, string $nodeHostingType): void
{
$this->io->writeln("Setting GitLab CI/CD variables for {$project['path_with_namespace']}..");
$gitlabCicdVariables = CodeStudioCiCdVariables::getDefaultsForNode($cloudApplicationUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion, $nodeHosting);
$gitlabCicdVariables = CodeStudioCiCdVariables::getDefaultsForNode($cloudApplicationUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion, $nodeHostingType);
$gitlabCicdExistingVariables = $this->gitLabClient->projects()
->variables($project['id']);
$gitlabCicdExistingVariablesKeyed = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,52 @@ public static function providerTestCommand(): array
[
// Select a project type Node_project.
'1',
// Select NODE hosting type advanced.
'0',
// Select NODE version 18.
'0',
// Do you want to continue?
'y',
// Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]:
'y',
],
// Args.
[
'--key' => self::$key,
'--secret' => self::$secret,
],
],
[
// No projects.
[],
// Inputs.
[
// Select a project type Node_project.
'1',
// Select NODE hosting type advanced.
'0',
// Select NODE version 20.
'1',
// Do you want to continue?
'y',
// Would you like to perform a one time push of code from Acquia Cloud to Code Studio now? (yes/no) [yes]:
'y',
],
// Args.
[
'--key' => self::$key,
'--secret' => self::$secret,
],
],
[
// No projects.
[],
// Inputs.
[
// Select a project type Node_project.
'1',
// Select NODE hosting type basic.
'1',
// Select NODE version 18.
'0',
// Do you want to continue?
Expand All @@ -213,6 +259,8 @@ public static function providerTestCommand(): array
[
// Select a project type Node_project.
'1',
// Select NODE hosting type basic.
'1',
// Select NODE version 20.
'1',
// Do you want to continue?
Expand Down Expand Up @@ -296,6 +344,8 @@ public static function providerTestCommand(): array
self::$secret,
// Select a project type Node_project.
'1',
// Select NODE hosting type basic.
'1',
// Select NODE version 18.
'0',
// Do you want to continue?
Expand Down Expand Up @@ -334,6 +384,8 @@ public static function providerTestCommand(): array
self::$secret,
// Select a project type Node_project.
'1',
// Select NODE hosting type basic.
'1',
// Select NODE version 20.
'1',
// Do you want to continue?
Expand Down
Loading