I think you've both misunderstood what I'm saying, or I'm not being clear 
enough.

I'm not writing to write a function named "writeFile", I'm just calling 
that pipeline step from the function.  All of the function names I'm 
creating are definitely unique.  If I call the "vars" function that calls 
"writeFile", I get the seemingly generic error with no other information.  
If I instead call the inline function with contents identical to the "vars" 
function, it works fine.

On Friday, February 7, 2020 at 12:51:42 PM UTC-8, David Karr wrote:
>
> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6ff2f989-046b-4d56-9d3d-d1d69487e97c%40googlegroups.com.

Reply via email to