/** * Release steps of the project and their status for this release */ public function ReleaseSteps() { $output = new ArrayList(); $sha = $this->commit->getHash(); foreach ($this->project->ReleaseSteps() as $step) { $output->push($step->customise(array('Status' => $step->getReleaseStatus($this, $sha), 'Link' => $step->getReleaseLink($this, $sha)))); } return $output; }
/** * @return ArrayList */ public function CurrentlyDeployedTo() { $environments = $this->project->Environments(); $envList = new ArrayList(); foreach ($environments as $environment) { $deployments = DNDeployment::get()->filter('Status', 'Finished')->filter('EnvironmentID', $environment->ID)->sort('LastEdited DESC'); if (!$deployments->count()) { continue; } $latest = $deployments->first(); if ($latest->SHA === $this->commit->getHash()) { $envList->push($environment); } } return $envList; }
/** * @param string $sha * @return array */ protected function getCommitData($sha) { try { $repo = $this->Project()->getRepository(); if ($repo !== false) { $commit = new \Gitonomy\Git\Commit($repo, $sha); return ['AuthorName' => (string) Convert::raw2xml($commit->getAuthorName()), 'AuthorEmail' => (string) Convert::raw2xml($commit->getAuthorEmail()), 'Message' => (string) Convert::raw2xml($commit->getMessage()), 'ShortHash' => Convert::raw2xml($commit->getFixedShortHash(8)), 'Hash' => Convert::raw2xml($commit->getHash())]; } } catch (\Gitonomy\Git\Exception\ReferenceNotFoundException $exc) { SS_Log::log($exc, SS_Log::WARN); } return array('AuthorName' => '(unknown)', 'AuthorEmail' => '(unknown)', 'Message' => '(unknown)', 'ShortHash' => $sha, 'Hash' => '(unknown)'); }