Closed petersenna closed 5 years ago
Hm, can you paste a small Jenkinsfile? The error seems to suggest that the JOB_NAME
is null
. Which is probably true. A W/A would be to use the env
setting in jenny, and define JOB_NAME.
I'm using variable interpolation a lot, and I have no problems.
Either: jenny -e JOB_NAME=abc
or having in the .jenny/config
an entry for the environment. I'm going to check if Jenkins does have by default JOB_NAME, and ensure jenny also exports it.
the thing is that the Jenkins file in question has a lot of variable definitions inside it, and then later refers to the variable using ${} notation. So on that example ${osname} is not expanding to 'linux'.
@petersenna Hm, this is strange.
In the error I see, startsWith()
is called on a null object. The null object is actually in the example you sent me: env.JOB_NAME
. That's true, because atm jenny is not exporting any JOB_
* variables.
The other thing you mention is the string variable interpolation. I use that feature extensively in my own Jenkinsfiles so I would be very surprised for it not to be working.
Variables that should be exported are: JOB_BASE_NAME
, JOB_DISPLAY_URL
, JOB_NAME
, and JOB_URL
. DISPLAY_URL should be the URL with '/display/redirect' appended.
I'm exporting now the variables. I've added the string interpolation you provided also in the test, to ensure that all should work well for you:
The output is correct:
It solved the issue, thank you!
Great to hear!
While this works just fine on Jenkins, Jenny does not like it.
It fails with:
Cannot invoke method startsWith() on null object
And the issue is the variable as if I replace
${osname}
bylinux-
then it works just fine.