Yes, it should be possible.
Something like the following:
GerritTriggeredEvent event = build.getCause(GerritCause.class).getEvent();
if (event instanceof ChangeBasedEvent) { //anything but ref-updated
ChangeBasedEvent ce = (ChangeBasedEvent)event;
List<String> files = ce.getFiles(
new
GerritQueryHandler(PluginImpl.getInstance().getServer(ce.getProvider().getName()).getConfig());
}
https://github.com/jenkinsci/gerrit-trigger-plugin/blob/master/gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritCause.java
https://github.com/jenkinsci/gerrit-trigger-plugin/blob/master/gerrit-events/src/main/java/com/sonyericsson/hudson/plugins/gerrit/gerritevents/dto/events/ChangeBasedEvent.java
The file list is "lazy loaded" via the query api the first time the list is
requested, so it could result in a roundtrip to the Gerrit server.
If a project on the Jenkins server is triggering on specific files for example
the list will be fetched then and available directly upon next request.
I will try but I cannot guarantee that the above code will work for all
eternity since it is using some of the plugin internals and refactorings tend
to happen from time to time.
Robert Sandell
Software Tools Engineer - SW Environment and Product Configuration
Sony Mobile Communications
From: [email protected] [mailto:[email protected]] On
Behalf Of Marcin Zajaczkowski
Sent: den 4 december 2013 13:53
To: [email protected]
Subject: [gerrit-trigger-plugin] Ability to read files modified in a review
which triggered a build
Hi. With the new GerritMessageProvider extension point it is possible to
provide file comments which will be sent back to Gerrit. In my plugin it would
be useful to get also a list of files modified in a review (in all patch sets?)
which triggered a build to narrow the scope of my analysis (to not process all
files in a large project where only 3 of them were modified).
Is it possible to get a list of modified files in gerrit-trigger-plugin?
Marcin
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.