Re: String interpolation in sh command with credentials and (shared lib) function call

2020-11-18 Thread JonathanRRogers
I'm glad you figured it out. It sure looks like a mess. On Wednesday, November 18, 2020 at 5:02:41 PM UTC-5 st.mail...@gmail.com wrote: > Thanks Jonathan and Gianluca for your explanations. I now got most of my > confusion cleared up, most importantly the fact that String interpolation > is do

Re: String interpolation in sh command with credentials and (shared lib) function call

2020-11-18 Thread ST
Thanks Jonathan and Gianluca for your explanations. I now got most of my confusion cleared up, most importantly the fact that String interpolation is done either by Groovy or by the bash but never by Jenkins. I think the first sentence here got me on the wrong path: "Jenkins Pipeline uses rules id

Re: String interpolation in sh command with credentials and (shared lib) function call

2020-11-17 Thread JonathanRRogers
Unless "mvnBuildGoal" is the name of a Jenkins environment variable, which would be added to the shell process environment, it won't work inside a single-quoted string. On Tuesday, November 17, 2020 at 4:11:32 PM UTC-5 Gianluca wrote: > Somethings said are correctly … somethings said are wrong.

Re: String interpolation in sh command with credentials and (shared lib) function call

2020-11-17 Thread Gianluca
Somethings said are correctly … somethings said are wrong. I’ll try to summarise pointing to the lines in your pipeline and explain what’s wrong and how to fix: Single quoted string are literals. They never get interpolated and passed as they are. So, in your case: > sh '${JAVA_HOME}/bin/java -

Re: String interpolation in sh command with credentials and (shared lib) function call

2020-11-17 Thread JonathanRRogers
I don't think you've read the Jenkins pipeline documentation correctly. String interpolation is performed by Groovy. Jenkins doesn't add any interpolation behavior. Jenkins will always treat single-quoted strings as simple literals. The "sh" step calls a shell which can do its own variable expa

Re: String interpolation in sh command with credentials and (shared lib) function call

2020-11-17 Thread ST
Thanks Dirk, but that does not solve my problem, I'm still stuck. I think that my question boils down to why the multi-line sh command below does not work? According to https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#string-interpolation single-quoted strings should be interpolated by Jenkins

Re: String interpolation in sh command with credentials and (shared lib) function call

2020-11-17 Thread 'Dirk Heinrichs' via Jenkins Users
Am Dienstag, den 17.11.2020, 13:45 +0100 schrieb ST: > " '-Dproj.build.generatefromdb.user=${env.GEN_USR}'" Try with ${GEN_USR} inside shell scripts, not ${env.GEN_USR}. HTH... Dirk -- Dirk HeinrichsSenior Systems Engineer, Delivery PipelineOpenText ™ Discovery | RecommindPhone: +49 2226 159