Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for generating ACSF site aliases #2961

Merged
merged 13 commits into from
Jul 30, 2018
Merged

Conversation

lcatlett
Copy link
Contributor

@lcatlett lcatlett commented Jul 20, 2018

Fixes #2914 #2925

Changes proposed:

  • Adds support for generating ACSF site aliases without ACSF tools via blt recipes:aliases:init:acquia
  • Supports non-acquia primary domains
  • Sets appId config in blt.yml to disable interactive prompt.
  • Fixes phpcs issues in previous task

@lcatlett
Copy link
Contributor Author

lcatlett commented Jul 20, 2018

This has been tested on 5+ ACSF customers successfully with the largest customer having 192 sites.

@ba66e77
Copy link
Contributor

ba66e77 commented Jul 21, 2018

I'm getting a PHP fatal immediately after entering the application id. It looks like YamlMunge really lives in the Acquia\Blt\Robo\Common namespace and not in Acquia\Blt\Robo\Commands\Generate\YamlMunge.

$ blt recipes:aliases:init:acquia
[warning] Drupal VM is locally initialized, but is not running.
To generate an alias for the Acquia Cloud, BLT require's your Acquia Cloud application ID.
See https://docs.acquia.com/acquia-cloud/manage/applications.
 Please enter your Acquia Cloud application ID 8bd{redacted application id}17b61

Updating /Users/barrett.smith/Desktop/blted8/blt/blt.yml...

PHP Fatal error:  Uncaught Error: Class 'Acquia\Blt\Robo\Commands\Generate\YamlMunge' not found in /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php:105
Stack trace:
#0 /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php(90): Acquia\Blt\Robo\Commands\Generate\AliasesCommand->writeAppConfig('8bd...')
#1 /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php(55): Acquia\Blt\Robo\Commands\Generate\AliasesCommand->setAppId()
#2 [internal function]: Acquia\Blt\Robo\Commands\Generate\AliasesCommand->generateAliasesAcquia(Array)
#3 /Users/barrett.smith/Desktop/blted8/vendor/consolidation/annotated-command/src/CommandProcessor.php(235): call_user_func_array(Array, Array)
#4 /Users/barrett.smith/Desktop/blted8/vendor/consolidation/annotated-command/src/CommandProcessor.php(181): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /Users/barrett.smith/Desktop/blted8/ven in /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php on line 105

Fatal error: Uncaught Error: Class 'Acquia\Blt\Robo\Commands\Generate\YamlMunge' not found in /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php:105
Stack trace:
#0 /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php(90): Acquia\Blt\Robo\Commands\Generate\AliasesCommand->writeAppConfig('8bd...')
#1 /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php(55): Acquia\Blt\Robo\Commands\Generate\AliasesCommand->setAppId()
#2 [internal function]: Acquia\Blt\Robo\Commands\Generate\AliasesCommand->generateAliasesAcquia(Array)
#3 /Users/barrett.smith/Desktop/blted8/vendor/consolidation/annotated-command/src/CommandProcessor.php(235): call_user_func_array(Array, Array)
#4 /Users/barrett.smith/Desktop/blted8/vendor/consolidation/annotated-command/src/CommandProcessor.php(181): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /Users/barrett.smith/Desktop/blted8/ven in /Users/barrett.smith/Desktop/blt/src/Robo/Commands/Generate/AliasesCommand.php on line 105

@ba66e77
Copy link
Contributor

ba66e77 commented Jul 22, 2018

Alias generation is working fine for both ACSF and ACE and when creating a new project the typhonius/acquia-php-sdk-v2 package is brought in on the dev-master branch.

Forcing the acquia-php-sdk-v2 package to update from 1.0.2 when blt is updated on existing projects is proving more difficult. In the end I had to manually require the package: composer require typhonius/acquia-php-sdk-v2:dev-master. Anyway we could put that in an update hook something?

@lcatlett lcatlett added this to the 9.2.0 milestone Jul 24, 2018
@lcatlett lcatlett added acsf Enhancement A feature or feature request labels Jul 24, 2018
@lcatlett
Copy link
Contributor Author

@ba66e77 do you recall how you were updating BLT when you ran into the typhonius/acquia-php-sdk-v2 conflict? I created an update hook but I am actually having difficulty re-creating this issue and testing it.

@ba66e77
Copy link
Contributor

ba66e77 commented Jul 27, 2018

The process I was using to test the update path was:

  1. Checkout the 9.x branch, run composer install, run the process to create a blted8 from symlink
  2. Checkout this PR using hub checkout
  3. Run composer install
  4. Run blt update
  5. Verify version in composer.json and composer.lock
  6. Run process to generate aliases: blt recipes:aliases:init:acquia

@lcatlett
Copy link
Contributor Author

I think instead of just running composer install you may need to run composer update acquia/blt --update-with-dependencies since the blt package might be using the cached dependencies due to the version number being the same. I will validate if that is the case and recommend either update testing steps or a hook

@lcatlett
Copy link
Contributor Author

lcatlett commented Jul 27, 2018

I've confirmed that you can update BLT with the needed package dependencies by adding the --update-with-all-dependencies parameter to composer require, even if these were locked by previous versions of BLT. The dev-acsf-aliases branch below is my local branch that is this PR, but this would be ^9.1.0 once released in BLT.

composer require acquia/blt:dev-acsf-aliases --update-with-all-dependencies

output:

vagrant@local /var/www/bltdev (test-update *) $ composer require acquia/blt:dev-acsf-aliases --update-with-all-dependencies
    1/7:	http://packagist.org/p/provider-latest$3be915d1e54e18e96f9c901b814591e116e5145a177f10355fa179459927110d.json
 [...]
    Finished: success: 7, skipped: 0, failure: 0, total: 7
./composer.json has been updated
Gathering patches for root package.
Loading composer repositories with package information
Updating dependencies (including require-dev)
 [...]
    Finished: success: 6, skipped: 0, failure: 0, total: 6
Package operations: 1 install, 12 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Updating typhonius/acquia-php-sdk-v2 (1.0.2 => dev-master 2e04652):  Checking out 2e046528a1
 [...]
Writing lock file
Generating autoload files
Updating BLT templated files...
 > blt blt:update --ansi -y
Copying files from BLT's template into your project...
Merging BLT's blt.yml template with your project's blt/blt.yml...
Removing deprecated files and directories...
> blt:init:shell-alias
The BLT alias is already installed and up to date.

It may be worth calling this out in the release notes to prevent similar update issues for users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A feature or feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants