rafaelstz / deployer-magento2

⚙️ Deploy your Magento 2 faster and easier with this Deployer Recipe.

Home Page:https://packagist.org/packages/rafaelstz/deployer-magento2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'Magento folder could not be detected' error on 'n98-magerun2 sys:info version' command

lima195 opened this issue · comments

Description:
Seems that magento_version is not being runned at release_dir.

Error:

The command "cd /data/www/my-magento-dir/releases/20211019201335/ && /usr/bin/php bin/magento setup:upgrade --keep-generated --root-dir=/data/www/my-magento-dir/releases/20211019201335 --quiet" failed.  
                                                                                                                                                                                                                           
  Exit Code: 1 (General error)                                                                                                                                                                                             
                                                                                                                                                                                                                           
  Host Name: staging                                                                                                                                                                                                       
                                                                                                                                                                                                                           
  ================                                                                                                                                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                           
    The "--root-dir" option does not exist.

So I'm able to remove --root-dir param with:

set('magerun_params', '');

but then I got this error:

The command "/usr/bin/n98-magerun2 sys:info version  --quiet" failed.                                                                                                                                                                                                        
                                                                                                                                                                                                                                                                               
  Exit Code: 1 (General error)                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                               
  Host Name: staging                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                               
  ================                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
    Magento folder could not be detected   

Solution:
file deploy.php

set('magento_version', function (){
    return run("cd {{release_path}}{{magento_dir}} && {{php}} {{magerun}} sys:info version {{magerun_params}} {{verbose}}");
});

origin function:

set('magento_version', function (){
    return run("{{php}} {{magerun}} sys:info version {{magerun_params}} {{verbose}}");
});

Thanks for the PR @lima195 🎉
#44