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

switch statement default case not called if other match found in Pipeline DSL

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The simplest of scripts to reproduce the issue:

      switch ("triggervalue") {
          case "triggervalue":
              echo "triggervalue match"
          default:
              echo "Sorry, this does not print..."
      }
      

      When no other case is triggered, then the default does seem to work.

       

        Attachments

          Activity

          bwijsmuller bwijsmuller created issue -
          jglick Jesse Glick made changes -
          Field Original Value New Value
          Component/s pipeline [ 21692 ]
          jglick Jesse Glick made changes -
          Labels cps pipeline switch cps switch
          jglick Jesse Glick made changes -
          Epic Link JENKINS-35390 [ 171183 ]
          Hide
          jglick Jesse Glick added a comment -

          Try running inside @NonCPS.

          Show
          jglick Jesse Glick added a comment - Try running inside @NonCPS .
          abayer Andrew Bayer made changes -
          Assignee Andrew Bayer [ abayer ]
          abayer Andrew Bayer made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          abayer Andrew Bayer made changes -
          Labels cps switch complex-cps-code cps switch triaged-2018-11
          Hide
          wbrode William Brode added a comment -

          Can confirm this is still an issue on Jenkins 2.204.2 and workflow-cps 2.80 (assuming that is where the issue lies).

          Show
          wbrode William Brode added a comment - Can confirm this is still an issue on Jenkins 2.204.2 and workflow-cps 2.80 (assuming that is where the issue lies).
          abayer Andrew Bayer made changes -
          Assignee Andrew Bayer [ abayer ]

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            bwijsmuller bwijsmuller
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: