Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15418452
D17139.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D17139.id.diff
View Options
diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -502,6 +502,10 @@
return null;
}
+ public function getHarbormasterPublishablePHID() {
+ return $this->getHarbormasterContainerPHID();
+ }
+
public function getBuildVariables() {
$results = array();
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -513,6 +513,10 @@
return $this->getPHID();
}
+ public function getHarbormasterPublishablePHID() {
+ return $this->getPHID();
+ }
+
public function getBuildVariables() {
return array();
}
diff --git a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php
--- a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php
+++ b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php
@@ -497,17 +497,28 @@
return;
}
- if (!($object instanceof PhabricatorApplicationTransactionInterface)) {
+ $publish_phid = $object->getHarbormasterPublishablePHID();
+ if (!$publish_phid) {
return;
}
- // TODO: Publishing these transactions is causing a race. See T8650.
- // We shouldn't be publishing to diffs anyway.
- if ($object instanceof DifferentialDiff) {
+ if ($publish_phid === $object->getPHID()) {
+ $publish = $object;
+ } else {
+ $publish = id(new PhabricatorObjectQuery())
+ ->setViewer($viewer)
+ ->withPHIDs(array($publish_phid))
+ ->executeOne();
+ if (!$publish) {
+ return;
+ }
+ }
+
+ if (!($publish instanceof PhabricatorApplicationTransactionInterface)) {
return;
}
- $template = $object->getApplicationTransactionTemplate();
+ $template = $publish->getApplicationTransactionTemplate();
if (!$template) {
return;
}
@@ -526,7 +537,7 @@
$daemon_source = PhabricatorContentSource::newForSource(
PhabricatorDaemonContentSource::SOURCECONST);
- $editor = $object->getApplicationTransactionEditor()
+ $editor = $publish->getApplicationTransactionEditor()
->setActor($viewer)
->setActingAsPHID($harbormaster_phid)
->setContentSource($daemon_source)
@@ -534,7 +545,7 @@
->setContinueOnMissingFields(true);
$editor->applyTransactions(
- $object->getApplicationTransactionObject(),
+ $publish->getApplicationTransactionObject(),
array($template));
}
diff --git a/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php b/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php
--- a/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php
+++ b/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php
@@ -18,6 +18,21 @@
public function getHarbormasterBuildablePHID();
public function getHarbormasterContainerPHID();
+
+ /**
+ * Get the object PHID which build status should be published to.
+ *
+ * In some cases (like commits), this is the object itself. In other cases,
+ * it is a different object: for example, diffs publish builds to revisions.
+ *
+ * This method can return `null` to disable publishing.
+ *
+ * @return phid|null Build status updates will be published to this object's
+ * transaction timeline.
+ */
+ public function getHarbormasterPublishablePHID();
+
+
public function getBuildVariables();
public function getAvailableBuildVariables();
diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php
--- a/src/applications/harbormaster/storage/HarbormasterBuildable.php
+++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php
@@ -317,6 +317,10 @@
return $this->getContainerPHID();
}
+ public function getHarbormasterPublishablePHID() {
+ return $this->getBuildableObject()->getHarbormasterPublishablePHID();
+ }
+
public function getBuildVariables() {
return array();
}
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
--- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -413,6 +413,10 @@
return $this->getRepository()->getPHID();
}
+ public function getHarbormasterPublishablePHID() {
+ return $this->getPHID();
+ }
+
public function getBuildVariables() {
$results = array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 11:26 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7708073
Default Alt Text
D17139.id.diff (4 KB)
Attached To
Mode
D17139: Allow Harbormaster builds to publish to a different object
Attached
Detach File
Event Timeline
Log In to Comment