-
Notifications
You must be signed in to change notification settings - Fork 275
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
Merge job started messages based on aggregation interval #313
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Halfway through.
@@ -70,7 +70,7 @@ public String getBuildStartedMessage(Run build) { | |||
*/ | |||
@Deprecated | |||
public String getBuildStartedMessage(AbstractBuild build) { | |||
if (thisOverrides("getBuildStartedMessage", Run.class)) { | |||
if (thisOverrides("getBuildsStartedMessage", Run.class)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unrelated and wrong.
Or maybe not when reading the rest of the PR, but it does still look wrong, since the check is if a specific method is overridden and in that case that method should be called, but the method checked for is not the method getting called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
minVerified, | ||
Notify.ALL.name()); | ||
|
||
parameters.put("BUILDURL", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it would have been better if we could change the command templates and separate the message part with the actual command part. And then in case of a compound message like this the message part would be just two messages correctly expanded with BUILDURL
and all and added to the one command.
This seems a bit hacky to me as it omits certain variables in case an admin has changed the message format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it, because it was already like that implemented for Completed
message (it just ignored BUILDURL
) completely :). I don't want to touch template part in my PR, but I can add more details in help
section.
if (entry == null) { | ||
continue; | ||
} | ||
runs.add(entry.getBuild()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getBuild()
can also be null
if jobs have been triggered but not yet started.
Even though you take care of potential null
entries below it is safest if we can omit them all together in the source in case some other caller isn't that foreseeing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
* @param listener listener | ||
* @param event event | ||
* @param stats stats | ||
* @return the message for the build started command. | ||
*/ | ||
public String getBuildStartedMessage(Run build, TaskListener listener, ChangeBasedEvent event, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still nervous of removing signatures like this, even though it should be safe in this context as only careless plugina uthors would rely on this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, I can restore this one and mark like @Depracated
Hello, we need same behavior not only for "started message", but with entire build triggers, because with topic upload to the gerrit had triggers many jobs with same changesets. May be I can open a feature request in JIRA? |
@neonman63, what do you mean by "entire build triggers"? In our case we received two types of messages:
|
We push code with repo tool in 4 project with topic and this triggers 4 jobs. In each job we use python-script, which get code in each project by topic (rest api requests to gerrit for getting depended changesets). Finally, it sets 4 +1 votes (or -1) in each changesets with same topic and with same build results. |
1b0d3e2
to
f3ed5d0
Compare
@rsandell can we follow up on it? Our devs are happy to have less messages in Gerrit. |
1edbeab
to
5a07dfe
Compare
@Jimilian yea, the PR is just so big I have a hard time finding gaps in my day big enough to review it :'( |
5a07dfe
to
a080c07
Compare
@neonman63 btw, there is a new feature "abort same topic". |
@Jimilian Abort topic insist on the same git repo right? I mean if you have multiple patches on different repo with the same topic multiple job are anyway triggered or it's a way to define one job? |
@panicking current implementation aborts all executions regardless project, because it assumes that topic used at moment of start is out-dated already.
Abort same topic is only one part of this big picture. |
@Jimilian So we can't use this plugin as it is to run one job for same topic but you need to have a modified version of it |
If multiple jobs are configured to be triggered by GTP it can be too annoyning to get feedback/notification from each of them.
a080c07
to
4bdda1f
Compare
The main goal of this PR is to reduce number of notification user receives from Gerrit Trigger Plugin.
It allows users to specify "aggregation interval", so all jobs that were started in this interval would merge buildStarted message in one.
I.e. you do aggregation interval 10 seconds, after that 3 builds are started:
PR will merge
build1
andbuild2
, so, plugin will sendAfter that
build3
will be sent separately:We already are using this feature in production (since previous week), looks good.