Ref T5936. This implements build implementations aborting early when the build has since been restarted. Build steps now periodically poll to see if the build's current generation does not match their generation, and they throw a HarbormasterBuildAbortedException if that is the case.
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Maniphest Tasks
- T5936: Support terminating builds, terminating remote processes and build steps
- Commits
- Restricted Diffusion Commit
rP51b34c054429: Abort previous build targets when a build is restarted
Tested locally on my machine with the sleep build step.
Diff Detail
Diff Detail
- Repository
- rP Phabricator
- Branch
- abort
- Lint
Lint Passed - Unit
Tests Passed - Build Status
Buildable 2328 Build 2332: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
src/applications/harbormaster/step/HarbormasterBuildStepImplementation.php | ||
---|---|---|
239 | Slightly cleaner as: $futures = Futures($future); foreach ($futures->setUpdateInterval(5) as $key => $future) { if ($future === null) { // Future has not resolved yet. $build->reload(); if (should abort) { throw; } } else { // Future has resolved. return $future->resolve(); } } As written, we'll spend most time in sleep() instead of select() and artificially limit how quickly we can transfer data to/from the subprocess over stdin/stdout. | |
src/applications/harbormaster/step/HarbormasterCommandBuildStepImplementation.php | ||
67–68 | We should clean this up at some point too but I want to fix the logging things anyway. | |
src/applications/harbormaster/step/HarbormasterSleepBuildStepImplementation.php | ||
32 | This is fine, sleepbuildstep is derp anyway |
Comment Actions
I updated the command build step while I was at it (from your comment, I understand that using setUpdateInterval allows it to pull more data from stderr / stdout faster?)
I tested this with a build plan that does "Lease Host" and "Run Command".