I have a multi-branch pipeline with the following as the first line, outside of pipeline:
JENKINS_HOST = JENKINS_URL.toURL().host.tokenize('.')[0]
This value is used inside the pipeline.
The pipeline generally works but, apparently at random, builds will fail with the following exception:
groovy.lang.MissingPropertyException: No such property: JENKINS_URL for class: groovy.lang.Binding
See consoleText for a redacted console log including the stack trace.
This has only been observed on cron-triggered builds: manually building the job, or rebuilding a failed job, works fine.
The pipeline defines some parameters, I'm not sure if that's relevant.