When using the conditional buildstep plugin to build an if-else structure, you have to configure the same condition two times.

      Example: execute step x if strings match, execute step y else

      You will have to wrap step x into a strings-match-condition and wrap step y into a not(string-match)-condition.

      It would be much nicer to be able to add an else-block to do something like this:
      Run if strings match: string1, string2
      --> step x
      else
      --> step y

          [JENKINS-20292] Option to specify an else-block

          Gergely Nagy added a comment - - edited

          I absolutely agreed, some of my conditions are so much messier due to the repetition - that I've fallen back to edit the config.xml via API.
          (BTW, if there was a way to copy/paste buildsteps between outside and insider the condition (and in general in Jenkins, it would make this less painful.)

          I'm considering working on this - unless experts owners disagree or think it's really tricky to do.

          Gergely Nagy added a comment - - edited I absolutely agreed, some of my conditions are so much messier due to the repetition - that I've fallen back to edit the config.xml via API. (BTW, if there was a way to copy/paste buildsteps between outside and insider the condition (and in general in Jenkins , it would make this less painful.) I'm considering working on this - unless experts owners disagree or think it's really tricky to do.

          I think the "else case" would absolutly make sense - feel free to send a PR

          Dominik Bartholdi added a comment - I think the "else case" would absolutly make sense - feel free to send a PR

          nisar T added a comment -

          Is this change available ??

          nisar T added a comment - Is this change available ??

          I'd like to vote for this feature.
          It would be nice to have bash-like "if" options - not only 'if-else', but
          if
          --> step x
          else if
          --> step y
          else if
          --> step z
          [..]
          else
          --> final step

          Michał Stasiak added a comment - I'd like to vote for this feature. It would be nice to have bash-like "if" options - not only 'if-else', but if --> step x else if --> step y else if --> step z [..] else --> final step

          +1

          Lior Goikhburg added a comment - +1

          ohad r added a comment -

          +1

          ohad r added a comment - +1

          liyatikal added a comment -

          Any chance this feature will be implemented soon?

          liyatikal added a comment - Any chance this feature will be implemented soon?

          Sanjay Thomas added a comment -

           I had opened a pull request to implement this feature. Could you take a look?

          Sanjay Thomas added a comment -  I had opened a pull request to implement this feature. Could you take a look?

            domi Dominik Bartholdi
            wolterhis Lars
            Votes:
            20 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated: