Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14406199
D18721.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
D18721.diff
View Options
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
@@ -721,9 +721,10 @@
return array();
}
- $builds = id(new HarbormasterBuildQuery())
+ return id(new HarbormasterBuildQuery())
->setViewer($viewer)
->withBuildablePHIDs(mpull($buildables, 'getPHID'))
+ ->withAutobuilds(false)
->withBuildStatuses(
array(
HarbormasterBuildStatus::STATUS_INACTIVE,
@@ -735,29 +736,7 @@
HarbormasterBuildStatus::STATUS_PAUSED,
HarbormasterBuildStatus::STATUS_DEADLOCKED,
))
- ->needBuildTargets(true)
->execute();
- if (!$builds) {
- return array();
- }
-
- $active = array();
- foreach ($builds as $key => $build) {
- foreach ($build->getBuildTargets() as $target) {
- if ($target->isAutotarget()) {
- // Ignore autotargets when looking for active of failed builds. If
- // local tests fail and you continue anyway, you don't need to
- // double-confirm them.
- continue;
- }
-
- // This build has at least one real target that's doing something.
- $active[$key] = $build;
- break;
- }
- }
-
- return $active;
}
diff --git a/src/applications/harbormaster/query/HarbormasterBuildQuery.php b/src/applications/harbormaster/query/HarbormasterBuildQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildQuery.php
@@ -10,6 +10,7 @@
private $buildPlanPHIDs;
private $initiatorPHIDs;
private $needBuildTargets;
+ private $autobuilds;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -41,6 +42,11 @@
return $this;
}
+ public function withAutobuilds($with_autobuilds) {
+ $this->autobuilds = $with_autobuilds;
+ return $this;
+ }
+
public function needBuildTargets($need_targets) {
$this->needBuildTargets = $need_targets;
return $this;
@@ -141,50 +147,87 @@
if ($this->ids !== null) {
$where[] = qsprintf(
$conn,
- 'id IN (%Ld)',
+ 'b.id IN (%Ld)',
$this->ids);
}
if ($this->phids !== null) {
$where[] = qsprintf(
$conn,
- 'phid in (%Ls)',
+ 'b.phid in (%Ls)',
$this->phids);
}
if ($this->buildStatuses !== null) {
$where[] = qsprintf(
$conn,
- 'buildStatus in (%Ls)',
+ 'b.buildStatus in (%Ls)',
$this->buildStatuses);
}
if ($this->buildablePHIDs !== null) {
$where[] = qsprintf(
$conn,
- 'buildablePHID IN (%Ls)',
+ 'b.buildablePHID IN (%Ls)',
$this->buildablePHIDs);
}
if ($this->buildPlanPHIDs !== null) {
$where[] = qsprintf(
$conn,
- 'buildPlanPHID IN (%Ls)',
+ 'b.buildPlanPHID IN (%Ls)',
$this->buildPlanPHIDs);
}
if ($this->initiatorPHIDs !== null) {
$where[] = qsprintf(
$conn,
- 'initiatorPHID IN (%Ls)',
+ 'b.initiatorPHID IN (%Ls)',
$this->initiatorPHIDs);
}
+ if ($this->autobuilds !== null) {
+ if ($this->autobuilds) {
+ $where[] = qsprintf(
+ $conn,
+ 'p.planAutoKey IS NOT NULL');
+ } else {
+ $where[] = qsprintf(
+ $conn,
+ 'p.planAutoKey IS NULL');
+ }
+ }
+
return $where;
}
+ protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) {
+ $joins = parent::buildJoinClauseParts($conn);
+
+ if ($this->shouldJoinPlanTable()) {
+ $joins[] = qsprintf(
+ $conn,
+ 'JOIN %T p ON b.buildPlanPHID = p.phid',
+ id(new HarbormasterBuildPlan())->getTableName());
+ }
+
+ return $joins;
+ }
+
+ private function shouldJoinPlanTable() {
+ if ($this->autobuilds !== null) {
+ return true;
+ }
+
+ return false;
+ }
+
public function getQueryApplicationClass() {
return 'PhabricatorHarbormasterApplication';
}
+ protected function getPrimaryTableAlias() {
+ return 'b';
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 10:18 AM (19 h, 31 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6923504
Default Alt Text
D18721.diff (4 KB)
Attached To
Mode
D18721: Simply how Differential drafts ignore Harbormaster autobuilds
Attached
Detach File
Event Timeline
Log In to Comment