Hi all, I would like to use a checkbox parameter in one of my builds, I know how to add it in the Jenkins UI but, how do I get it’s value from within the script ?
I believe parameters get set as either param keys (${param.PARAM_NAME}
) or env variables
Thanks env worked ${x} didn’t
def HostName = java.net.InetAddress.getLocalHost().getHostName();
boolean Checked = env.BuildDockerImage;
pipeline
{
agent {label nodeLable}
stages
{
stage('Building')
{
steps
{
script
{
if(Checked)
echo "Checkbox is Checked"
else
echo "Checkbox is unchecked"
}
}
}
}
}
This always prints "Checkbox is Checked"
Found it myself
env.BuildDockerImage.toBoolean()
or
params.BuildDockerImage