I am using a jenkinsfile to execute commands of python, pytest and building code. My question here is that, I want to use a string parameter to run a whole command calling jenkins environment variables. I have noticed that when I run the command in the groovy, it gives me an error because it interpret the ${environment_variable} as mere string.
My jenkinsfile is:
pipeline {
agent any
environment
{
DUMMY = "Hello world"
}
stages {
stage('Stage 1') {
steps {
bat"""
${test_command}
"""
}
}
}
}
and my call for the string parameter "test_command" is:
echo ${DUMMY}
Is there any way that echo returns "Hello World" and not "${DUMMY}"?
Thanks!