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

`WorkflowScript: 14: Environment variable values must either be single quoted, double quoted, or function calls.`

BeginnerTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer

Likely causes → An unquoted value or expression in environment {}, e.g. TAG = env.BRANCH_NAME + '-x' or COUNT = 3.

Diagnose → Line 14 of the Jenkinsfile.

Fix → Use a GString: TAG = "${env.BRANCH_NAME}-x", or compute in a script {} block with env.TAG = ....

Prevent → Keep environment for static strings and credentials(); compute dynamic values in a dedicated stage.

All Jenkins questions Roadmap: Jenkins

More on Jenkinsfile syntax, Groovy & CPS errors