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

BLT git hooks symlinks are broken outside the VM #2633

Closed
timwood opened this issue Mar 13, 2018 · 3 comments
Closed

BLT git hooks symlinks are broken outside the VM #2633

timwood opened this issue Mar 13, 2018 · 3 comments
Labels
Bug Something isn't working

Comments

@timwood
Copy link

timwood commented Mar 13, 2018

My system information:

  • Operating system type: Mac / Drupal VM 4.8.1
  • Operating system version: Sierra / beet/box
  • BLT version: 9.0.3

Output of blt doctor:

$ blt doctor
[warning] The xDebug extension is loaded. This will significantly decrease performance.
+---------------------------+---------------------------------------------------------+
| Property                  | Value                                                   |
+---------------------------+---------------------------------------------------------+
| %paths.%root              | /var/www/mfgov-d8/docroot                               |
| %paths.%site              | sites/default                                           |
| %paths.%modules           | sites/all/modules                                       |
| %paths.%themes            | sites/all/themes                                        |
| %paths.%config-sync       | /var/www/mfgov-d8/config/default                        |
| %paths.%files             | sites/default/files                                     |
| %paths.%temp              | /tmp                                                    |
| %paths.%private           | /var/www/mfgov-d8/files-private                         |
| admin-theme               | seven                                                   |
| alias-searchpaths.0       | /var/www/mfgov-d8/drush/sites                           |
| blt-version               | 9.0.3                                                   |
| bootstrap                 | Successful                                              |
| composer-version          | Composer version 1.6.3 2018-01-31 16:28:17              |
| config-sync               | /var/www/mfgov-d8/config/default                        |
| db-driver                 | mysql                                                   |
| db-hostname               | localhost                                               |
| db-name                   | drupal                                                  |
| db-password               | drupal                                                  |
| db-port                   | 3306                                                    |
| db-status                 | Connected                                               |
| db-username               | drupal                                                  |
| drupal-settings-file      | sites/default/settings.php                              |
| drupal-version            | 8.5.0                                                   |
| drush-alias-files.0       | /var/www/mfgov-d8/drush/sites/mfgov.site.yml            |
| drush-conf.0              | /var/www/mfgov-d8/vendor/drush/drush/drush.yml          |
| drush-conf.1              | /var/www/mfgov-d8/drush/drush.yml                       |
| drush-conf.2              | /var/www/mfgov-d8/docroot/sites/default/local.drush.yml |
| drush-script              | /var/www/mfgov-d8/vendor/bin/drush                      |
| drush-temp                | /tmp                                                    |
| drush-version             | 9.2.1                                                   |
| files                     | sites/default/files                                     |
| install-profile           | lightning                                               |
| modules                   | sites/all/modules                                       |
| php-bin                   | /usr/bin/php7.1                                         |
| php-conf.0                | /etc/php/7.1/cli/php.ini                                |
| php-os                    | Linux                                                   |
| private                   | /var/www/mfgov-d8/files-private                         |
| root                      | /var/www/mfgov-d8/docroot                               |
| site                      | sites/default                                           |
| stacks.drupal-vm.inited   | true                                                    |
| stacks.dev-desktop.inited | false                                                   |
| temp                      | /tmp                                                    |
| theme                     | uswds_mfgov                                             |
| themes                    | sites/all/themes                                        |
| uri                       | https://local.manufacturing.test                        |
+---------------------------+---------------------------------------------------------+
+--------------------------------------+-----------------------------------------------------------+
| Check                                | Problem                                                   |
+--------------------------------------+-----------------------------------------------------------+
| NodeCheck:checkNodeVersionFileExists | Neither .nvmrc nor .node-version file found in repo root. |
| WebUriCheck:checkHttps               | The SSL certificate for your local site appears to be     |
|                                      | invalid for https://local.manufacturing.test.             |
+--------------------------------------+-----------------------------------------------------------+
[error]  BLT Doctor discovered one or more critical issues. 

When I run this command (from outside the VM):

git commit -m "This is my invalid, not very good commit message?"

I get the following output (a successful commit, but no pre-commit checks or commit message validation):

[OAM-131 a733b22] This is my invalid, not very good commit message?
 1 file changed, 1 insertion(+)

And I expected this to happen:
Git to complain about my improperly formatted commit message as defined in .git/hooks/commit-msg (a symlink to /var/www/mfgov-d8/vendor/acquia/blt/scripts/git-hooks/commit-msg). Obviously this symlink is bad/incorrect outside the VM.

Does BLT recommend that even git commits be performed inside the VM?

Could the BLT Robo task which creates the symlink make it a relative one, so it will work inside and outside the VM?

grasmash added a commit to grasmash/bolt that referenced this issue Mar 13, 2018
@grasmash grasmash added the Bug Something isn't working label Mar 13, 2018
@timwood
Copy link
Author

timwood commented Mar 13, 2018

Thank you!

@timwood
Copy link
Author

timwood commented Mar 15, 2018

Hey @grasmash. I updated to 9.0.4 and the blt blt:initi:git-hooks command is now creating relative symlinks, but it's not a valid symlink. I believe it's one level too many up (../).

$ ls -alrt .git/hooks/
lrwxrwxrwx  1 60422 vagrant_group   55 Mar 15  2018 pre-commit -> ../../../vendor/acquia/blt/scripts/git-hooks/pre-commit
lrwxrwxrwx  1 60422 vagrant_group   55 Mar 15  2018 commit-msg -> ../../../vendor/acquia/blt/scripts/git-hooks/commit-msg

@grasmash grasmash reopened this Mar 15, 2018
@grasmash
Copy link
Contributor

grasmash commented Mar 16, 2018

Hm. We're using a stock Symfony filesystem method the determine the location: 741cfbf#diff-82f049ca6fb91a65494ab7f81bdb45b0R223

Not sure why that wouldn't work. Perhaps the path passed to makePathRelative() should not include the filename suffix.

Seems like we need to update https://github.com/acquia/blt/blob/9.x/tests/phpunit/BltProject/SetupGitHooksTest.php#L19 to follow the symlink and ensure that the source file exists, then work backwards from there.

malikkotob added a commit to malikkotob/blt that referenced this issue Mar 16, 2018
malikkotob added a commit to malikkotob/blt that referenced this issue Mar 16, 2018
malikkotob added a commit to malikkotob/blt that referenced this issue Mar 16, 2018
malikkotob added a commit to malikkotob/blt that referenced this issue Mar 16, 2018
malikkotob added a commit to malikkotob/blt that referenced this issue Mar 16, 2018
malikkotob added a commit to malikkotob/blt that referenced this issue Mar 16, 2018
malikkotob added a commit to malikkotob/blt that referenced this issue Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants