I have shell script to deploy project from dev.
#!/bin/bash
echo "****** Getting latest pull ******"
cd "../../"
git fetch
git reset --hard origin/docs_autopull_build
git rebase --abort
git pull origin dev
echo "****** Building project ******"
gulp css
gulp scripts
cd "public_html/docs/"
echo "****** Building docs ******"
npm run styleguide:build
echo "******************************************"
I test it via php file
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
shell_exec('sh pull_and_build.sh');
To test i used console php test.php exec.
But when shell_exec('sh pull_and_build.sh'); runs via webhook its seems like wrongs inccorect.
When i am again running php test.php after webhook i got the result ,that should be yet via webhook.
Seems like there is difference between exec shell via php file running command line and when shell execs by webhook.php.
webhook.php and test php exist in the same directory.
UPD:: I change the path to absolute - that doesnot helps.
On screenshots the results of git status after running test.php and after running webhook.
Seems like webhook invoke git commands and cant invoke gulp and npm.
UPD2:: The shell_exec('sudo -S sh pull_and_build.sh'); doesnot hepls
