jenkinsci / jenkinsci/workflow-cps-plugin
[JENKINS-43389] switch statement default case not called if other match found in Pipeline DSL
- Dominant language
- Java
- Stars
- 186
- Forks
- 213
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 8
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.
---
Originally reported by bwijsmuller, imported from: switch statement default case not called if other match found in Pipeline DSL
Raw content of original issue
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.
- environment:
redhat linux, jenkins 2.34, Pipeline 2.5
Contributor guide
Research direction
Start with the Pipeline DSL switch statement entry point and run the minimal reproducer from the issue on the reported Jenkins and Pipeline versions. Trace how a matching case and the default case are handled, then add a regression test showing the expected output for both matching and nonmatching cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100