I am trying to perform a string comparison which has 2 string values that should be equal (see consumer_var.equals('ED UI')). However, they are not recognised as equal (They should both be 'ED UI') and the "else" block is running when it shouldn't be.
def consumer_var = env.consumer
println "consumer param is " + consumer_var
println "are " + consumer_var + " and 'ED UI' equal? " + consumer_var.equals('ED UI')
if(consumer_var.equals('ED UI'))
{
println "hey, consumer ${consumer} is ED UI!"
}
else
{
println "consumer is ${consumer}"
}
The result is:
[Pipeline] echo
consumer param is Ed UI
[Pipeline] echo
are Ed UI and 'ED UI' equal? false
[Pipeline] echo
consumer is Ed UI
If somebody can create an if statement to check whether the build parameter called "consumer" is equal to a string 'ED UI', that would be great.