`Warning: A secret was passed to "sh" using Groovy String interpolation, which is insecure. Affected argument(s) used the following variable(s): [NEXUS_PSW]`
IntermediateTroubleshootingJenkinsfile syntax, Groovy & CPS errors
Answer
Likely causes → Double-quoted sh "... ${NEXUS_PSW} ..." interpolates the secret in Groovy.
Diagnose → The warning names the variable; search for it in double-quoted strings.
Fix →
sh 'curl -u "$NEXUS_USR:$NEXUS_PSW" https://nexus/...'
If you also need Groovy variables, pass them through withEnv and keep single quotes.
Prevent → Lint rule in library CI: no ${...PSW} or ${...TOKEN} in double-quoted sh.
More on Jenkinsfile syntax, Groovy & CPS errors
`WorkflowScript: 1: Missing required section "agent" @ line 1, column 1.`Beginner`Unknown stage section "step". Starting with version 0.5, steps in a stage must be in a ‘steps’ block.`Beginner`java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, ...]`Beginner`java.io.NotSerializableException: java.util.regex.Matcher`Advanced`java.io.NotSerializableException: groovy.json.internal.LazyMap`Intermediate`org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object`Intermediate