1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-02 02:40:58 +01:00

Delete artifacts when restarting build

Summary: Fixes T4336.  This updates the build engine to delete all artifacts when targets are being deleted.  This prevents conflicts when builds are restarted.

Test Plan: Restarted a build that had a lease host step and it didn't crash.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Maniphest Tasks: T4336

Differential Revision: https://secure.phabricator.com/D8092
This commit is contained in:
James Rhodes 2014-01-28 20:17:03 -08:00 committed by epriestley
parent e9be9ecfbc
commit 51c4f697f9

View file

@ -101,6 +101,22 @@ final class HarbormasterBuildEngine extends Phobject {
->setViewer($this->getViewer())
->withBuildPHIDs(array($build->getPHID()))
->execute();
if (!$targets) {
return;
}
$target_phids = mpull($targets, 'getPHID');
$artifacts = id(new HarbormasterBuildArtifactQuery())
->setViewer($this->getViewer())
->withBuildTargetPHIDs($target_phids)
->execute();
foreach ($artifacts as $artifact) {
$artifact->delete();
}
foreach ($targets as $target) {
$target->delete();
}