acquia / cli Goto Github PK
View Code? Open in Web Editor NEWCommand-line interface for Acquia Cloud Platform products
Home Page: https://docs.acquia.com/acquia-cli/
License: GNU General Public License v2.0
Command-line interface for Acquia Cloud Platform products
Home Page: https://docs.acquia.com/acquia-cli/
License: GNU General Public License v2.0
ACLI Version : v1.0.0-rc4
It looks to me like the columns for Environment Alias and Application are reversed in the output of remote:aliases:list
. As you can see below the environment aliases appear under the Application column, and vice versa.
% acli remote:aliases:list
Please select an Acquia Cloud application:
...
[1 ] Barrett Smith (Employee Free)
...
> 1
Would you like to link the Cloud application Barrett Smith (Employee Free) to this repository? no
+-------------------------------+---------------+-------------------------------------------+
| Environment Alias | Application | Environment UUID |
+-------------------------------+---------------+-------------------------------------------+
| Barrett Smith (Employee Free) | eebsmith.dev | 5261-redact-5e |
| Barrett Smith (Employee Free) | eebsmith.prod | 5259-redact-5e |
| Barrett Smith (Employee Free) | eebsmith.test | 5260--redact-5e |
+-------------------------------+---------------+-------------------------------------------+
We should support PHP versions defined in composer.json, ensure symfony.lock doesn't interfere with this.
Attempting to run ide:wizard:ssh-key:create-upload
will throw an error:
In IdeWizardCreateSshKeyCommand.php line 126:
Unable to add SSH key to local SSH agent:ssh_askpass: exec(phar:///usr/local/bin/acli/src/Command/Ide/Wizard/passphrase_prompt.sh)
: No such file or directory
We thought we fixed this by including the shell script in the phar, but I confirmed it's there and we still get the error.
I think the problem is that there's simply no way to run a shell script packaged inside a phar, without doing some gymnastics: https://stackoverflow.com/questions/41710814/execute-helper-script-inside-of-phar
We could probably improve the message when no IDE exists. Currently we only have the string "IDEs"
acli ide:list
Please select an Acquia Cloud application:
[0] testapp
> 1
Would you like to link the Cloud application testapp to this repository? n
======
IDEs
======
We should probably have something like this:
"No IDE exists for this application. Would you like to create one?" => and upon answering "yes" it would run acli ide:create
Fixes from #120 are looking great, just having a minor issue when attempting to clear multiple domains cache at once.
Current master version used:
~/Sites/devops/acquia/cli master git log --pretty=oneline --abbrev-commit
a7e8837 (HEAD -> master, origin/master, origin/HEAD) Fixes #120: Keeping case intact. (#126)
[..snip..]
Purging a single domain, works fine:
/Users/lnunes/Sites/devops/acquia/cli/bin/acli api:environments:domains-clear-varnish 2695-2cbf4649-*REDACTED* --domains='domain.com'
{
"message": "Varnish is being cleared for the selected domains.",
"_links": {
"self": {
"href": "https:\/\/cloud.acquia.com\/api\/environments\/2695-XXXXXXXXX\/domains\/actions\/clear-varnish"
},
"notification": {
"href": "https:\/\/cloud.acquia.com\/api\/notifications\/862b5f5b-XXXXXXX"
}
}
}
Multiple domains (comma separated), it fails:
/Users/lnunes/Sites/devops/acquia/cli/bin/acli api:environments:domains-clear-varnish 2695-2cbf4649-*REDACTED* --domains='domain.com,domain2.com'
In Client.php line 110:
The domain 'domain.com,domain2.com' does not appear to be a valid domain name.
api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>
Tried some other variations like (with and without quote marks):
--domains='domain.com, domain2.com'
--domains='domain.com domain2.com'
But didnt work as well.
Report from a user installing RC4. User is forbidden write access to /usr/local/bin
.
$ mv acli /Users/myyser/Development/Acquia/
$ export PATH=/Users/myuser/Development/Acquia
$ acli auth:login
Fatal error: Uncaught RuntimeException: Unable to write in the "cache" directory (phar:///Users/myuser/Development/Acquia/acli/var/cache/prod). in phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php:626
Stack trace:
#0 phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php(532): Symfony\Component\HttpKernel\Kernel->buildContainer()
#1 phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php(131): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#2 phar:///Users/myuser/Development/Acquia/acli/bin/acli(75): Symfony\Component\HttpKernel\Kernel->boot()
#3 /Users/myuser/Development/Acquia/acli(12): require('phar:///Users/g...')
#4 {main}
thrown in phar:///Users/myuser/Development/Acquia/acli/vendor/symfony/http-kernel/Kernel.php on line 626
Doing this means we won't be able to test the command in IDEs to toggle Xdebug or change PHP versions because it'll require we're authenticated, which is not needed.
In tmp directory. See if the core cache:clear already does this, and what else we can crib from it including cache warming.
Currently, acli refresh
can be run from anywhere in an IDE, but the command will fail when it's not in the project
directory.
ide:~$ acli refresh
Could not find a local Drupal project. Looked for docroot/index.php in current and parent directories.
Would you like to clone a project into the current directory?y
Would you like to link the Cloud application anavarred8 to this repository? n
Using Cloud Application anavarred8
Choose an Acquia Cloud environment to copy from:
[0] Dev (vcs: pipelines-build-master)
[1] pipelines-build-ads-integration (vcs: pipelines-build-ads-integration)
[2] Stage (vcs: tags/progress)
> 2
⌛ Cloning git repository from Acquia Cloud...
fatal: destination path '.' already exists and is not an empty directory.
In RefreshCommand.php line 576:
Failed to clone repository from Acquia Cloud:
refresh [-from|--cloud-env-uuid CLOUD-ENV-UUID] [--no-code] [--no-files] [--no-databases] [--no-scripts] [--scripts] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>
Since only the project
directory can serve a site, we should likely remove any confusion and tell the user they need to change directory and run the command again. We can rely on the environment detector for this.
See
The reality in IDEs is we only create this file when we want to switch to a different PHP version than the default. See https://docs.acquia.com/dev-studio/ide/#configuring-the-php-version
So what needs to happen here is we need to create the file if it doesn't exist, and populate it with the expected PHP version we're switching to.
User feedback related to DNS propagation
Perhaps we should be providing additional feedback on creating an IDE via the acli tool. I just started using acli (in place of ads) and hit the same issue, but acli doesn't even give the impression of a successful IDE creation (upon a time out).
If I hadn't hit the same issue previously, I'd have assumed the process had failed completely and attempted to create another IDE. See from the details I provided in the description in this ticket, at least the ads tool provided links along with the time out message, so I could verify the IDE creation.
$ acli ide:create
Please select an Acquia Cloud application:
[0] Test Subscription
> 0
Would you like to link the Cloud application Test subscription to this repository? y
Please enter a label for your Cloud IDE: TEST IDE
✔ Creating your Cloud IDE
✔ Getting IDE information
✔ Waiting for DNS to propagate...
Timed out after 15 minutes!
$
$ acli ide:list
Please select an Acquia Cloud application:
[0] Test Subscription
> 0
Would you like to link the Cloud application Test Subscription to this repository? y
=======================================================================
IDEs
=======================================================================
TEST IDE ([email protected])
IDE URL: https://<uuid>.ide.ahdev.cloud
Web URL: https://<uuid>.web.ahdev.cloud
=======================================================================
So I think at a minimum we should return the links for the newly created IDE.
Current acli version
$ acli --version
acli v1.0.0-beta1
When trying to clear varnish cache, command is faling:
$ acli api:environments:domains-clear-varnish 99999-99999999-9999999 --domains=sitename.domain.io,domain2.domain.io
Too many arguments, expected arguments "command".
api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>
The previous error don't indicate uuid / environment id, i tried to ommit that as seen:
$ acli api:environments:domains-clear-varnish --domains=sitename.domain.io,domain2.domain.io
The "environmentId" option does not exist.
api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>
Same equivalent command works just fine on ADS
ads api:environments:domains-clear-varnish 99999-99999999-9999999 --domains=sitename.domain.io domain2.domain.io
{
"message": "Varnish is being cleared for the selected domains.",
"_links": {
"self": {
"href": "https://cloud.acquia.com/api/environments/99999-99999999-9999999/domains/actions/clear-varnish"
},
"notification": {
"href": "https://cloud.acquia.com/api/notifications/33333-44444-55555-6666"
}
}
}
It would be really helpful if we can add debug
mode support like Drush command -d
for cli. verbose is very limited and i do not see much of the logs during verbose.
~ Downloads $ ./acli.phar self-update --allow-unstable
Updated from v1.0.0-beta5 to v1.0.0-beta6
;
break;
} else {
$this->addLongOption($option->getName(), null);
}
}
}
private function parseLongOption(string $token)
{
$name = substr($token, 2);
if (false !== $pos = strpos($name, '=')) {
if (0 === \strlen($value = substr($name, $pos + 1))) {
array_unshift($this->parsed, $value);
}
$this->addLongOption(substr($name, 0, $pos), $value);
} else {
$this->addLongOption($name, null);
}
}
private function parseArgument(string $token)
{
$c = \count($this->arguments);
if ($this->definition->hasArgument($c)) {
$arg = $this->definition->getArgument($c);
$this->arguments[$arg->getName()] = $arg->isArray() ? [$token] : $token;
} elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
$arg = $this->definition->getArgument($c - 1);
$this->arguments[$arg->getName()][] = $token;
} else {
$all = $this->definition->getArguments();
if (\count($all)) {
throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
}
throw ne
Fatal error: Uncaught Error: Class 'Symfony\Component\Console\Event\ConsoleErrorEvent' not found in phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php:934
Stack trace:
#0 phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php(264): Symfony\Component\Console\Application->doRunCommand(Object(Acquia\Cli\Command\UpdateCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php(140): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 phar:///Users/matthew.grasmick/Downloads/acli.phar/bin/acli(101): Symfony\Component\Console\Application->run()
#3 /Users/matthew.grasmick/Downloads/acli.phar(12): require('phar:///Users/m...')
#4 {main}
thrown in phar:///Users/matthew.grasmick/Downloads/acli.phar/vendor/symfony/console/Application.php on line 934
I’m noticing the acli remote:drush command expects the site aliases as returned by remote:aliases:list, without the @ which is commonly used on drush aliases. If I download the same aliases through our cloud UI and use them in local drush, I’m expected to include the @. Not a big deal but kind of an annoying discrepancy. Just me?
For example, using local drush with aliases downloaded from cloud I need to run…
% drush @mysite.dev status
Drupal version : 8.8.8
....
With ACLI, the command is…
% acli remote:drush mysite.dev status
Drupal version : 8.8.8
...
PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\EnvNotFoundException: Environment variable not found: "HOME".
I think it's due to our usage of HOME in the Symfony config/services.yml.
Git Bash is fine because it has this variable defined.
Describe the bug
When running this command
acli api:environments:code-switch myapp.dev "my-feature-branch"
... the process fails with the following error
In ArgvInput.php line 171: [Symfony\Component\Console\Exception\RuntimeException] Too many arguments, expected arguments "command" "environmentId". Exception trace: at phar:///usr/local/bin/acli/vendor/symfony/console/Input/ArgvInput.php:171 Symfony\Component\Console\Input\ArgvInput->parseArgument() at phar:///usr/local/bin/acli/vendor/symfony/console/Input/ArgvInput.php:82 Symfony\Component\Console\Input\ArgvInput->parse() at phar:///usr/local/bin/acli/vendor/symfony/console/Input/Input.php:55 Symfony\Component\Console\Input\Input->bind() at phar:///usr/local/bin/acli/vendor/symfony/console/Command/Command.php:217 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/acli/src/Command/CommandBase.php:243 Acquia\Cli\Command\CommandBase->run() at phar:///usr/local/bin/acli/vendor/symfony/console/Application.php:929 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/acli/vendor/symfony/console/Application.php:264 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/acli/vendor/symfony/console/Application.php:140 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/acli/bin/acli:95 require() at /usr/local/bin/acli:12 api:environments:code-switch [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>
This error has been reproduced on own environments too.
Could you please help us investigate why ? Thanks
Sophie
I think PHPUnit tests are exiting early as a result of a regression introduced by #220
A bit insidious because the tests still pass but don't run to completion. I'm not sure exactly how to fix this, or how to prevent this from recurring.
This also means that we aren't getting code coverage reports. Again, coveralls should fail the test run if it can't report, and Github shouldn't allow merging if coveralls didn't report.
Ran into the below issue when testing RC6 on an ACSF test subscription. It also happens with RC1 so IDK under which conditions the error shows up because in non-ACE IDEs I have it working well.
ide:~$ ./acli.phar ide:wizard:ssh-key:create-upload
✔ Creating a local SSH key
✔ Uploading the local key to Acquia Cloud
✔ Adding the SSH key to local keychain
⠹ Waiting for the key to become available on Acquia Cloud web servers
PHP Notice: Trying to get property 'sshUrl' of non-object in phar:///home/ide/acli.phar/src/Helpers/SshHelper.php on line 153
⣰ Waiting for the key to become available on Acquia Cloud web servers
PHP Notice: Trying to get property 'sshUrl' of non-object in phar:///home/ide/acli.phar/src/Helpers/SshHelper.php on line 153
⡇ Waiting for the key to become available on Acquia Cloud web servers
(snip)
The key looks to be uploaded correctly though.
When running api:environments:code-switch
, using an environment ID instead of alias, results in an error message:
Environment alias must match the pattern [app-name].[env]
Following Symfony refactor, ensure that Acquia CLI can find and match cloud accounts when running in a subdirectory of the Drupal root.
Current acli version
$ acli --version
acli v1.0.0-beta1
Command not working locally...
$ acli api:applications:environment-list 2cbf4649-9999999999999999
The "applicationUuid" option does not exist.
api:applications:environment-list [--sort SORT] [--filter FILTER] [--limit LIMIT] [--offset OFFSET] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <applicationUuid>
same command on ADS works just fine
ads api:applications:environment-list 2cbf4649-9999999999999999
{
[..snip..]
},
"_embedded": {
"items": [
{
"id": "00000000-00000000",
"label": "Dev",
"name": "dev",
"application": {
"name": "sitename",
"uuid": "11111-111111-111111"
},
"domains": [
"sitenamedev.prod.acquia-sites.com",
"sitename-dev.custom.io"
],
Other commands such as acli api:applications:list
works fine.
I tried installing Acquia CLI on OpenSuse. PHP 7.4 is installed with the JSON extension
$ php -v
PHP 7.4.9 (cli) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
$ installed php7
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
---+-----------+------------------------------------------------------+--------
i+ | php7 | Interpreter for the PHP scripting language version 7 | package
i+ | php7-json | JSON (de)serializer functions for PHP | package
But acli
refuses to bootstrap
$ acli
PHP Fatal error: Uncaught Error: Class 'Phar' not found in /usr/local/bin/acli:10
Stack trace:
#0 {main}
thrown in /usr/local/bin/acli on line 10
We already do this for the remote:* commands: https://github.com/acquia/cli/blob/master/src/Command/Remote/SshBaseCommand.php#L47
We also already substitute applicationUuid when a repo is linked: https://github.com/acquia/cli/blob/master/src/Command/Api/ApiCommandBase.php#L57
So for instance, it'd be nice if both of these worked:
acli api:applications:find eemgrasmick
acli api:applications:find 257a5440-22c3-49d1-894d-29497a1cf3b8
Or:
acli api:environments:domain-clear-varnish 21351-257a5440-22c3-49d1-894d-29497a1cf3b8 eemgrasmickdev.prod.acquia-sites.com
acli api:environments:domain-clear-varnish eemgrasmick.dev eemgrasmickdev.prod.acquia-sites.com
And not just for api:* commands, for all commands.
2 runs below:
acli
doesn't try to pull dependenciesacli
behaves as expectedSo it's either we have a different behavior when the dir is empty or we don't correctly detect the composer.json
file it seems?
ide:~/project$ acli refresh
Could not find a local Drupal project. Looked for docroot/index.php in current and parent directories.
Would you like to clone a project into the current directory?y
Would you like to link the Cloud application anavarred8 to this repository? n
Using Cloud Application anavarred8
Choose an Acquia Cloud environment to copy from:
[0] Dev (vcs: pipelines-build-master)
[1] pipelines-build-ads-integration (vcs: pipelines-build-ads-integration)
[2] Stage (vcs: tags/progress)
> 2
⌛ Cloning git repository from Acquia Cloud...
Cloning into '.'...
remote: Counting objects: 149300, done.
remote: Compressing objects: 100% (65712/65712), done.
remote: Total 149300 (delta 82016), reused 141431 (delta 74147)
Receiving objects: 100% (149300/149300), 156.56 MiB | 32.58 MiB/s, done.
✔ Cloning git repository from Acquia Cloud
✔ Importing Drupal database copy from Acquia Cloud
✔ Copying Drupal's public files from Acquia Cloud
ide:~/project$ ls -l
total 21412
-rw-r--r-- 1 ide ide 21292364 Jun 11 10:24 anavarred8.sql
drwxr-xr-x 2 ide ide 4096 Jun 11 10:24 blt
-rw-r--r-- 1 ide ide 3849 Jun 11 10:24 composer.json
-rw-r--r-- 1 ide ide 583504 Jun 11 10:24 composer.lock
drwxr-xr-x 4 ide ide 4096 Jun 11 10:24 config
drwxr-xr-x 6 ide ide 4096 Jun 11 10:24 docroot
drwxr-xr-x 3 ide ide 4096 Jun 11 10:24 drush
drwxr-xr-x 2 ide ide 4096 Jun 11 10:24 patches
-rw-r--r-- 1 ide ide 1538 Jun 11 10:24 phpcs.xml.dist
-rw-r--r-- 1 ide ide 6255 Jun 11 10:24 README.md
-rw-r--r-- 1 ide ide 56 Jun 11 10:24 salt.txt
drwxr-xr-x 3 ide ide 4096 Jun 11 10:24 tests
ide:~/project$ acli refresh
Using Cloud Application anavarred8
Choose an Acquia Cloud environment to copy from:
[0] Dev (vcs: pipelines-build-master)
[1] pipelines-build-ads-integration (vcs: pipelines-build-ads-integration)
[2] Stage (vcs: tags/progress)
> 2
✔ Pulling code from Acquia Cloud
✔ Importing Drupal database copy from Acquia Cloud
✔ Copying Drupal's public files from Acquia Cloud
✔ Installing Composer dependencies
The help
output for the api:environments:stack-metrics-data-metric
command suggests the following example syntax:
acli api:environments:stack-metrics-data-metric myapp.dev web-cpu web
Unfortunately, when I attempt that syntax (with a real site alias), I get the following error response:
{
"error": "system",
"message": "'From' date not provided."
}
This suggests that the underlying API call requires additional arguments to specify the date range for the data returned —but I don't see any way to provide those arguments.
When updating from rc4:
% acli update --allow-unstable
Downloading Acquia CLI v1.0.0-rc5
9539522/9539522 [============================] 100%Updated from v1.0.0-rc4 to v1.0.0-rc5
ception.php',
'Acquia\\Cli\\Helpers\\ClientService' => __DIR__ . '/../..' . '/src/Helpers/ClientService.php',
'Acquia\\Cli\\Helpers\\DataStoreContract' => __DIR__ . '/../..' . '/src/Helpers/DataStoreContract.php',
'Acquia\\Cli\\Helpers\\LocalMachineHelper' => __DIR__ . '/../..' . '/src/Helpers/LocalMachineHelper.php',
'Acquia\\Cli\\Helpers\\LoopHelper' => __DIR__ . '/../..' . '/src/Helpers/LoopHelper.php',
'Acquia\\Cli\\Helpers\\SshHelper' => __DIR__ . '/../..' . '/src/Helpers/SshHelper.php',
'Acquia\\Cli\\Helpers\\TelemetryHelper' => __DIR__ . '/../..' . '/src/Helpers/TelemetryHelper.php',
'Acquia\\Cli\\Kernel' => __DIR__ . '/../..' . '/src/Kernel.php',
'Acquia\\Cli\\Output\\Checklist' => __DIR__ . '/../..' . '/src/Output/Checklist.php',
'Acquia\\Cli\\Output\\Spinner\\Color' => __DIR__ . '/../..' . '/src/Output/Spinner/Color.php',
'Acquia\\Cli\\Output\\Spinner\\Spinner' => __DIR__ . '/../..' . '/src/Output/Spinner/Spinner.php',
'Acquia\\Cli\\SelfUpdate\\Strategy\\GithubStrategy' => __DIR__ . '/../..' . '/src/SelfUpdate/Strategy/GithubStrategy.php',
'Acquia\\DrupalEnvironmentDetector\\AcquiaDrupalEnvironmentDetector' => __DIR__ . '/..' . '/acquia/drupal-environment-detector/src/AcquiaDrupalEnvironmentDetector.php',
'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',
'Composer\\CaBundle\\CaBundle' => __DIR__ . '/..' . '/composer/ca-bundle/src/CaBundle.php',
'DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php',
'Doctrine\\Common\\Cache\\ApcCactrlen($command->getName()) + 2)."\n\n"
.($command->getDescription() ? $command->getDescription()."\n\n" : '')
.'### Usage'."\n\n"
.array_reduce(array_merge([$command->getSynopsis()], $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
return $carry.'* `'.$usage.'`'."\n";
})
);
if ($help = $command->getProcessedHelp()) {
$this->write("\n");
$this->write($help);
}
if ($command->getNativeDefinition()) {
$this->write("\n\n");
$this->describeInputDefinition($command->getNativeDefinition());
}
}
protected function describeApplication(Application $application, array $options = [])
{
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
$description = new ApplicationDescription($application, $describedNamespace);
$title = $this->getApplicationTitle($application);
$this->write($title."\n".str_repeat('=', Helper::strlen($title)));
foreach ($description->getNamespaces() as $namespace) {
if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
$this->write("\n\n");
Brand new IDE:
ide:~$ acli ide:wizard:ssh-key:create-upload
✔ Creating a local SSH key
✔ Uploading local key to Acquia Cloud
⌛ Adding SSH key to local keychain...
In IdeWizardCreateSshKeyCommand.php line 126:
Unable to add SSH key to local SSH agent:ssh_askpass: exec(phar:///home/ide/acli/src/Command/Ide/Wizard/passphrase_prompt.sh): No
such file or directory
ide:wizard:ssh-key:create-upload [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interactio
n] [--] <command>
Using drush 8:
~$ drush --version
Drush Version : 8.3.1-dev
acli latest release
~$ acli --version
acli v1.0.0-beta1
acli is properly configured to acquia as I can retrieve api:applications:list
~$ acli api:applications:list
[
{
"id": 9999,
"uuid": "000bXXXXXXXXXX",
"name": "XXXXXXX",
"hosting": {
"type": "ace",
"id": "prod:XXXXXX"
},
"subscription": {
"uuid": "000XXXXX",
"name": "XXXXXXXX"
},
[..snip..]
But drush aliases download command api:accounts:drush-aliases
is failing:
~$ acli api:accounts:drush-aliases 8
In Client.php line 110:
Only Drush 8 and 9 are supported.
api:accounts:drush-aliases [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <version>
E.g., remove api:accounts:ssh-key-create
since we have ssh-key:create
.
Relevant commands include:
In SshHelper.php line 58:
[Acquia\Cli\Exception\AcquiaCliException]
The command returns the status of the last command that was run on the remote server. This isn't expected behavior.
Successfully establishing the SSH connection should be sufficient to return successfully. We don't really care about the status of the commands inside the remote server.
Currently, we can't automate acli
in IDEs because Acquia CLI has a different behavior than Acquia Developer Studio CLI in that it's not running the authentication command when the API keys haven't been sent.
Observe the difference below:
ide:~/project$ ads refresh
The refresh command requires valid Acquia Cloud credentials.
You will need an Acquia Cloud API token from <https://cloud.acquia.com/a/profile/tokens>. You should create a new token specifically for Acquia Developer Studio and get prepared to enter the associated key and secret below.
? Please enter your API Key ide:~/project$ ^C
ide:~/project$ acli refresh
In CommandBase.php line 196:
This machine is not yet authenticated with Acquia Cloud. Please run `acli auth:login`
refresh [-from|--cloud-env-uuid CLOUD-ENV-UUID] [--no-code] [--no-files] [--no-databases] [--no-scripts] [--scripts] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>
So instead of quitting with an error we'd need acli auth:login
to be executed whenever /home/ide/.acquia/cloud_api.conf
doesn't exist.
Currently, to switch PHP versions in IDEs, you need to do the following and restart PHP:
echo "7.4" >> /home/ide/configs/php/.version
To enable Xdebug, you need to uncomment a line under /home/ide/configs/php/xdebug.ini
and restart PHP.
We should make all PHP operations easier with Acquia CLI, by introducing an ide:php
command. The command should do the following:
Note: this command should probably only be visible from within an IDE.
After a successful acli refresh
, the SQL dump remains in the project root. We should ensure it's being cleaned up.
A success response of api:environments:domains-clear-varnish for example:
./acli.phar api:environments:domains-clear-varnish 2701-******-******** --domains=domain.com
{
"message": "Varnish is being cleared for the selected domains.",
"_links": {
"self": {
"href": "https:\/\/cloud.acquia.com\/api\/environments\/88888-888888-88888\/domains\/actions\/clear-varnish"
},
"notification": {
"href": "https:\/\/cloud.acquia.com\/api\/notifications\/99999-9999990999999"
}
}
}
But when it fails, a json response should be expected as well:
./acli.phar api:environments:domains-clear-varnish 2701-invalid-******** --domains=domain.com
In Client.php line 110:
The ID "2701-invalid-********" is not a valid environment ID.
api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>
Other errors such as invalid domains or others, should also be json... I believe this behavior should be applied to others commands as well...
Failure with Acquia CLI:
$ acli api:environments:cron-create REDACTED --command="/usr/local/bin/drush cc all" --frequency="*/30 * * * *" --label="Test"
An argument with name "command" already exists.
api:environments:cron-create [--server_id SERVER_ID] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <environmentId>
Success with Dev Studio CLI:
$ ads api:environments:cron-create REDACTED --command="/usr/local/bin/drush cc all" --frequency="*/30 * * * *" --label="Test"
{
"message": "Creating a new cron.",
"_links": {
"self": {
"href": "https://cloud.acquia.com/api/environments/REDACTED/crons/REDACTED"
},
"parent": {
"href": "https://cloud.acquia.com/api/environments/REDACTED/crons"
},
"notification": {
"href": "https://cloud.acquia.com/api/notifications/REDACTED"
}
}
}
As reported on #110, api:environments:domains-clear-varnish still not working...
already using beta2 (also fails in latest HEAD on master)
$ acli --version
Acquia CLI v1.0.0-beta2
command still failing
acli api:environments:domains-clear-varnish 9999-999999-888888 --domains=domain1.com,domain2.com
Too many arguments, expected arguments "command".
api:environments:domains-clear-varnish [--domains DOMAINS] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command>
The ide:php-version
works great. I noticed a few limitations, however. See below:
ide:~$ php -v
PHP 7.4.6 (cli) (built: Jun 1 2020 17:56:08) ( NTS )
ide:~$ acli ide:php-version 7.2
ide:~$ php -v
PHP 7.2.31 (cli) (built: Jun 1 2020 19:34:41) ( NTS )
ide:~$ acli ide:php-version 7.3
ide:~$ php -v
PHP 7.3.18 (cli) (built: Jun 1 2020 19:39:17) ( NTS )
ide:~$ acli ide:php-version 7.4
ide:~$ php -v
PHP 7.4.6 (cli) (built: Jun 1 2020 17:56:08) ( NTS )
ide:~$ acli ide:php-version 8.0
ide:~$ php -v
PHP 7.4.6 (cli) (built: Jun 1 2020 17:56:08) ( NTS )
In IDEs, if we want acli ide:php-version
to run for any PHP version supported in the IDE, we need to silence the PHP 7.2 error. Here's an example where switching to PHP 7.2 worked well, but upon switching to PHP 7.4 from PHP 7.2 it returned an error (but did complete the operation).
But if you try to switch to a valid PHP version, this time you'll be out of luck because you'll be on PHP 7.2 and Acquia CLI will shutdown immediately.
$ acli ide:php-version 7.4
Box Requirements Checker
========================
> Using PHP 7.2.31
> PHP is using the following php.ini file:
/usr/local/php7.2/etc/cli/php.ini
> Checking Box requirements:
E.....
[ERROR] Your system is not ready to run the application.
Fix the following mandatory requirements:
=========================================
* The application requires the version "^7.3" or greater.
acli api:applications:find <uuid>
often returns the below error while the UUID is valid:
In ApiCommandBase.php line 248:
The {applicationUuid} must be a valid UUID or site alias.
api:applications:find [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <applicationUuid>
One potential reason for that is we're using our own UUID generation and validation compared to typhonius/acquia-php-sdk-v2
which calls Symfony’s built in validator.
Here's an example with a sample app UUID. Tried with at leat 5 different app UUIDs for which I know there are existing IDEs.
$ acli api:applications:ide-list a2e88z93-a9fe-4357-b322-cdcw2da68753
{
"error": "not_found",
"message": "The path \"api\/api\/applications\/a2e88z93-a9fe-4357-b322-cdcw2da68753\/ides\" does not match any known resources."
}
It appears we’ve prepended an additional api/
to the requested path.
Take an example. Sample IDE is provisioned with sitegroup "test". Automatically, the configuration overrides in the IDE will be stored under /var/www/site-php/test/test-settings.inc
But upon selecting a different database than the default one via Acquia CLI, then the expected path might become /var/www/site-php/test/db2-settings.inc
But the IDE in question won't be updated accordingly. This leaves the user in a dead end because the configuration overrides AND DB credentials are not preconfigured for this specific sitegroup's database.
What we should do is upon doing an acli refresh
AND selecting a DB, rename /var/www/site-php/<SITEGROUP>/<DB>-settings.inc
so DB-settings.inc
is modified accordingly to the database name we're pulling.
using latest HEAD
$ git log --pretty=oneline --abbrev-commit
08df362 (HEAD -> master, origin/master, origin/HEAD) Fixes #123: Infer applicationUuid argument for api:* commands. (#128)
[..snip..]
some drush commands will work fine, such as status:
./bin/acli remote:drush sitename.dev status
Drupal version : 8.8.7
Site URI : http://default
Database driver : mysql
Database hostname : ded-9999
Database port : 3306
Database username : sitenamedev
Database name : sitenamedev
Database : Connected
Drupal bootstrap : Successful
[..snip..]
but others with params will fail
./bin/acli remote:drush sitename.dev uli 1
Too many arguments, expected arguments "command" "alias" "drush_command".
remote:drush [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <alias> <drush_command>
or
./bin/acli remote:drush sitename.dev user-unblock 1
Too many arguments, expected arguments "command" "alias" "drush_command".
remote:drush [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [--] <command> <alias> <drush_command>
We had some custom logic to manipulate aliases pre/post acquia_update
using:
//drush_hook_pre_COMMAND -> drush_custom_pre_acquia_update
//drush_hook_post_COMMAND -> drush_custom_post_acquia_update
Would it be possible to have equivalent commands for remote:aliases:download
in order to manipulate those downloaded aliases?
@joazvsoares to lay out the requirements
@danepowell this one looks critical as it's blocking an ACSF customer from pulling the site locally.
In Acquia CLI, there's no equivalent to ads deploy
. This means in Cloud IDE users might be confused as to how they can deploy to any Cloud environment.
Here's how ads deploy
currently works:
$ ads deploy
Select corresponding Acquia Cloud Application: mydrupalwebsite
? Select source: Stage
? Select target environment: Prod
? Are you sure you want to deploy to Prod? Yes
? Do you want to back up the databases before deploying the code? No
? Do you want to clear Varnish cache after the deploy? Yes
Summary:
› Warning: The databases from Prod will not be backed up before deployment.
The environment Prod will be switched to progress.
Varnish cache will be cleared from Prod after deployment.
? Continue? Yes
✔ mydrupalwebsite: deploying progress to Prod
✔ Clearing Varnish cache
Successfully deployed progress to Prod
? Open the website? No
Perhaps initially in an IDE there could be a wrapper to ads deploy
until we have a full-blown command.
At least that's my assumption
By doing this one could add this file to the repository and allow it to work with this on other environments (CI,lando,other devs) etc.. Otherwise each is force to link it again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.