Interview Prep/Jenkins/Jenkinsfile syntax, Groovy & CPS errors

`java.lang.IllegalArgumentException: Unsupported parameter type for sh` or `No signature of method: sh() is applicable for argument types: (java.lang.String, java.lang.Boolean)`

BeginnerTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer

Likely causes → Wrong step argument style: positional arguments mixed with named ones, e.g. sh('ls', true).

Diagnose → Check the Snippet Generator for the step's parameter names.

Fix → Use named parameters: sh(script: 'ls', returnStdout: true).

Prevent → Generate unfamiliar step syntax from the Snippet Generator.

All Jenkins questions Roadmap: Jenkins

More on Jenkinsfile syntax, Groovy & CPS errors