From 3a5e36768ea91890da55f1f5c3e488c5a521e15f Mon Sep 17 00:00:00 2001 From: joshirohit100 Date: Mon, 2 Sep 2024 19:50:23 +0530 Subject: [PATCH] Adding push.artifact.destination_git_urls. acquia cli config. --- src/Command/Push/PushArtifactCommand.php | 4 ++-- src/Config/AcquiaCliConfig.php | 18 ++++++++++++++---- .../Commands/Push/PushArtifactCommandTest.php | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/Command/Push/PushArtifactCommand.php b/src/Command/Push/PushArtifactCommand.php index 0c7d65e8b..8c935737f 100644 --- a/src/Command/Push/PushArtifactCommand.php +++ b/src/Command/Push/PushArtifactCommand.php @@ -160,8 +160,8 @@ private function determineDestinationGitUrls(?string $applicationUuid): array if ($envVar = getenv('ACLI_PUSH_ARTIFACT_DESTINATION_GIT_URLS')) { return explode(',', $envVar); } - if ($this->datastoreAcli->get('push.artifact.destination-git-urls')) { - return $this->datastoreAcli->get('push.artifact.destination-git-urls'); + if ($this->datastoreAcli->get('push.artifact.destination_git_urls')) { + return $this->datastoreAcli->get('push.artifact.destination_git_urls'); } return [$this->getAnyVcsUrl($applicationUuid)]; diff --git a/src/Config/AcquiaCliConfig.php b/src/Config/AcquiaCliConfig.php index 7d0f6c3c2..8124fcb0e 100644 --- a/src/Config/AcquiaCliConfig.php +++ b/src/Config/AcquiaCliConfig.php @@ -19,10 +19,20 @@ public function getConfigTreeBuilder(): TreeBuilder $treeBuilder = new TreeBuilder('acquia_cli'); $treeBuilder ->getRootNode() - ->children() - ->scalarNode('cloud_app_uuid') - ->end() - ->end(); + ->children() + ->scalarNode('cloud_app_uuid')->end() + ->arrayNode('push') + ->children() + ->arrayNode('artifact') + ->children() + ->arrayNode('destination_git_urls') + ->scalarPrototype()->end() + ->end() + ->end() + ->end() + ->end() + ->end() + ->end(); return $treeBuilder; } } diff --git a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php index 1b5bf8aa9..ce4e9c118 100644 --- a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php @@ -125,12 +125,12 @@ public function testPushArtifactWithAcquiaCliFile(): void $applications = $this->mockRequest('getApplications'); $this->mockRequest('getApplicationByUuid', $applications[0]->uuid); $this->mockRequest('getApplicationEnvironments', $applications[0]->uuid); - $this->datastoreAcli->set('push.artifact.destination-git-urls', [ + $this->datastoreAcli->set('push.artifact.destination_git_urls', [ 'https://github.com/example1/cli.git', 'https://github.com/example2/cli.git', ]); $localMachineHelper = $this->mockLocalMachineHelper(); - $this->setUpPushArtifact($localMachineHelper, 'master', $this->datastoreAcli->get('push.artifact.destination-git-urls')); + $this->setUpPushArtifact($localMachineHelper, 'master', $this->datastoreAcli->get('push.artifact.destination_git_urls')); $this->executeCommand([ '--destination-git-branch' => 'master', ]);