4

We are using the Parameterized Builds plugin and a matrix combination parameter. So now, when we build this job, we select which of the combinations we want to build and one "child job" is created for each one that is selected.

Each of these jobs runs their build steps and post build actions. However, I have also noticed that the post build actions run for the "parent job" as well.

For example, we have the job configured to post a message to Slack upon success. Now, if I build the job with parameters and select one configuration to build, I will get two Slack notifications. One for the main job and one for the selected configuration.

Example Slack output, note one with the config selected and one without:

| My Jenkins Project » My Job » my config - #51 Success after 1 min 54 sec (Open)
| My Jenkins Project » My Job - #51 Success after 1 min 55 sec (Open)

So my question is, how can I prevent post build actions from running on the main job?


EDIT: Since creating this question I found this GitHub issue on the Slack plugin that describes exactly what I'm seeing. So it looks like this functionality should be up to the plugins and that a new version caused a regression in this particular plugin.

Perhaps the question is better suited as: Is it a plugin's responsibility to determine whether it is running in the global job or in a configuration job as part of a multi-configuration project?

Matt Dodge
  • 10,833
  • 7
  • 38
  • 58

1 Answers1

2

Whether a message should be posted on Slack for only the child jobs or the parent job also should be part of the configuration that the plugin provides. Here's an example from your github link. The hipchat plugin gets this right:  hipchat jenkins plugin config

A similar option from the Slack plugin would solve your problem, there seems to be a PR here to fix it. You can revert back to an older version (<= 2.0) to solve this meanwhile.

sindhu_sp
  • 749
  • 5
  • 12
  • 2
    This does seem to be the responsibility of the plugin based on everything I'm seeing. Thanks for the link to the PR too, fingers crossed that it gets merged – Matt Dodge Feb 09 '18 at 16:12