I have a pipeline that calls a job dsl that calls a pipeline. We'll call them "job1", "launcher", and "job2." The idea is that I can manually run "launcher" from the Jenkins GUI, or if somebody checked a box on "job1" then it will call the launcher for you.
In the job1, I use:
In the launcher dsl script, I can access the "GIT_SELECTED_BRANCH" variable. If manually launched, it is a parameter of the job via the Jenkins GUI and everything is fine. If it is launched via job1, it works fine too, until...
After it does a bunch of stuff to work around
Now, in the job2, I have this:
If I run it via job1, the build variables is empty, like noted in https://stackoverflow.com/questions/45970157/jenkins-pipeline-build-step-getbuildvariables-returns-empty-map
If I launch the DSL job directly from the UI, I get