public function commit()
 {
     $siteId = Input::get('siteId');
     $commit = Input::get('commit');
     $hostType = Input::get('remote');
     $deploy = array('branch' => '---', 'commit' => $commit, 'hosttype' => $hostType, 'user' => GithubLogin::getLoginUser()->login, 'type' => 'Deploy To ' . $hostType, 'time' => date('Y-m-d H:i:s'), 'last_time' => '0000-00-00 00:00:00', 'result' => 'Deploy Waiting', 'errMsg' => ' ', 'errOut' => "<div class='text-center'>----------- ERROR OUTPUT -----------</div>\n", 'standOut' => "<div class='text-center'>----------- STANDED OUTPUT -----------</div>\n");
     $id = (new DeployInfo($siteId))->add($deploy);
     $class = Config::get('worker.queue.deploy');
     Supervisor::push($class, array('siteId' => $siteId, 'commit' => $commit, 'hostType' => $hostType, 'id' => $id), 'deploy');
     return Response::json(array('res' => 0));
 }
 public function toDeploy($siteId)
 {
     $commit = Input::get('commit');
     $hostType = Input::get('remote');
     $date = date('Y-m-d H:i:s');
     $user = GithubLogin::getLoginUser();
     $pr = new PullRequest($siteId);
     $prCommit = $pr->get($commit);
     $prd = new PullRequestDeploy($siteId);
     $pri = $prd->add($prCommit->prId, $prCommit->title, $commit, $prCommit->user, $user->login, $hostType, $date, $date, 'Waiting');
     //Queue::push('DeployCommit', array('id' => $pri->id, 'type' => DeployCommit::TYPE_PULL_REQUEST, 'hostType' => $hostType, 'siteId' => $siteId, 'commit' => $commit), DeployInfo::DEPLOY_QUEUE);
     $class = Config::get('worker.queue.deploy');
     Supervisor::push($class, array('siteId' => $siteId, 'commit' => $commit, 'type' => DeployCommit::TYPE_PULL_REQUEST, 'hostType' => $hostType, 'id' => $pri->id), 'deploy');
     return Response::json(array('res' => 0));
 }
Beispiel #3
0
                        $m->status = 'closed';
                        $pr->save($m);
                    }
                } elseif ($notifyObject->action == 'reopened') {
                    $commitList = $pr->getListByPRId($notifyObject->pull_request->id);
                    foreach ($commitList as $m) {
                        $m->status = 'open';
                        $pr->save($m);
                    }
                }
                $have->status = $notifyObject->pull_request->state;
                $pr->save($have);
            } else {
                //Queue::push('PullRequestBuild', array('siteId' => $siteId, 'commit' => $commit), DeployInfo::PR_BUILD_QUEUE);
                $class = Config::get('worker.queue.prbuild');
                \Eleme\Worker\Supervisor::push($class, array('siteId' => $siteId, 'commit' => $commit, 'pullNumber' => $pullNumber), 'prbuild');
                $pr->add($notifyObject);
            }
        }
    }
    return "";
});
Route::get('/github/oauth/confirm', function () {
    if (GithubLogin::check()) {
        return Redirect::to('/');
    }
    return Response::view('oauth-confirm');
});
Route::get('/github/oauth', function () {
    if (GithubLogin::check()) {
        return Redirect::to('/');