No, all my functions are directly called from "steps", in a declarative pipeline
On Fri, Dec 18, 2020 at 5:59 AM Stuart Rowe <[email protected]> wrote: > Any chance this is being called from a @NonCPS method? I've seen similar > behaviour in that case. > On Monday, 14 December 2020 at 14:37:55 UTC-8 [email protected] wrote: > >> Hi, >> >> In a shared library, in a groovy script in /vars, the following code is >> working perfectly: >> >> String call(String stageName) { >> String cowMsg = libraryResource 'cow.txt' >> if (cowMsg != null) { >> def vars = [:] >> vars['MESSAGE'] = "BEGIN STAGE: ${stageName}" >> def engine = new StreamingTemplateEngine() >> def asciiArtMsg = engine.createTemplate(cowMsg).make(vars).toString() >> echo "${asciiArtMsg}" >> } else { >> echo "I never see that because cowMsg is not null..." >> } >> >> This prints my file cow.txt as expected, because cowMsg is NOT null. >> >> BUT : if I remove the "if", I have this error : >> No such library resource null could be found. >> >> It is like my resource suddenly became null ! >> >> I load some other files without the need of this mysterious "if". >> >> Is that a Groovy bug ? >> >> >> >> -- > 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/3d05598e-01d9-4a86-9b1d-bc798546b94cn%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/3d05598e-01d9-4a86-9b1d-bc798546b94cn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Yannick LACAUTE Consultant indépendant 39 rue de Wattignies, 75012 Paris Tel : 06 16 85 95 76 -- 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/CAG1W_Ax3zsSzbcAr%2B-oyE0%2B%3DD9oy-hbErUtwRA2WgZesA4%3D3WA%40mail.gmail.com.
