Hi David,

I think that could be related to 
https://issues.jenkins-ci.org/browse/JENKINS-50736, because there is a pipeline 
basic step called 'writeFile' (see 
https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#writefile-write-file-to-workspace),
 but maybe Jesse Glick or Andrew Bayer can shed some more light on this issue...

HTH Reinhold

________________________________
Von: [email protected] <[email protected]> im 
Auftrag von David Karr <[email protected]>
Gesendet: Freitag, 7. Februar 2020 21:51
An: Jenkins Users <[email protected]>
Betreff: Shared library function cannot call other shared library function in 
separate file if called function uses "writeFile"

The statement I make in the subject doesn't make sense, but I don't know how 
else to describe it.

I'm working on a set of builds using scripted pipelines.  Our Jenkinsfiles are 
very short, all of the build logic is in the shared library.  In the "main" 
shared library function, I'm trying to call another function defined in another 
"vars" class.  We have many of these already.  In this called function, I have 
a call to the "writeFile" pipeline step to create a temporary file used by a 
shell script called immediately after that.  This is the only place anywhere in 
our builds that we call "writeFile".

When I run the build, I get this very unhelpful message:


Jenkins Job Failed due to Exception : org.codehaus.groovy.control.ErrorCollector

There is literally no other information provided, except for the log lines that 
come before it.  I found that an echo statement that is called before this 
suspect function is called is emitted in the log.  An echo statement as the 
first line of the "call()" method of the function being called is NOT emitted 
in the log. Somehow the act of calling the function makes it die, with no 
explanation.

So, I tried a workaround.  In the calling script file, I added a "def" at the 
end of the file, to define an "inline function" with almost the same name as 
the "vars" function name.  I copied the entire body of the "call()" method of 
the vars function into that inline function.  I replaced the call to the vars 
function with the call to the inline function.  It worked on the first try.

Any ideas what might cause this?

--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3119e9f3-e6a8-4fa6-861a-76c9358ab300%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/3119e9f3-e6a8-4fa6-861a-76c9358ab300%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/AM0PR01MB6147F74252A8BD51D29E9A77F71F0%40AM0PR01MB6147.eurprd01.prod.exchangelabs.com.

Reply via email to