From f4fa8e7d26789fb3a5d57cb14aad1bddfe4a9e11 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Mon, 9 Sep 2024 09:14:26 -0500 Subject: [PATCH 1/3] CLI-1377 Delay API lookup of application by ID (#1781) * CLI-1377 Delay API lookup of application by ID * move api call * fix phpcs and remove ignored mocks * remove mocks from testPushArtifactWithArgs * remove mocks from testCloudAppFromLocalConfig * put back getApplicationIdes mock --------- Co-authored-by: Dane Powell --- src/Command/CommandBase.php | 3 ++- src/Command/Push/PushArtifactCommand.php | 7 ++++--- tests/phpunit/src/Commands/CommandBaseTest.php | 1 - .../phpunit/src/Commands/Push/PushArtifactCommandTest.php | 6 ------ 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/Command/CommandBase.php b/src/Command/CommandBase.php index 2f4be8628..609d82df3 100644 --- a/src/Command/CommandBase.php +++ b/src/Command/CommandBase.php @@ -878,12 +878,13 @@ protected function determineCloudApplication(bool $promptLinkApp = false): ?stri throw new AcquiaCliException("Could not determine Cloud Application. Run this command interactively or use `acli link` to link a Cloud Application before running non-interactively."); } - $application = $this->getCloudApplication($applicationUuid); // No point in trying to link a directory that's not a repo. if (!empty($this->projectDir) && !$this->getCloudUuidFromDatastore()) { if ($promptLinkApp) { + $application = $this->getCloudApplication($applicationUuid); $this->saveCloudUuidToDatastore($application); } elseif (!AcquiaDrupalEnvironmentDetector::isAhIdeEnv() && !$this->getCloudApplicationUuidFromBltYaml()) { + $application = $this->getCloudApplication($applicationUuid); $this->promptLinkApplication($application); } } diff --git a/src/Command/Push/PushArtifactCommand.php b/src/Command/Push/PushArtifactCommand.php index 96e03397b..90e6b0af6 100644 --- a/src/Command/Push/PushArtifactCommand.php +++ b/src/Command/Push/PushArtifactCommand.php @@ -95,8 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $destinationGitUrls = []; $destinationGitRef = ''; if (!$input->getOption('no-clone')) { - $applicationUuid = $this->determineCloudApplication(); - $destinationGitUrls = $this->determineDestinationGitUrls($applicationUuid); + $destinationGitUrls = $this->determineDestinationGitUrls(); $destinationGitRef = $this->determineDestinationGitRef(); $sourceGitBranch = $this->determineSourceGitRef(); $destinationGitUrlsString = implode(',', $destinationGitUrls); @@ -153,7 +152,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int /** * @return string[] */ - private function determineDestinationGitUrls(?string $applicationUuid): array + private function determineDestinationGitUrls(): array { if ($this->input->getOption('destination-git-urls')) { return $this->input->getOption('destination-git-urls'); @@ -161,10 +160,12 @@ 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'); } + $applicationUuid = $this->determineCloudApplication(); return [$this->getAnyVcsUrl($applicationUuid)]; } diff --git a/tests/phpunit/src/Commands/CommandBaseTest.php b/tests/phpunit/src/Commands/CommandBaseTest.php index 6fa9b3201..7073b3ea7 100644 --- a/tests/phpunit/src/Commands/CommandBaseTest.php +++ b/tests/phpunit/src/Commands/CommandBaseTest.php @@ -42,7 +42,6 @@ public function testUnauthenticatedFailure(): void public function testCloudAppFromLocalConfig(): void { $this->command = $this->injectCommand(IdeListCommand::class); - $this->mockRequest('getApplicationByUuid', 'a47ac10b-58cc-4372-a567-0e02b2c3d470'); $this->mockRequest('getApplicationIdes', 'a47ac10b-58cc-4372-a567-0e02b2c3d470'); $this->createMockAcliConfigFile('a47ac10b-58cc-4372-a567-0e02b2c3d470'); $this->executeCommand(); diff --git a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php index 1b5bf8aa9..f32bc7e69 100644 --- a/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php +++ b/tests/phpunit/src/Commands/Push/PushArtifactCommandTest.php @@ -122,9 +122,6 @@ public function testPushTagArtifact(): void 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', [ 'https://github.com/example1/cli.git', 'https://github.com/example2/cli.git', @@ -143,9 +140,6 @@ public function testPushArtifactWithAcquiaCliFile(): void public function testPushArtifactWithArgs(): void { - $applications = $this->mockRequest('getApplications'); - $this->mockRequest('getApplicationByUuid', $applications[0]->uuid); - $this->mockRequest('getApplicationEnvironments', $applications[0]->uuid); $destinationGitUrls = [ 'https://github.com/example1/cli.git', 'https://github.com/example2/cli.git', From 860af85996f5a67fbb54fb5ea64ed1341a8b05a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:30:13 +0000 Subject: [PATCH 2/3] Bump the dependencies group with 3 updates (#1791) Bumps the dependencies group with 3 updates: [phpstan/extension-installer](https://github.com/phpstan/extension-installer), [phpstan/phpstan](https://github.com/phpstan/phpstan) and [twig/twig](https://github.com/twigphp/Twig). Updates `phpstan/extension-installer` from 1.4.2 to 1.4.3 - [Release notes](https://github.com/phpstan/extension-installer/releases) - [Commits](https://github.com/phpstan/extension-installer/compare/1.4.2...1.4.3) Updates `phpstan/phpstan` from 1.12.0 to 1.12.3 - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.0.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.12.0...1.12.3) Updates `twig/twig` from 3.12.0 to 3.13.0 - [Changelog](https://github.com/twigphp/Twig/blob/3.x/CHANGELOG) - [Commits](https://github.com/twigphp/Twig/compare/v3.12.0...v3.13.0) --- updated-dependencies: - dependency-name: phpstan/extension-installer dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: twig/twig dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.lock | 78 +++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/composer.lock b/composer.lock index 2d3b4b178..5a7bbf697 100644 --- a/composer.lock +++ b/composer.lock @@ -4988,20 +4988,20 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -5047,7 +5047,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -5063,7 +5063,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -5226,20 +5226,20 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -5286,7 +5286,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -5302,7 +5302,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", @@ -10549,22 +10549,22 @@ }, { "name": "phpstan/extension-installer", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/phpstan/extension-installer.git", - "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd" + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/46c8219b3fb0deb3fc08301e8f0797d321d17dcd", - "reference": "46c8219b3fb0deb3fc08301e8f0797d321d17dcd", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", "shasum": "" }, "require": { "composer-plugin-api": "^2.0", "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.9.0" + "phpstan/phpstan": "^1.9.0 || ^2.0" }, "require-dev": { "composer/composer": "^2.0", @@ -10591,9 +10591,9 @@ ], "support": { "issues": "https://github.com/phpstan/extension-installer/issues", - "source": "https://github.com/phpstan/extension-installer/tree/1.4.2" + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" }, - "time": "2024-08-26T07:38:00+00:00" + "time": "2024-09-04T20:21:43+00:00" }, { "name": "phpstan/phpdoc-parser", @@ -10644,16 +10644,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.0", + "version": "1.12.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "384af967d35b2162f69526c7276acadce534d0e1" + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/384af967d35b2162f69526c7276acadce534d0e1", - "reference": "384af967d35b2162f69526c7276acadce534d0e1", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", + "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", "shasum": "" }, "require": { @@ -10698,7 +10698,7 @@ "type": "github" } ], - "time": "2024-08-27T09:18:05+00:00" + "time": "2024-09-09T08:10:35+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -12970,20 +12970,20 @@ }, { "name": "symfony/polyfill-php81", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", - "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -13026,7 +13026,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -13042,7 +13042,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "theseer/tokenizer", @@ -13096,16 +13096,16 @@ }, { "name": "twig/twig", - "version": "v3.12.0", + "version": "v3.13.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea" + "reference": "afc0eb63dc66c248c5a94504dc2b255bc9b86575" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea", - "reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/afc0eb63dc66c248c5a94504dc2b255bc9b86575", + "reference": "afc0eb63dc66c248c5a94504dc2b255bc9b86575", "shasum": "" }, "require": { @@ -13159,7 +13159,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.12.0" + "source": "https://github.com/twigphp/Twig/tree/v3.13.0" }, "funding": [ { @@ -13171,7 +13171,7 @@ "type": "tidelift" } ], - "time": "2024-08-29T09:51:12+00:00" + "time": "2024-09-07T08:01:12+00:00" }, { "name": "webmozart/assert", From 04b8ee7d1a8a5aab796fb0b1d96992ee777cbb8b Mon Sep 17 00:00:00 2001 From: Dane Powell Date: Mon, 9 Sep 2024 11:56:52 -0700 Subject: [PATCH 3/3] CLI-1378: Multiple push:artifact remotes (#1793) --- src/Command/Push/PushArtifactCommand.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Command/Push/PushArtifactCommand.php b/src/Command/Push/PushArtifactCommand.php index 90e6b0af6..d31413e33 100644 --- a/src/Command/Push/PushArtifactCommand.php +++ b/src/Command/Push/PushArtifactCommand.php @@ -50,7 +50,7 @@ protected function configure(): void ->addOption('no-push', null, InputOption::VALUE_NONE, 'Do not push changes to Acquia Cloud') ->addOption('no-commit', null, InputOption::VALUE_NONE, 'Do not commit changes. Implies no-push') ->addOption('no-clone', null, InputOption::VALUE_NONE, 'Do not clone repository. Implies no-commit and no-push') - ->addOption('destination-git-urls', 'u', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'The URL(s) of your git repository to which the artifact branch will be pushed') + ->addOption('destination-git-urls', 'u', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'The URL of your git repository to which the artifact branch will be pushed. Use multiple times for multiple URLs.') ->addOption('destination-git-branch', 'b', InputOption::VALUE_REQUIRED, 'The destination branch to push the artifact to') ->addOption('destination-git-tag', 't', InputOption::VALUE_REQUIRED, 'The destination tag to push the artifact to. Using this option requires also using the --source-git-tag option') ->addOption('source-git-tag', 's', InputOption::VALUE_REQUIRED, 'The source tag from which to create the tag artifact') @@ -60,7 +60,6 @@ protected function configure(): void . 'To run additional build or sanitization steps (e.g. npm install), add a post-install-cmd script to your composer.json file: https://getcomposer.org/doc/articles/scripts.md#command-events') ->addUsage('--destination-git-branch=main-build') ->addUsage('--source-git-tag=foo-build --destination-git-tag=1.0.0') - ->addUsage('--destination-git-urls=example@svn-1.prod.hosting.acquia.com:example.git --destination-git-branch=main-build') ->addUsage('--destination-git-urls=example@svn-1.prod.hosting.acquia.com:example.git --destination-git-urls=example@svn-2.prod.hosting.acquia.com:example.git --destination-git-branch=main-build'); }