예제 #1
0
 /**
  * @param Project $project
  * @param Build   $build
  * @param string  $status
  */
 public function setCommitStatus(Project $project, Build $build, $status)
 {
     $client = $this->configureClientForProject($project);
     $client->setDefaultOption('headers/Accept', 'application/vnd.github.she-hulk-preview+json');
     $request = $client->post(['/repos/' . $project->getFullName() . '/statuses/{sha}', ['sha' => $build->getHash()]]);
     $request->setBody(json_encode(['state' => 'success', 'target_url' => $build->getUrl(), 'description' => 'Stage1 instance ready', 'context' => 'stage1']));
     $this->logger->info('sending commit status', ['build' => $build->getId(), 'project' => $project->getGithubFullNAme(), 'sha' => $build->getHash()]);
     try {
         $request->send();
     } catch (\Guzzle\Http\Exception\ClientErrorResponseException $e) {
         $this->logger->error('error sending commit status', ['exception_class' => get_class($e), 'exception_message' => $e->getMessage(), 'url' => $e->getRequest()->getUrl(), 'response' => (string) $e->getResponse()->getBody()]);
     }
 }