The problem is that the EnvInject isn't enabled through the BuildFlow. On Thursday, October 29, 2015 at 10:15:58 PM UTC+2, Martin d'Anjou wrote: > > Been asking myself the same question for 3 years. The only solution for me > is to use EnvInject, fetch the cause from the Jenkins internal objects, and > export it as a new env variable to the build. It gets complicated when the > cause is another build, you have to do a recursive search to get to the > bottom if it, but ultimately it is doable. Start with > currentBuild.getCauses() in EnvInject. Or use a System Groovy script as per > this stackoverflow answer <http://stackoverflow.com/a/29677752>. > > On Thursday, October 29, 2015 at 9:15:04 AM UTC-4, GS_L wrote: >> >> Hi >> >> To know who triggered a buildflow job I tried to print the BUILD_CAUSE >> env variable in the following ways: >> >> 1. println "BUILD_CAUSE = $BUILD_CAUSE" >> build failed - error: >> >> ERROR: Failed to run DSL Script >> groovy.lang.MissingPropertyException >> <http://stacktrace.jenkins-ci.org/search?query=groovy.lang.MissingPropertyException>: >> No such property: BUILD_CAUSE for class: Script1 >> >> >> 2. println build.properties["environment"]["BUILD_CAUSE"] >> build passed - output is null >> >> What is the right way to get the BUILD_CAUSE in Build Flow job? >> >
-- 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/3856d186-97f4-4548-9eed-ddc7fbaf55a3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
