[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class HarbormasterLeaseHostBuildStepImplementation 4 extends HarbormasterBuildStepImplementation { 5 6 public function getName() { 7 return pht('Lease Host'); 8 } 9 10 public function getGenericDescription() { 11 return pht('Obtain a lease on a Drydock host for performing builds.'); 12 } 13 14 public function execute( 15 HarbormasterBuild $build, 16 HarbormasterBuildTarget $build_target) { 17 18 $settings = $this->getSettings(); 19 20 // Create the lease. 21 $lease = id(new DrydockLease()) 22 ->setResourceType('host') 23 ->setAttributes( 24 array( 25 'platform' => $settings['platform'], 26 )) 27 ->queueForActivation(); 28 29 // Wait until the lease is fulfilled. 30 // TODO: This will throw an exception if the lease can't be fulfilled; 31 // we should treat that as build failure not build error. 32 $lease->waitUntilActive(); 33 34 // Create the associated artifact. 35 $artifact = $build->createArtifact( 36 $build_target, 37 $settings['name'], 38 HarbormasterBuildArtifact::TYPE_HOST); 39 $artifact->setArtifactData(array( 40 'drydock-lease' => $lease->getID(), 41 )); 42 $artifact->save(); 43 } 44 45 public function getArtifactOutputs() { 46 return array( 47 array( 48 'name' => pht('Leased Host'), 49 'key' => $this->getSetting('name'), 50 'type' => HarbormasterBuildArtifact::TYPE_HOST, 51 ), 52 ); 53 } 54 55 public function getFieldSpecifications() { 56 return array( 57 'name' => array( 58 'name' => pht('Artifact Name'), 59 'type' => 'text', 60 'required' => true, 61 ), 62 'platform' => array( 63 'name' => pht('Platform'), 64 'type' => 'text', 65 'required' => true, 66 ), 67 ); 68 } 69 70 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |