Page MenuHomePhabricator

Allow Harbormaster build targets to wait for messages
ClosedPublic

Authored by epriestley on Apr 16 2014, 3:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 23, 6:35 PM
Unknown Object (File)
Fri, Apr 19, 5:59 PM
Unknown Object (File)
Fri, Apr 19, 3:33 AM
Unknown Object (File)
Fri, Apr 19, 3:33 AM
Unknown Object (File)
Fri, Apr 19, 3:33 AM
Unknown Object (File)
Fri, Apr 19, 3:33 AM
Unknown Object (File)
Tue, Apr 16, 4:09 PM
Unknown Object (File)
Mon, Apr 15, 6:40 PM
Subscribers

Details

Summary

This hooks up all the pieces of the build pipeline so harbormaster.sendmessage actually works. Particularly:

  • Candidate build steps (i.e., those which interact with external systems) can now "Wait for Message". This pauses them indefinitely when they complete, until something calls harbormaster.sendmessage.
  • After processing a target, we check if we should move it to PASSED or WAITING.
  • Before updating a build, we move WAITING targets with pending messages to either PASSED or FAILED.
  • I added an explicit "Building" state, which doesn't affect workflows but communicates more information to human users.

A big part of this is avoiding races. I believe we get the correct behavior no matter which order events occur in:

  • We update builds after targets complete and after we receive messages, so we're guaranteed to update once both these conditions are true. This means messages can't be lost (even if they arrive before a build completes).
  • The minor changes to the build engine logic mean that firing additional build updates is always safe, no matter what the current state of the build is.
  • The build itself is protected by a lock in the build engine.
  • The target is not covered by an explicit lock, but for all states only the engine (waiting) or the worker (all other states) can interact with it. All of the interactions also move the target state forward to the same destination and have no other side effects.
  • Messages are only consumed inside the engine lock, so they don't need an explicit lock.
Test Plan
  • Made an HTTP request wait after completion, then ran a pile of builds through it using bin/harbormaster build and the web UI.
  • Passed and failed message-awaiting builds with harbormaster.sendmessage.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Allow Harbormaster build targets to wait for messages.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
epriestley added a subscriber: zeeg.
  • Add missing string for "unknown" build states.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Apr 16 2014, 6:04 PM
epriestley updated this revision to Diff 20863.

Closed by commit rP78bf266bde4a (authored by @epriestley).