Example #1
0
    $job = new Job($jobid);
    if ($job === false) {
        textResponse(204);
    }
    $machine = new Machine(Session::getMachineId());
    if (!$machine->hasJob($job->getJobId())) {
        textResponse(403, 'Job not assigned to you');
    }
    $job->unset('machine');
    $job->set('buildstatus', $_POST['buildstatus']);
    $job->set('buildreason', $_POST['buildreason']);
    $job->moveToQueue('archivequeue');
    jsonResponse(200, $job->getJobData());
})->conditions(array('jobid' => '[0-9]'));
/* Jobgroup - List details of jobgroup */
$app->get('/group/:groupid/', 'isAllowed', function ($groupid) use($app) {
    $jobgroup = new Jobgroup($groupid);
    if (!$jobgroup->exists()) {
        textResponse(404, 'Jobgroup not found');
    }
    jsonResponse(200, $jobgroup->getGroupInfo());
});
/* 404 - not found */
$app->notFound(function () use($app) {
    textResponse(404, 'Not found');
});
/* 500 - internal server error */
$app->error(function (\Exception $e) use($app) {
    textResponse(500, 'Internal Server Error');
});
$app->run();