Page MenuHomePhabricator

D13689.id33089.diff
No OneTemporary

D13689.id33089.diff

Index: src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
===================================================================
--- src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
+++ src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php
@@ -236,6 +236,7 @@
$host_lease = id(new DrydockLease())
->setResourceType('host')
+ ->setOwnerPHID($lease->getPHID())
->setAttributes(
array(
'platform' => $lease->getAttribute('platform'),
@@ -243,9 +244,11 @@
->waitUntilActive();
$lease->setAttribute('host.lease', $host_lease->getID());
+ $lease->setAttribute('host.lease.phid', $host_lease->getPHID());
list($cache_lease, $source_url) = $this->tryAcquireWorkingCopyCache(
$host_lease->getResource(),
+ $lease,
$lease->getAttribute('resolved.repositoryURL'));
$cmd = $this->getCommandInterfaceForLease($lease);
@@ -306,6 +309,7 @@
$this->initializeGitSubmodules(
$host_lease,
+ $lease,
$host_lease->getAttribute('path'));
}
@@ -321,13 +325,16 @@
private function tryAcquireWorkingCopyCache(
DrydockResource $host_resource,
+ DrydockLease $owner_lease,
$url) {
$cache_lease = id(new DrydockLease())
->setResourceType('working-copy-cache')
+ ->setOwnerPHID($owner_lease->getPHID())
->setAttributes(
array(
'host.resource' => $host_resource->getID(),
+ 'host.resource.phid' => $host_resource->getPHID(),
'url' => $url,
))
->queueForActivation();
@@ -392,6 +399,7 @@
private function initializeGitSubmodules(
DrydockLease $target_lease,
+ DrydockLease $owner_lease,
$target_path = null) {
$cmd = $this->getCommandInterfaceForLease($target_lease);
@@ -431,6 +439,7 @@
foreach ($submodules as $name => $url) {
list($cache_lease, $source_url) = $this->tryAcquireWorkingCopyCache(
$target_lease->getResource(),
+ $owner_lease,
$url);
$this->log(pht(
@@ -451,6 +460,7 @@
$this->initializeGitSubmodules(
$target_lease,
+ $owner_lease,
$target_path.'/'.$name);
$this->log(pht(
Index: src/applications/drydock/blueprint/DrydockWorkingCopyCacheBlueprintImplementation.php
===================================================================
--- src/applications/drydock/blueprint/DrydockWorkingCopyCacheBlueprintImplementation.php
+++ src/applications/drydock/blueprint/DrydockWorkingCopyCacheBlueprintImplementation.php
@@ -95,7 +95,9 @@
$host_lease->getID()));
$resource
+ ->setAttribute('host.resource.phid', $host_lease->getResourcePHID())
->setAttribute('host.lease', $host_lease->getID())
+ ->setAttribute('host.lease.phid', $host_lease->getPHID())
->save();
$this->log(pht(
Index: src/applications/drydock/controller/DrydockLeaseViewController.php
===================================================================
--- src/applications/drydock/controller/DrydockLeaseViewController.php
+++ src/applications/drydock/controller/DrydockLeaseViewController.php
@@ -171,9 +171,32 @@
$attributes = $lease->getAttributes();
if ($attributes) {
+ $phids = array();
+ foreach ($attributes as $key => $value) {
+ if (strlen($key) > 5 && substr($key, -5) === '.phid' ||
+ strlen($key) > 4 && substr($key, -4) === 'PHID') {
+ $phids[] = $value;
+ }
+ }
+
+ $handles = id(new PhabricatorHandleQuery())
+ ->setViewer($this->getRequest()->getViewer())
+ ->withPHIDs($phids)
+ ->execute();
+
$view->addSectionHeader(pht('Attributes'));
foreach ($attributes as $key => $value) {
- $view->addProperty($key, $value);
+ if (strlen($key) > 5 && substr($key, -5) === '.phid' ||
+ strlen($key) > 4 && substr($key, -4) === 'PHID') {
+ $handle = idx($handles, $value);
+ if ($handle !== null) {
+ $view->addProperty($key, $handle->renderLink());
+ } else {
+ $view->addProperty($key, phutil_tag('em', array(), $value));
+ }
+ } else {
+ $view->addProperty($key, $value);
+ }
}
}
Index: src/applications/drydock/controller/DrydockResourceViewController.php
===================================================================
--- src/applications/drydock/controller/DrydockResourceViewController.php
+++ src/applications/drydock/controller/DrydockResourceViewController.php
@@ -139,9 +139,32 @@
$attributes = $resource->getAttributes();
if ($attributes) {
+ $phids = array();
+ foreach ($attributes as $key => $value) {
+ if (strlen($key) > 5 && substr($key, -5) === '.phid' ||
+ strlen($key) > 4 && substr($key, -4) === 'PHID') {
+ $phids[] = $value;
+ }
+ }
+
+ $handles = id(new PhabricatorHandleQuery())
+ ->setViewer($this->getRequest()->getViewer())
+ ->withPHIDs($phids)
+ ->execute();
+
$view->addSectionHeader(pht('Attributes'));
foreach ($attributes as $key => $value) {
- $view->addProperty($key, $value);
+ if (strlen($key) > 5 && substr($key, -5) === '.phid' ||
+ strlen($key) > 4 && substr($key, -4) === 'PHID') {
+ $handle = idx($handles, $value);
+ if ($handle !== null) {
+ $view->addProperty($key, $handle->renderLink());
+ } else {
+ $view->addProperty($key, phutil_tag('em', array(), $value));
+ }
+ } else {
+ $view->addProperty($key, $value);
+ }
}
}
Index: src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
===================================================================
--- src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
+++ src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php
@@ -20,6 +20,7 @@
// Create the lease.
$lease = id(new DrydockLease())
->setResourceType('working-copy')
+ ->setOwnerPHID($build_target->getPHID())
->setAttributes(
array(
'platform' => $settings['platform'],

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 12:19 AM (9 h, 17 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6905147
Default Alt Text
D13689.id33089.diff (6 KB)

Event Timeline