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

Conditional build steps should be available as post-build actions

    XMLWordPrintable

Details

    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

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

          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?
          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

          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

          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?

          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?
          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.

          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.

          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 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.
          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.

          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.
          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

          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
          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?

          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?
          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.

          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.
          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.

          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.
          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.

          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.
          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.

          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 added a comment -

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

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

          People

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

            Dates

              Created:
              Updated:
              Resolved: