Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger on ref-updated #21

Merged
merged 14 commits into from May 11, 2012

Conversation

Projects
None yet
3 participants
@jeblair
Copy link
Member

commented Apr 3, 2012

This is an update to the trigger on comment-added branch in #9 that adds ref-updated support. The OpenStack project has been using this branch in production for a month. Pull request #9 left off with some outstanding issues:

  • before scheduling a build a check if a build is already running for the same thing as the current event, and if it is don't schedule a build. (see #9 for more details)
  • unit tests
  • isScorable() is never called, to differ between scorable and non-scorable events.

Contributions welcome.

dpursehouse and others added some commits Jun 7, 2011

WiP: Add support for triggering jobs on the change-merged event
Added a new event ChangeMerged to encapsulate the change-merged Gerrit
event, and added a new class GerritTriggeredEvent from which all event
classes are now derived.

Existing code is refactored to use GerritTriggeredEvent instead of
PatchsetCreated.

Since not all Gerrit events can be scored, extended the GerritEvent
interface to include a new method isScorable.
Add triggering on comment-added.
Add new CommentAdded event class.
Add config option to trigger on comment-added event with a specific vote
category and value, ie, trigger on CRVW 2 (approved code review).
Fix problem with config screen not correctly displaying selected trigger.
Change TriggerContextConverter to use GerritTriggerEvent superclass
rather than PatchsetCreated event.
Use event as key in BuildMemory.
Removes PatchSetKey class which was used as the key to a build memory.
Replaces it with simply using the event as they key (a custom comparator
is used to ensure that the java.lang.Object hashcode is used as the key).

Also add the hash of the event as an extra build parameter.  This allows
otherwise duplicate builds to be scheduled.

Together, these changes ensure that every Gerrit event triggers a full
complement of the jobs that are listening for it, all of them are
scheduled, and all of them report back to Gerrit as a unit, even if
multiple events of the same type and for the same change arrive.
Add uploader field back to PatchsetCreated.
Add GERRIT_EVENT_ACCOUNT* parameters to build, which represent the
account info of the person who uploaded/authored/abandoned, etc.,
whatever caused the event.
Add Approval DTO.
CommentAdded has Approvals now, which are checked in GerritTrigger before
scheduling builds triggered by CommentAdded events.
Add findUploader back.
Restore behavior expected by test suite with regard to patchset.uploader
or event uploader being null.
Remove readObject.
We don't need to fix up the attributes after deserialization, we just
need the old field marked transient and the deserializer won't complain.
Fix comment added implementation.
Typos from refactoring.
Add RefUpdate event type.
Many parts of the code assume that an event has a non-null change attributes.
Ref-updated events don't so add checks to see if change is null throughout the plugin.
Merge branch 'trigger-on-comment-added-2' into trigger-on-ref-updated-2
Conflicts:
	gerrit-events/src/main/java/com/sonyericsson/hudson/plugins/gerrit/gerritevents/dto/GerritEventKeys.java
	gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/gerritnotifier/model/BuildMemory.java
	gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTrigger.java
	gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerParameters.java
	gerrithudsontrigger/src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerTest.java
	gerrithudsontrigger/src/test/java/com/sonyericsson/hudson/plugins/gerrit/trigger/mock/DuplicatesUtil.java
@rsandell

This comment has been minimized.

Copy link
Member

commented May 10, 2012

Ok,
I'll merge this in and start to work on the things we've discussed in #9
I might also do some corrections coding style wise since we both seems to be low on spare time. If I change too much in the behaviour make some noise, but it seems like we are on the same page.

@rsandell rsandell merged commit d9b7e37 into jenkinsci:master May 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.