Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/storage/build/HarbormasterBuild.php
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | $results = array( | ||||
'buildable.commit' => null, | 'buildable.commit' => null, | ||||
'repository.callsign' => null, | 'repository.callsign' => null, | ||||
'repository.phid' => null, | 'repository.phid' => null, | ||||
'repository.vcs' => null, | 'repository.vcs' => null, | ||||
'repository.uri' => null, | 'repository.uri' => null, | ||||
'step.timestamp' => null, | 'step.timestamp' => null, | ||||
'build.id' => null, | 'build.id' => null, | ||||
'initiator.phid' => null, | 'initiator.phid' => null, | ||||
'buildable.phid' => null, | |||||
'buildable.object.phid' => null, | |||||
'buildable.container.phid' => null, | |||||
'build.phid' => null, | |||||
); | ); | ||||
foreach ($this->getBuildParameters() as $key => $value) { | foreach ($this->getBuildParameters() as $key => $value) { | ||||
$results['build/'.$key] = $value; | $results['build/'.$key] = $value; | ||||
} | } | ||||
$buildable = $this->getBuildable(); | $buildable = $this->getBuildable(); | ||||
$object = $buildable->getBuildableObject(); | $object = $buildable->getBuildableObject(); | ||||
$object_variables = $object->getBuildVariables(); | $object_variables = $object->getBuildVariables(); | ||||
$results = $object_variables + $results; | $results = $object_variables + $results; | ||||
$results['step.timestamp'] = time(); | $results['step.timestamp'] = time(); | ||||
$results['build.id'] = $this->getID(); | $results['build.id'] = $this->getID(); | ||||
$results['initiator.phid'] = $this->getInitiatorPHID(); | $results['initiator.phid'] = $this->getInitiatorPHID(); | ||||
$results['buildable.phid'] = $buildable->getPHID(); | |||||
$results['buildable.object.phid'] = $object->getPHID(); | |||||
$results['buildable.container.phid'] = $buildable->getContainerPHID(); | |||||
$results['build.phid'] = $this->getPHID(); | |||||
return $results; | return $results; | ||||
} | } | ||||
public static function getAvailableBuildVariables() { | public static function getAvailableBuildVariables() { | ||||
$objects = id(new PhutilClassMapQuery()) | $objects = id(new PhutilClassMapQuery()) | ||||
->setAncestorClass('HarbormasterBuildableInterface') | ->setAncestorClass('HarbormasterBuildableInterface') | ||||
->execute(); | ->execute(); | ||||
$variables = array(); | $variables = array(); | ||||
$variables[] = array( | $variables[] = array( | ||||
'step.timestamp' => pht('The current UNIX timestamp.'), | 'step.timestamp' => pht('The current UNIX timestamp.'), | ||||
'build.id' => pht('The ID of the current build.'), | 'build.id' => pht('The ID of the current build.'), | ||||
'target.phid' => pht('The PHID of the current build target.'), | 'target.phid' => pht('The PHID of the current build target.'), | ||||
'initiator.phid' => pht( | 'initiator.phid' => pht( | ||||
'The PHID of the user or Object that initiated the build, '. | 'The PHID of the user or Object that initiated the build, '. | ||||
'if applicable.'), | 'if applicable.'), | ||||
'buildable.phid' => pht( | |||||
'The object PHID of the Harbormaster Buildable being built.'), | |||||
'buildable.object.phid' => pht( | |||||
'The object PHID of the object (usually a diff or commit) '. | |||||
'being built.'), | |||||
'buildable.container.phid' => pht( | |||||
'The object PHID of the container (usually a revision or repository) '. | |||||
'for the object being built.'), | |||||
'build.phid' => pht( | |||||
'The object PHID of the Harbormaster Build being built.'), | |||||
); | ); | ||||
foreach ($objects as $object) { | foreach ($objects as $object) { | ||||
$variables[] = $object->getAvailableBuildVariables(); | $variables[] = $object->getAvailableBuildVariables(); | ||||
} | } | ||||
$variables = array_mergev($variables); | $variables = array_mergev($variables); | ||||
return $variables; | return $variables; | ||||
▲ Show 20 Lines • Show All 411 Lines • Show Last 20 Lines |