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

Conditional build steps should be available as post-build actions

    Details

    • Similar Issues:

      Description

      I have matrix builds which run on several nodes, and if a "deploy" checkbox param was selected when the build ran we call a deploy job to push the code out for testing. Unfortunately, using a conditional build step for this causes the deploy to happen for every build node. It should only be run once in our case, after all builds succeed.

      If I could use a conditional build step as a post-build action, this would work perfectly!

        Attachments

          Activity

          owenmehegan Owen Mehegan created issue -
          Hide
          domi Dominik Bartholdi added a comment -

          have a look at this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Flexible+Publish+Plugin
          is this what you want?

          Show
          domi Dominik Bartholdi added a comment - have a look at this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Flexible+Publish+Plugin is this what you want?
          Hide
          owenmehegan Owen Mehegan added a comment -

          I did try that, but it has two problems: one, it doesn't work in matrix builds (not currently supported), which is where I need this. And two, it says it doesn't support the Parameterized Trigger plugin (due to JENKINS-12418), which I also need. But I would be running that plugin through Conditional Build Step, so maybe it would work? Flexible Publish -> Conditional Build Step -> Parameterized Trigger... Bluh. Something about chaining all these plugins makes me nervous

          Show
          owenmehegan Owen Mehegan added a comment - I did try that, but it has two problems: one, it doesn't work in matrix builds (not currently supported), which is where I need this. And two, it says it doesn't support the Parameterized Trigger plugin (due to JENKINS-12418 ), which I also need. But I would be running that plugin through Conditional Build Step, so maybe it would work? Flexible Publish -> Conditional Build Step -> Parameterized Trigger... Bluh. Something about chaining all these plugins makes me nervous
          Hide
          emszpak Marcin Zajączkowski added a comment -

          owenmehegan: where you able to successfully chain plugins (Flexible Publish -> Conditional Build Step -> Parameterized Trigger)? I was not able to choose "Conditional Build Step" as an action for "Flexible Publish".
          Maybe you were able to workaround it in some other way?

          Show
          emszpak Marcin Zajączkowski added a comment - owenmehegan: where you able to successfully chain plugins (Flexible Publish -> Conditional Build Step -> Parameterized Trigger)? I was not able to choose "Conditional Build Step" as an action for "Flexible Publish". Maybe you were able to workaround it in some other way?
          Hide
          owenmehegan Owen Mehegan added a comment -

          emszpak: No, I ended up using the PostBuildScript plugin (https://wiki.jenkins-ci.org/display/JENKINS/PostBuildScript+Plugin) to trigger Conditional Build Step in a post-build action. It's really ugly, I wish Conditional Build Step worked in post-build natively. But this works.

          Show
          owenmehegan Owen Mehegan added a comment - emszpak: No, I ended up using the PostBuildScript plugin ( https://wiki.jenkins-ci.org/display/JENKINS/PostBuildScript+Plugin ) to trigger Conditional Build Step in a post-build action. It's really ugly, I wish Conditional Build Step worked in post-build natively. But this works.
          Hide
          domi Dominik Bartholdi added a comment -

          assigning this to the flexible publish plugin, as this is the equivalent to the conditional-buildstep-plugin for post build actions. This is and was always the target of the felxible-publish plugin - the author of these two plugins (bap and me) defined it that way.
          If it does not yet what you are looking for, then the plugin might have to be extended/fixed.

          Show
          domi Dominik Bartholdi added a comment - assigning this to the flexible publish plugin, as this is the equivalent to the conditional-buildstep-plugin for post build actions. This is and was always the target of the felxible-publish plugin - the author of these two plugins (bap and me) defined it that way. If it does not yet what you are looking for, then the plugin might have to be extended/fixed.
          domi Dominik Bartholdi made changes -
          Field Original Value New Value
          Component/s flexible-publish [ 16130 ]
          Component/s conditional-buildstep [ 15947 ]
          domi Dominik Bartholdi made changes -
          Assignee domi [ domi ] bap [ bap ]
          Hide
          owenmehegan Owen Mehegan added a comment -

          OK. Flexible Publish doesn't help me at the moment because it doesn't support matrix builds, and it doesn't support the Parameterized Trigger plugin. These issues are both mentioned on the Flexible Publish wiki page, though the bug around using it with Parameterized Trigger (JENKINS-12418) is marked as fixed now.

          Show
          owenmehegan Owen Mehegan added a comment - OK. Flexible Publish doesn't help me at the moment because it doesn't support matrix builds, and it doesn't support the Parameterized Trigger plugin. These issues are both mentioned on the Flexible Publish wiki page, though the bug around using it with Parameterized Trigger ( JENKINS-12418 ) is marked as fixed now.
          Hide
          bap bap added a comment -

          cjo fixed issue 12418 by adding run conditions to the parameterized trigger. This means that you should be able to add the parameterized trigger step directly (without Flexible Publish) and selecting the run condition within the Parameterized Trigger step

          Show
          bap bap added a comment - cjo fixed issue 12418 by adding run conditions to the parameterized trigger. This means that you should be able to add the parameterized trigger step directly (without Flexible Publish) and selecting the run condition within the Parameterized Trigger step
          Hide
          owenmehegan Owen Mehegan added a comment -

          What happened to the flexible publish plugin? I can't find it in the plugin manager anymore, though the wiki page is still there. It looks like installations abruptly stopped in March. Did it get replaced with something?

          Show
          owenmehegan Owen Mehegan added a comment - What happened to the flexible publish plugin? I can't find it in the plugin manager anymore, though the wiki page is still there. It looks like installations abruptly stopped in March. Did it get replaced with something?
          Hide
          owenmehegan Owen Mehegan added a comment -

          And I can't see anything in the current version of parameterized trigger that gets me what I want.

          To go back to the original bug request: I want to be able to use conditional build steps in a post-build action. Specifically, I want to be able to say:

          if $some_build_param = "true"
          trigger a downstream build with parameters
          end

          I need this as a post-build action, in matrix builds.

          Show
          owenmehegan Owen Mehegan added a comment - And I can't see anything in the current version of parameterized trigger that gets me what I want. To go back to the original bug request: I want to be able to use conditional build steps in a post-build action. Specifically, I want to be able to say: if $some_build_param = "true" trigger a downstream build with parameters end I need this as a post-build action, in matrix builds.
          Hide
          btb3 Martin Ba added a comment -

          As for

          if $some_build_param = "true"
          trigger a downstream build with parameters
          end
          

          – Shouldn't this be doable with the ParamTriggerPlugin? You can have the parameters for the downstream job loaded from a properties file, and you can use this file as "condition", with teh checkbox that doesn't trigger if the file's missing.

          Show
          btb3 Martin Ba added a comment - As for if $some_build_param = "true" trigger a downstream build with parameters end – Shouldn't this be doable with the ParamTriggerPlugin? You can have the parameters for the downstream job loaded from a properties file, and you can use this file as "condition", with teh checkbox that doesn't trigger if the file's missing.
          Hide
          owenmehegan Owen Mehegan added a comment - - edited

          Interesting, that might work for us. I'll experiment with it. I still would prefer to be able to do actual conditional logic, using the Conditional Build Step plugin, in post-build steps. On matrix builds.

          Show
          owenmehegan Owen Mehegan added a comment - - edited Interesting, that might work for us. I'll experiment with it. I still would prefer to be able to do actual conditional logic, using the Conditional Build Step plugin, in post-build steps. On matrix builds.
          Hide
          owenmehegan Owen Mehegan added a comment -

          The problem with triggering only if a properties file exists is, in a matrix job I have to copy the file from the slave to the master before I can trigger on it. Just an annoying extra post-build step in every job.

          Show
          owenmehegan Owen Mehegan added a comment - The problem with triggering only if a properties file exists is, in a matrix job I have to copy the file from the slave to the master before I can trigger on it. Just an annoying extra post-build step in every job.
          ikedam ikedam made changes -
          Assignee bap [ bap ] ikedam [ ikedam ]
          Hide
          ikedam ikedam added a comment -

          Now Flexible Publish plugin 0.11 supports build triggers and multi-configuration projects.
          Please try it!

          Show
          ikedam ikedam added a comment - Now Flexible Publish plugin 0.11 supports build triggers and multi-configuration projects. Please try it!
          ikedam ikedam made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 145111 ] JNJira + In-Review [ 191360 ]

            People

            • Assignee:
              ikedam ikedam
              Reporter:
              owenmehegan Owen Mehegan
            • Votes:
              6 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: