Differential D13932 Diff 33630 src/applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/step/HarbormasterUploadArtifactBuildStepImplementation.php
Show All 19 Lines | return pht( | ||||
'Upload %s from %s.', | 'Upload %s from %s.', | ||||
$this->formatSettingForDescription('path'), | $this->formatSettingForDescription('path'), | ||||
$this->formatSettingForDescription('hostartifact')); | $this->formatSettingForDescription('hostartifact')); | ||||
} | } | ||||
public function execute( | public function execute( | ||||
HarbormasterBuild $build, | HarbormasterBuild $build, | ||||
HarbormasterBuildTarget $build_target) { | HarbormasterBuildTarget $build_target) { | ||||
$viewer = PhabricatorUser::getOmnipotentUser(); | |||||
$settings = $this->getSettings(); | $settings = $this->getSettings(); | ||||
$variables = $build_target->getVariables(); | $variables = $build_target->getVariables(); | ||||
$path = $this->mergeVariables( | $path = $this->mergeVariables( | ||||
'vsprintf', | 'vsprintf', | ||||
$settings['path'], | $settings['path'], | ||||
$variables); | $variables); | ||||
$artifact = $build_target->loadArtifact($settings['hostartifact']); | $artifact = $build_target->loadArtifact($settings['hostartifact']); | ||||
$lease = $artifact->loadDrydockLease(); | $impl = $artifact->getArtifactImplementation(); | ||||
$lease = $impl->loadArtifactLease($viewer); | |||||
$interface = $lease->getInterface('filesystem'); | $interface = $lease->getInterface('filesystem'); | ||||
// TODO: Handle exceptions. | // TODO: Handle exceptions. | ||||
$file = $interface->saveFile($path, $settings['name']); | $file = $interface->saveFile($path, $settings['name']); | ||||
// Insert the artifact record. | // Insert the artifact record. | ||||
$artifact = $build_target->createArtifact( | $artifact = $build_target->createArtifact( | ||||
PhabricatorUser::getOmnipotentUser(), | $viewer, | ||||
epriestley: I think pull this out as `$viewer` and pass it to loadArtifactLease too, then you're good to go. | |||||
$settings['name'], | $settings['name'], | ||||
HarbormasterFileArtifact::ARTIFACTCONST, | HarbormasterFileArtifact::ARTIFACTCONST, | ||||
array( | array( | ||||
'filePHID' => $file->getPHID(), | 'filePHID' => $file->getPHID(), | ||||
)); | )); | ||||
} | } | ||||
public function getArtifactInputs() { | public function getArtifactInputs() { | ||||
Show All 40 Lines |
I think pull this out as $viewer and pass it to loadArtifactLease too, then you're good to go.