It should be possible to import shared Groovy code from the SCM source in a Workflow job. For instance, if my workflow script (flow.groovy) needs to access variables from another script (constants.groovy) and they are both in the SCM repo that the Workflow job checked out, it should be simple to do. It's not and currently the unabashedly terrible workaround is to do this:
git(url: 'ssh:, credentialsId: '60cda0cc-f13d-448c-9947-28b926a20628')
constants = load('constants.groovy')
This works, but the fact that another node has to be spun up and another git checkout command is required is awful. It should be pretty straightfoward to have Jenkins simply load one of these files. Something like this:
constants = import("constants.groovy")
I'm pretty sure Groovy won't let you use "import" since it's a resered keyword, but I don't have any particularly strong feelings about the semantics of this command. I just want a way to load these files easily.