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

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

    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

          Hide
          jglick Jesse Glick added a comment -

          Try running inside @NonCPS.

          Show
          jglick Jesse Glick added a comment - Try running inside @NonCPS .
          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).

            People

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

              Dates

              • Created:
                Updated: