岁月码头

283 经验值

站长你好 ,按照您的webhook教程,我自己用阿里云实际弄了一遍,coding的webhook也执行了,但是服务器上没有自动git pull 也没有报错 你可以帮我看看是什么问题吗?

这是routes.php代码

<?php
Route::get('/', function () {
    return view('welcome');
});

Route::any('/deploy','DeploymentController@deploy');


这是Deployment控制器代码:

<?php
namespace App\Http\Controllers;


use AdamBrett\ShellWrapper\Command;
use AdamBrett\ShellWrapper\Command\Param;
use AdamBrett\ShellWrapper\Runners\Exec;
class DeploymentController extends Controller
{
    /**     * 触发 webhook 进行部署     */    
  public function deploy(){
        $token = 'laravel';
        $json = json_decode(file_get_contents('php://input'),true);
        if(empty($json['token']) || $json['token'] !== $token ){
            exit('error request');
        }
        $this->cdInto('/var/www/laravel-test')
            ->gitPull();
    }


    /*** 执行cd 命令     * @parm $path     * $return $this     *     */    
  protected function cdInto($path){
        $shell = new Exec();
        $command = new Command('cd');
        $command->addParam(new Param($path));
        $shell->run($command);
        return $this;
    }

    //执行git pull    protected function gitPull(){
        $shell = new Exec();
        $command = new Command('git pull');
        $shell->run($command);
        echo 'ok';
    }
}

这是coding的webhook被自动调用的截图

2016-07-22 11-56-03屏幕截图.png


这是阿里云服务器目录相关截图:

2016-07-22 11-55-38屏幕截图.png

如果站长感觉不方便定位问题,我这边可以提供ssh账号密码,恳请站长指点,感激不尽