From 2b0f98900bcbffba081d6e97f77bcee44b8a3a59 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 14 Feb 2018 19:04:46 -0800 Subject: [PATCH] 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 --- .../20180214.harbor.01.aborted.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 resources/sql/autopatches/20180214.harbor.01.aborted.php diff --git a/resources/sql/autopatches/20180214.harbor.01.aborted.php b/resources/sql/autopatches/20180214.harbor.01.aborted.php new file mode 100644 index 0000000000..689d5625f5 --- /dev/null +++ b/resources/sql/autopatches/20180214.harbor.01.aborted.php @@ -0,0 +1,27 @@ +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()); +}