In jenkins pipeline
variant is read from job config as
variant = job_config['variant']
variant can be either 'abc' or 'xyz' depending on what is entered in job config.
if(fileExists('tmp/build/${variant}/bin/Test.xml'))
{
echo "Test.xml exists"
}
else
{
echo "Test.xml doesnot exists"
}
Lets assume variant is given as 'abc' in job config. Even though 'tmp/build/abc/bin/Test.xml' exists in real,
During jenkins build, the condition check fileexists of 'tmp/build/${variant}/bin/Test.xml is read as it is i.e., ${variant} is not replaced by abc during condition check.
Can you someone help how to mitigate this. Thanks!