-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
jenkins 2.263.4
Pipeline: Groovy 2.91
I have defined global variable as doc: https://www.jenkins.io/doc/book/pipeline/shared-libraries/#defining-global-variables
@groovy.transform.Field def yourField = [:]
This is the problem: Jenkins is restarted when one pipeline build is running, after jenkins is back, the global variable defined in vars/test.groovy because empty.
The following is the logs of pipeline build:
16:12:28 {~~~~~~ globalReference defined in pipeline:={PRD_MODE=, job_start_time=1628583133894}} [Pipeline] echo*16:12:28* ~~~~~~~~~[test] defined in vars: foo [Pipeline] echo*16:12:28* ~~~!!!!! lib object:org.jenkinsci.plugins.workflow.libs.LibraryStep$LoadedClasses@116dced [Pipeline] sleep*16:12:28* Sleeping for 1 min 40 sec Resuming build at Tue Aug 10 08:14:27 UTC 2021 after Jenkins restart Waiting to resume part of PR » agents » PR_agent_1 #4 | PR_Sanity_33422_zhul13_1626940307645_0_T_0: Finished waiting Ready to run at Tue Aug 10 08:15:14 UTC 2021*16:15:14* No need to sleep any longer [Pipeline] echo*16:15:14* ~~!!!!! after sleep lib object :org.jenkinsci.plugins.workflow.libs.LibraryStep$LoadedClasses@232cdd2e [Pipeline] echo*16:15:15* sleep back [test]defined in vars : null [Pipeline] echo*16:15:15* {~~~~~ globalReference defined in pipeline:={PRD_MODE=, job_start_time=1628583133894}}
The value in vars is missing, but the globalReference defined in pipeline is ok.