Differential D14368 Diff 34695 src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
Show All 35 Lines | if ($lease_phid) { | ||||
pht( | pht( | ||||
'Lease "%s" could not be loaded.', | 'Lease "%s" could not be loaded.', | ||||
$lease_phid)); | $lease_phid)); | ||||
} | } | ||||
} else { | } else { | ||||
$working_copy_type = id(new DrydockWorkingCopyBlueprintImplementation()) | $working_copy_type = id(new DrydockWorkingCopyBlueprintImplementation()) | ||||
->getType(); | ->getType(); | ||||
$allowed_phids = $build_target->getFieldValue('repositoryPHIDs'); | $allowed_phids = $build_target->getFieldValue('blueprintPHIDs'); | ||||
if (!is_array($allowed_phids)) { | |||||
$allowed_phids = array(); | |||||
} | |||||
$authorizing_phid = $build_target->getBuildStep()->getPHID(); | $authorizing_phid = $build_target->getBuildStep()->getPHID(); | ||||
$lease = DrydockLease::initializeNewLease() | $lease = DrydockLease::initializeNewLease() | ||||
->setResourceType($working_copy_type) | ->setResourceType($working_copy_type) | ||||
->setOwnerPHID($build_target->getPHID()) | ->setOwnerPHID($build_target->getPHID()) | ||||
->setAuthorizingPHID($authorizing_phid) | ->setAuthorizingPHID($authorizing_phid) | ||||
->setAllowedBlueprintPHIDs($allowed_phids); | ->setAllowedBlueprintPHIDs($allowed_phids); | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | private function buildRepositoryMap(HarbormasterBuildTarget $build_target) { | ||||
foreach ($also_phids as $also_phid) { | foreach ($also_phids as $also_phid) { | ||||
$also_repo = $repositories[$also_phid]; | $also_repo = $repositories[$also_phid]; | ||||
$map[$also_repo->getCloneName()] = array( | $map[$also_repo->getCloneName()] = array( | ||||
'phid' => $also_repo->getPHID(), | 'phid' => $also_repo->getPHID(), | ||||
'branch' => 'master', | 'branch' => 'master', | ||||
); | ); | ||||
} | } | ||||
$repository = $repositories[$repository_phid]; | $repository = $repositories[$repository_phid]; | ||||
$commit = idx($variables, 'buildable.commit'); | $commit = idx($variables, 'buildable.commit'); | ||||
$ref_uri = idx($variables, 'repository.staging.uri'); | $ref_uri = idx($variables, 'repository.staging.uri'); | ||||
$ref_ref = idx($variables, 'repository.staging.ref'); | $ref_ref = idx($variables, 'repository.staging.ref'); | ||||
if ($commit) { | if ($commit) { | ||||
$spec = array( | $spec = array( | ||||
'commit' => $commit, | 'commit' => $commit, | ||||
); | ); | ||||
} else if ($ref_uri && $ref_ref) { | } else if ($ref_uri && $ref_ref) { | ||||
$spec = array( | $spec = array( | ||||
'ref' => array( | 'ref' => array( | ||||
'uri' => $ref_uri, | 'uri' => $ref_uri, | ||||
'ref' => $ref_ref, | 'ref' => $ref_ref, | ||||
), | ), | ||||
); | ); | ||||
} else { | } else { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unable to determine how to fetch changes: this buildable does not '. | 'Unable to determine how to fetch changes: this buildable does not '. | ||||
'identify a commit or a staging ref. You may need to configure a '. | 'identify a commit or a staging ref. You may need to configure a '. | ||||
'repository staging area.')); | 'repository staging area.')); | ||||
} | } | ||||
$directory = $repository->getCloneName(); | $directory = $repository->getCloneName(); | ||||
$map[$directory] = array( | $map[$directory] = array( | ||||
'phid' => $repository->getPHID(), | 'phid' => $repository->getPHID(), | ||||
'default' => true, | 'default' => true, | ||||
) + $spec; | ) + $spec; | ||||
epriestley: Here's where we explicitly configure the lease to clone the buildable's repository, no matter… | |||||
Not Done Inline ActionsThat was what I though. I wasn't sure about it though. tycho.tatitscheff: That was what I though. I wasn't sure about it though.
Thanks for confirming. | |||||
return $map; | return $map; | ||||
} | } | ||||
} | } |
Here's where we explicitly configure the lease to clone the buildable's repository, no matter what Also Clone is set to.