Jenkins dsl pipeline def variable

Viewed 13819

I'm trying to define a variable into a jenkins pipeline dsl script by reading 3 files and concatenating the output. The 3 files content is:

file1 content is: 127

file2 content is: 0

file3 content is: 1

def var1 = readfile('file1')
def var2 = readfile('file2')
def var3 = readfile('file3')

def concatVar = "${var1} + '_' + ${var2} + '_' + ${var3}"
printin ${concatVar}

The output I expect would be

printIn${concatVar} 
127_0_1 

instead my output is:

printIn ${concatVar} 
127
_0
_1

I know that I am wrong somewhere, but I don't know how to do it. Is there any of you familiar with the Jenkins pipepile dsl/groovy syntax?

Thanks guys

1 Answers
Related