Page MenuHomePhabricator

Show command transactions in Harbormaster builds
ClosedPublic

Authored by avivey on May 13 2014, 10:22 PM.
Tags
None
Referenced Files
F14475560: D9110.id21645.diff
Fri, Dec 27, 7:26 PM
Unknown Object (File)
Mon, Dec 23, 9:47 AM
Unknown Object (File)
Mon, Dec 23, 9:47 AM
Unknown Object (File)
Mon, Dec 23, 9:46 AM
Unknown Object (File)
Mon, Dec 23, 9:46 AM
Unknown Object (File)
Mon, Dec 23, 9:46 AM
Unknown Object (File)
Mon, Dec 23, 9:46 AM
Unknown Object (File)
Mon, Dec 16, 6:00 AM
Subscribers

Details

Summary

Create transaction, editor, etc, and move command generation over to editor.
Show in a timeline in the buildable page.

Also prevent Engine from creating an empty transaction when build starts (Fixes T4885).

Fixes T4886.

Test Plan

Restart builds and buildables, look at timeline.

Diff Detail

Repository
rP Phabricator
Branch
harbormaster_txs
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 446
Build 446: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

avivey retitled this revision from to Show command transactions in Harbormaster builds.
avivey updated this object.
avivey edited the test plan for this revision. (Show Details)
avivey added a reviewer: epriestley.

I may have gone too far here by moving the command creation to the editor.

undefined (256×402 px, 19 KB)

src/applications/harbormaster/editor/HarbormasterBuildableTransactionEditor.php
67

I had to explicitly attach the build to the buildable in the right place... What's a better alternative?
In this scope I'm not sure there's a user (There's an author PHID) for a query...

src/applications/transactions/storage/PhabricatorApplicationTransaction.php
650–655

This makes the now-empty transactions render something.
OTOH, they are not generated any more.

669

I'll fix that.

avivey edited edge metadata.
  • fix slip-ups
epriestley edited edge metadata.

Oh! Sorry, I forgot exactly how this was put together. 90% of this looks good, but I think we should adjust it slightly:

  • When the actual command is issued to a build, record a transaction on the Build, not the Buildable. Issuing the actual command from within the Editor is fine and desirable, just move that bit to the BuildableEditor instead of the BuildEditor.
  • Record a transaction on the Buildable only for the Buildable-level commands -- and this one is probably best as a pure no-op. So the Buildable-level command looks like:

    $editor->applyTransactions($buildable, ...); foreach ($buildable->getBuilds() as $build) { // ... $build->applyTransctions($build, ...); }
  • So we'll end up with two TYPE_COMMAND transactions, one on the Buildable (meaning "the entire buildable was restarted") and one on the Build (meaning "this build was restarted").
src/applications/harbormaster/controller/HarbormasterBuildActionController.php
58

This would swap to BuildTransactionEditor.

69–70

This should be a little simpler after that change.

src/applications/harbormaster/controller/HarbormasterBuildableActionController.php
59–69

This is perfect, but then do a loop with BuildTransactionEditors.

src/applications/harbormaster/controller/HarbormasterBuildableViewController.php
56

(Minor whitespace.)

src/applications/harbormaster/editor/HarbormasterBuildableTransactionEditor.php
50

I'd just no-op this and lift the loop out.

src/applications/harbormaster/storage/HarbormasterBuildableTransaction.php
3

This all looks perfect.

108

array_merge() has perf issues when used like this, prefer:

$phids = parent::getRequiredHandlePHIDs();
if ($this->getBuildPHID()) {
  $phids[] = ...;
}
return $phids;
This revision now requires changes to proceed.May 13 2014, 10:39 PM

But then won't we see each action n times?

<< a restarted this buildable
<< a restarted Build 1: some build
<< a restarted Build 2: some other build
In D9110#14, @avivey wrote:

But then won't we see each action n times?

The Buildable will only show the top-level transaction ("alincoln restarted this entire buildable."). The Builds would each show one transaction ("alincoln restarted this specific build."). Feed would have a pile of mess but we should just keep these out of feed/mail/notifications since they're not very important.

avivey edited edge metadata.
  • make BuildTransaction, move code there
avivey requested a review of this revision.May 14 2014, 11:01 PM
epriestley edited edge metadata.

This is beautiful, thanks!

This revision is now accepted and ready to land.May 15 2014, 2:02 PM
resources/sql/patches/20140514.harbormasterbuildabletransaction.sql
2

Oh -- one minor thing that I'll fix in the pull:

To get this to automatically apply now, drop it in autopatches/ instead of patches/. The fix is just to move the file.

Old stuff in patches/ needed additional boilerplate "actually apply this patch" code which was really redundant and silly so we ditched it a while ago. There might be some docs I need to update somewhere.

epriestley updated this revision to Diff 21699.

Closed by commit rPf2c0e94ea821 (authored by @avivey, committed by @epriestley).