Home > Software engineering >  How to println from a txt file in jenkins
How to println from a txt file in jenkins

Time:04-19

So I have a file called "text1.txt" that has only one line -

version.build=846 

I want to do something like this-

def svntag = ccsmp_v_ {version.build}
println $svntag

ccsmp_v_846

Is there any way to do this ?

CodePudding user response:

You can read a file from the workspace using the methods from pipeline utility steps plugin.

For your case it would be best to use readProperties method, for example:

def properties = readProperties file: '<your properties file in the workspace>'

Then you can access the value with:

def svntag = "ccsmp_v_${properties['version.build']}"
  • Related