-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aggregate buildStarted messages based on interval provided by user
- Loading branch information
Showing
14 changed files
with
740 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,8 @@ | |
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Start position that notifies Gerrit of events. | ||
* @author Robert Sandell <[email protected]> | ||
|
@@ -70,18 +72,24 @@ public GerritNotifier(IGerritHudsonTriggerConfig config, GerritCmdRunner cmdRunn | |
|
||
/** | ||
* Generates the build-started command based on configured templates and build-values and sends it to Gerrit. | ||
* @param build the build. | ||
* @param builds the builds. | ||
* @param taskListener the taskListener. | ||
* @param event the event. | ||
* @param stats the stats. | ||
*/ | ||
public void buildStarted(Run build, TaskListener taskListener, | ||
GerritTriggeredEvent event, BuildsStartedStats stats) { | ||
public void buildStarted(List<Run> builds, TaskListener taskListener, | ||
GerritTriggeredEvent event, BuildsStartedStats stats) { | ||
try { | ||
/* Without a change, it doesn't make sense to notify gerrit */ | ||
if (event instanceof ChangeBasedEvent) { | ||
String command = | ||
parameterExpander.getBuildStartedCommand(build, taskListener, (ChangeBasedEvent)event, stats); | ||
String command; | ||
if (builds.size() == 1) { | ||
command = parameterExpander.getBuildStartedCommand(builds.get(0), taskListener, | ||
(ChangeBasedEvent)event, stats); | ||
} else { | ||
command = parameterExpander.getBuildsStartedCommand(builds, taskListener, | ||
(ChangeBasedEvent)event, stats); | ||
} | ||
if (command != null) { | ||
if (!command.isEmpty()) { | ||
logger.info("Notifying BuildStarted to gerrit: {}", command); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.