Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-27317

Support matrix aggregation with ProxyPublisher

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins 1.599
      Groovy Postbuild 2.2

      "Run also for matrix parent" with groovy-postbuild doesn't work when called via template-project plugin.
      This is caused as ProxyPublisher doesn't supporr MatrixAggregatable and doesn't trigger aggregation processes of publishers.


      (original post)

      Would it be possible to have Groovy Postbuild to only run the script on matrix parent?

      I have a groovy script I want to run once after all matrix configurations have been triggered and completed.

          [JENKINS-27317] Support matrix aggregation with ProxyPublisher

          Sverre Moe added a comment - - edited

          @danielbeck: Groovy Postbuild was updated last year with an implementation of MatrixAggregatable
          https://issues.jenkins-ci.org/browse/JENKINS-21924

          @ikedam: I have created a project called template-project. This has Build script and Post build actions used on all my projects. It helps with not having to update the same build script 70 times over.

          Created a new Multi-Configuration project that does not use builders or publishers from another project. Added just one Groovy Postbuild. Same result.
          Parent: #1 16-Mar-2015 15:08 "no parent ShortText"
          Configuration 1: #1 16-Mar-2015 15:08 child
          Configuration 2: #1 16-Mar-2015 15:08 child

          Sverre Moe added a comment - - edited @danielbeck: Groovy Postbuild was updated last year with an implementation of MatrixAggregatable https://issues.jenkins-ci.org/browse/JENKINS-21924 @ikedam: I have created a project called template-project. This has Build script and Post build actions used on all my projects. It helps with not having to update the same build script 70 times over. Created a new Multi-Configuration project that does not use builders or publishers from another project. Added just one Groovy Postbuild. Same result. Parent: #1 16-Mar-2015 15:08 "no parent ShortText" Configuration 1: #1 16-Mar-2015 15:08 child Configuration 2: #1 16-Mar-2015 15:08 child

          Daniel Beck added a comment -

          Thanks, I saw that when I checked after ikedam's very true comment.

          Daniel Beck added a comment - Thanks, I saw that when I checked after ikedam's very true comment.

          Sverre Moe added a comment - - edited

          @ikedam: I did not notice the check box "Run also for matrix parent". When this is checked, it works. I should have seen this. I'm really kicking my self right now.

          Edit: I was a little bit quick to celebrate. If the Groovy Postbuild comes from template project, it does not run on parent, only the child. This even if "Run also for matrix parent" is checked.

          Why does not Groovy Postbuild work for parent if it comes from a template project? Would hate to have to duplicate my script across all 70 jobs.

          Sverre Moe added a comment - - edited @ikedam: I did not notice the check box "Run also for matrix parent". When this is checked, it works. I should have seen this. I'm really kicking my self right now. Edit: I was a little bit quick to celebrate. If the Groovy Postbuild comes from template project, it does not run on parent, only the child. This even if "Run also for matrix parent" is checked. Why does not Groovy Postbuild work for parent if it comes from a template project? Would hate to have to duplicate my script across all 70 jobs.

          ikedam added a comment -

          Post-build steps in matrix parents are called "aggregation".

          template-project plugin deosn't support aggregation.
          That is, template-project doesn't implement MatrixAggregatable and doesn't work as a proxy for matrix parents.
          Now the comment from @danielbeck gets valid!

          I changed the component to template-project.

          ikedam added a comment - Post-build steps in matrix parents are called "aggregation". template-project plugin deosn't support aggregation. That is, template-project doesn't implement MatrixAggregatable and doesn't work as a proxy for matrix parents. Now the comment from @danielbeck gets valid! I changed the component to template-project.

          Brantone added a comment -

          Always looking for contributions

          Brantone added a comment - Always looking for contributions

          Sverre Moe added a comment -

          I have hope for a fix to be included within an early 1.5.x bug release. I myself have no experience in programming Jenkins plugins, but if no one picks up this soon, then I might try to fix it myself.

          Sverre Moe added a comment - I have hope for a fix to be included within an early 1.5.x bug release. I myself have no experience in programming Jenkins plugins, but if no one picks up this soon, then I might try to fix it myself.

          Sverre Moe added a comment -

          My hope of quick resolution is fading. I'm currently swamped, so is there anyone else who could fix this issue?

          Sverre Moe added a comment - My hope of quick resolution is fading. I'm currently swamped, so is there anyone else who could fix this issue?

          Sverre Moe added a comment -

          I have cloned the project from GitHub, and implemented a fix, but have not tested it. Nor am I 100% sure it is correct. I have looked at some examples of MatrixAggregatable at GitHub.

          https://github.com/DJViking/template-project-plugin/commit/f74c0d6b11160eb5762315d712e7fbba1ed036a1

          Sverre Moe added a comment - I have cloned the project from GitHub, and implemented a fix, but have not tested it. Nor am I 100% sure it is correct. I have looked at some examples of MatrixAggregatable at GitHub. https://github.com/DJViking/template-project-plugin/commit/f74c0d6b11160eb5762315d712e7fbba1ed036a1

          Sverre Moe added a comment -

          Updated commit with fix for this issue. Taken inspiration from FlexiblePublish. Thanks to ikedam for his assistance.
          https://github.com/DJViking/template-project-plugin/commit/13a0169562db32f90b0e48e135ca5d7cb60f1d76

          I will go through the code some more, add some logging in the ProxyMatrixAggregator and then submit a Pull Request.

          Sverre Moe added a comment - Updated commit with fix for this issue. Taken inspiration from FlexiblePublish. Thanks to ikedam for his assistance. https://github.com/DJViking/template-project-plugin/commit/13a0169562db32f90b0e48e135ca5d7cb60f1d76 I will go through the code some more, add some logging in the ProxyMatrixAggregator and then submit a Pull Request.

          Sverre Moe added a comment -

          Sverre Moe added a comment - Pull Request: https://github.com/jenkinsci/template-project-plugin/pull/26

            Unassigned Unassigned
            djviking Sverre Moe
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: