I am using a Jenkinsfile in a pipeline on version 2.32.2.
For various reasons I want to extract the version string from the pom. I was hoping I wouldn\'t have to a
I know this kind of late answer, but whoever you who needs the solution without eval you can use /bin/bash -c "script"
to make pipe works
script {
POM_VERSION = sh(script: "/bin/bash -c 'sed -n \'//,///g\'\''", returnStdout: true)
echo "${POM_VERSION}"
}
The only problem with this method is hellish escape
yet this way the subshell of pipe will be handled by our boy /bin/bash -c