1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 21:32:43 +01:00

Prevent Harbormaster autobuilds from being stopped, paused or restarted

Summary: Fixes T8657. "Auto" builds are pushed into Harbormaster by an external system (currently, `arc`) so it does not make sense to stop or resume them: Harbormaster has no way to control the external system.

Test Plan:
  - Tried to restart an autobuild, got an error.
  - Restarted a normal build.
  - Did "Restart All" on a buildable, got restarts on non-autoplans and no restarts on autoplans.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8657

Differential Revision: https://secure.phabricator.com/D13812
This commit is contained in:
epriestley 2015-08-06 09:54:17 -07:00
parent a9763062f7
commit 580790cd6e

View file

@ -214,6 +214,10 @@ final class HarbormasterBuild extends HarbormasterDAO
$this->getBuildStatus() === self::STATUS_BUILDING;
}
public function isAutobuild() {
return ($this->getPlanAutoKey() !== null);
}
public function createLog(
HarbormasterBuildTarget $build_target,
$log_source,
@ -336,16 +340,28 @@ final class HarbormasterBuild extends HarbormasterDAO
}
public function canRestartBuild() {
if ($this->isAutobuild()) {
return false;
}
return !$this->isRestarting();
}
public function canStopBuild() {
if ($this->isAutobuild()) {
return false;
}
return !$this->isComplete() &&
!$this->isStopped() &&
!$this->isStopping();
}
public function canResumeBuild() {
if ($this->isAutobuild()) {
return false;
}
return $this->isStopped() &&
!$this->isResuming();
}