1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 05:50:55 +01:00

Fail outstanding buildables with aborted builds

Summary:
Ref T13072. See PHI361. The bug in T10746 where aborting builds didn't propagate properly to the buildable was fixed, but existing builds are still stuck "Building".

Since it doesn't look like anything will moot this before these changes promote to `stable`, just migrate these builds into "failed".

Test Plan: Ran migration, saw it affect only relevant builds and correctly fail them.

Maniphest Tasks: T13072

Differential Revision: https://secure.phabricator.com/D19091
This commit is contained in:
epriestley 2018-02-14 19:04:46 -08:00
parent fe294d4034
commit 2b0f98900b

View file

@ -0,0 +1,27 @@
<?php
$table = new HarbormasterBuildable();
$conn = $table->establishConnection('w');
foreach (new LiskMigrationIterator($table) as $buildable) {
if ($buildable->getBuildableStatus() !== 'building') {
continue;
}
$aborted = queryfx_one(
$conn,
'SELECT * FROM %T WHERE buildablePHID = %s AND buildStatus = %s',
id(new HarbormasterBuild())->getTableName(),
$buildable->getPHID(),
'aborted');
if (!$aborted) {
continue;
}
queryfx(
$conn,
'UPDATE %T SET buildableStatus = %s WHERE id = %d',
$table->getTableName(),
'failed',
$buildable->getID());
}