Re: variable within a variable

2020-10-26 Thread cw
thank you for the suggestion and the explanation. I'm definitely learning here. slowly, but hopefully learning. I'm also investigating just writing a quick python program that does the work for me and calling that to get the result I need. On Monday, October 26, 2020 at 4:02:13 PM UTC-4

Re: variable within a variable

2020-10-26 Thread jeremy mordkoff
okay, take this with a grain of salt because this is purely a guess The ssh call is trying to serialize all of the local variables, but it can't serialize the simpleTemplate. So move all the code that touches simpletemplate into a function that's wrapped with the @NONCPS decorator. something

Re: variable within a variable

2020-10-26 Thread cw
I wondered about that also, but I commented it out and still got the error. Then I moved the defs outside the withCredentials block and now I get a similar but different error. It appears to be erroring at the withCredentials line. I haven't even tried calling these defs yet but am getting

Re: variable within a variable

2020-10-26 Thread jeremy mordkoff
I think it is failing on this line: echo("MAL is ${MAL}") On Monday, October 26, 2020 at 11:51:19 AM UTC-4 cw wrote: > Also I'm confused why I'm getting a NotSerializableException related to > SimpleTemplateEngine$SimpleTemplate when I'm in a try/except block which is > running an

Re: variable within a variable

2020-10-26 Thread cw
Also I'm confused why I'm getting a NotSerializableException related to SimpleTemplateEngine$SimpleTemplate when I'm in a try/except block which is running an sshCommand which is not trying to call the SimpleTemplateEngine. On Monday, October 26, 2020 at 10:04:59 AM UTC-4 cw wrote: > The code

Re: variable within a variable

2020-10-26 Thread cw
The code block I pasted is exactly the pipeline steps I am running so I don't think I'm running it in a function? On Monday, October 26, 2020 at 9:41:08 AM UTC-4 jeremy@riftio.com wrote: > Are you running this in the main thread of the enkinsFile itself or in a > function? I suspect that

Re: variable within a variable

2020-10-26 Thread jeremy mordkoff
Are you running this in the main thread of the enkinsFile itself or in a function? I suspect that you are in a function and you may need to use the @NONCPS decorator On Friday, October 23, 2020 at 4:31:55 PM UTC-4 cw wrote: > That's great, thank you very much. I was able to take your code,

Re: variable within a variable

2020-10-23 Thread cw
That's great, thank you very much. I was able to take your code, substitute MAL for HOST, for instance, and test it in a groovy web console, and it returned the correct value and interpolated the variable even though the variable wasn't defined until after the pathname was defined with the

Re: variable within a variable

2020-10-23 Thread jeremy mordkoff
I stumbled on https://stackoverflow.com/questions/55423036/groovy-string-interpolation-when-string-is-defined-before-the-interpolated-varia and I found this snippet worked just fine after I approved the signature in jenkins import groovy.text.SimpleTemplateEngine node("docker") {

Re: variable within a variable

2020-10-23 Thread cw
Thank you, it seems that you're right, it's not completing the expansion, but in the research I did, I wasn't able to make anything else work (one suggestion had to do with double quotes instead of single quotes, but wasn't able to get that to work either). I don't know if it's related to it

Re: variable within a variable

2020-10-23 Thread jeremy mordkoff
I think you need to do an "eval" or the equivalent to filepath in order to expand the inner variable. I believe the ssh command is executing "ls /srv/jboss/server/${MAL}/log/" but MAL on the far end is empty. So you need to complete the expansion before calling ssh. This might get you on the

variable within a variable

2020-10-22 Thread cw
I'm trying to set up a string parameter which will reference a variable which will be created within the pipeline. For instance, when building a parameterized build, the user enters a file path in this format: /srv/jboss/server/${MAL}/log/ Where MAL is assigned via the pipeline and then I try