diff --git a/src/Command/CodeStudio/CodeStudioCiCdVariables.php b/src/Command/CodeStudio/CodeStudioCiCdVariables.php index 3b91e40f0..4d9102cc9 100644 --- a/src/Command/CodeStudio/CodeStudioCiCdVariables.php +++ b/src/Command/CodeStudio/CodeStudioCiCdVariables.php @@ -18,7 +18,7 @@ public static function getList(): array /** * @return array */ - public static function getDefaultsForNode(?string $cloudApplicationUuid = null, ?string $cloudKey = null, ?string $cloudSecret = null, ?string $projectAccessTokenName = null, ?string $projectAccessToken = null, ?string $nodeVersion = 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 $nodeHosting = null): array { return [ [ @@ -63,6 +63,13 @@ public static function getDefaultsForNode(?string $cloudApplicationUuid = null, 'value' => $nodeVersion, 'variable_type' => 'env_var', ], + [ + 'key' => 'NODE_HOSTING_TYPE', + 'masked' => false, + 'protected' => false, + 'value' => $nodeHosting, + 'variable_type' => 'env_var', + ], ]; } diff --git a/src/Command/CodeStudio/CodeStudioWizardCommand.php b/src/Command/CodeStudio/CodeStudioWizardCommand.php index 192781621..2016905e4 100644 --- a/src/Command/CodeStudio/CodeStudioWizardCommand.php +++ b/src/Command/CodeStudio/CodeStudioWizardCommand.php @@ -48,6 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $nodeVersion = null; $projectType = $this->getListOfProjectType(); $projectSelected = $this->io->choice('Select a project type', $projectType, "Drupal_project"); + $nodeHosting = "basic"; switch ($projectSelected) { case "Drupal_project": @@ -128,7 +129,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); + $this->setGitLabCiCdVariablesForNodeProject($project, $appUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion, $nodeHosting); break; } @@ -241,10 +242,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): void + private function setGitLabCiCdVariablesForNodeProject(array $project, string $cloudApplicationUuid, string $cloudKey, string $cloudSecret, string $projectAccessTokenName, string $projectAccessToken, string $nodeVersion, string $nodeHosting): void { $this->io->writeln("Setting GitLab CI/CD variables for {$project['path_with_namespace']}.."); - $gitlabCicdVariables = CodeStudioCiCdVariables::getDefaultsForNode($cloudApplicationUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion); + $gitlabCicdVariables = CodeStudioCiCdVariables::getDefaultsForNode($cloudApplicationUuid, $cloudKey, $cloudSecret, $projectAccessTokenName, $projectAccessToken, $nodeVersion, $nodeHosting); $gitlabCicdExistingVariables = $this->gitLabClient->projects() ->variables($project['id']); $gitlabCicdExistingVariablesKeyed = []; diff --git a/tests/phpunit/src/Commands/CodeStudio/CodeStudioCiCdVariablesTest.php b/tests/phpunit/src/Commands/CodeStudio/CodeStudioCiCdVariablesTest.php index 917bdc4f2..19757d173 100644 --- a/tests/phpunit/src/Commands/CodeStudio/CodeStudioCiCdVariablesTest.php +++ b/tests/phpunit/src/Commands/CodeStudio/CodeStudioCiCdVariablesTest.php @@ -21,7 +21,7 @@ public function testGetDefaultsForNode(): void protected function testBooleanValues(array $variables): void { foreach ($variables as $variable) { - if ($variable['key'] !== "PHP_VERSION" && $variable['key'] !== "NODE_VERSION") { + if ($variable['key'] !== "PHP_VERSION" && $variable['key'] !== "NODE_VERSION" && $variable['key'] !== "NODE_HOSTING_TYPE") { $maskedValue = $variable['masked']; $this->assertEquals(true, $maskedValue); } else {