Re: Loading properties from a file in Jenkins 2.0 pipeline

2018-04-30 Thread naresh thota
hi, can someone help to resolve the below issue. i have used the readProperties to read the properties from the file as below. def props = readProperties file: 'my_dir/env_props.properties' def var1 = props["${env}.install"] here env is the parameter passed to the pipeline job, the

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-22 Thread Ian Cotton
The original idea of using the properties build step was just not workable since I couldn't directly instantiate the required objects and couldn't find any kind of factory. I went with loading from file straight into a Properties object as some have suggested and it works fine. I'm using much more

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-22 Thread Phillip Campbell
Syntax error. Var1 and Var2 are variables. Try: echo "Var1=${Var1}" echo "Var2=${Var2}" On Thu, Sep 22, 2016 at 1:11 AM, Pete Singleton wrote: > ok thanks, that seems to work as far as reading the properties file, but > then fails when I try to echo the variable: >

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-22 Thread Pete Singleton
ok thanks, that seems to work as far as reading the properties file, but then fails when I try to echo the variable: def props = readProperties file: 'project.properties' def Var1= props['RELEASE'] def Var2= props['SOFTWARE.VERSION'] echo "Var1=" Var1 echo "Var2=" Var2

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-21 Thread Phillip Campbell
Here's a snippet from a Jenkinsfile in a pre-2.0 pipeline job that I use to read an existing build.properties file in the workspace so that the Jenkinsfile can use the properties. I haven't tried this in 2.0 pipeline yet. if (!fileExists('build.properties')){echo 'No build

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-21 Thread Pete Singleton
Hi, I'm having exactly the same issue (having only started with Jenkins 2.0 in the last couple of days). I've tried the Pipeline Utility, tried the EnvInject plugin, also tried opening the file using Groovy file operations, no success! Did you manage to solve this?? On Thursday, 8 September

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-09 Thread jerome
I haven't test it but saw it while checking for something else (zip): Pipeline Utility Steps https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/docs/STEPS.md Maybe that's what you're looking for with

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-08 Thread Ian Cotton
Thanks Jerome. Unfortunately this doesn't help me much. The properties file I need to load already exists and is in use by various build scripts. I assume I need to create an EnvInjectJobProperty object and set the appropriate property on it. I'll give that a try. On Wed, Sep 7, 2016 at 7:07 PM

Re: Loading properties from a file in Jenkins 2.0 pipeline

2016-09-07 Thread jerome
Not sure about the Java properties file, but I succeed by doing a .groovy file if that's interest you (probably not, but here it is if someone need it, it's unsafe but in controlled env it doesn't matter): *Jenkinsfile* def my_var = evaluate(new File("myEnv.groovy")); bat

Loading properties from a file in Jenkins 2.0 pipeline

2016-09-07 Thread Ian Cotton
Hi all, I would like to load properties from a Java properties file as environment variables. The snippet generator appears to be able to do just this using the properties step. If I check the box 'Prepare an environment for the run' it offers me a text box to enter a 'Properties File Path'.