I have a requirement where I have to SET a groovy variable inside a batch script.
The reason I want to do is because in the jenkinsile batch script I am trying to figure out whether there have been any git changes on a checked out folder by using git porcelain
command. I tried the below way but that doesn't seem to be working at all . It always goes to the else part.
def boolFlagVar = false
stages {
stage('Test') {
steps {
script {
bat '''
SET ${boolFlagVar} = true #### or SET boolFlagVar = true
'''
if (isSomeFlag.toBoolean())
{
echo "came inside the if condition"
}
else
{
echo "came to else part"
}
}
}
}
Could you help here please ?
Thanks a lot for help !!