How to distinguish which build trigger to kick off the build

47 views
Skip to first unread message

zhangkm

unread,
Apr 18, 2016, 1:39:37 AM4/18/16
to jenkins...@googlegroups.com
Hello,
As we know, we can select build triggers in jenkins, such as Poll SCM,
Build periodically, Build after other projects are built, etc. In my build
job, I use SVN as CVS and I select Build periodically and Poll SCM as build
trigger.
<http://jenkins-ci.361315.n4.nabble.com/file/n4807513/build-trigger.png>
Now I want to know which build trigger to kick off the build job, so I
can execute different bat file or pass different parameters depend on
different trigger. For example, if Build periodically trigger the build, I
will pass the parameter 'buildall=true', else I will pass the parameter
'buildall=false'.
Please tell me how to make it come true, or any other way to solve this
problem?



--
View this message in context: http://jenkins-ci.361315.n4.nabble.com/How-to-distinguish-which-build-trigger-to-kick-off-the-build-tp4807513.html
Sent from the Jenkins users mailing list archive at Nabble.com.

Baptiste Mathus

unread,
Apr 20, 2016, 12:09:36 PM4/20/16
to jenkins...@googlegroups.com

Hi,
IIUC what you're talking about us actually called a "Cause" in Jenkins.
Seems like https://wiki.jenkins-ci.org/display/JENKINS/Build+Cause+Run+Condition was designed to do what you want, but that plugin seems abandoned and is said to only implement the user cause.

-- Baptiste

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1460941620431-4807513.post%40n4.nabble.com.
For more options, visit https://groups.google.com/d/optout.

Olli Sivonen

unread,
Apr 20, 2016, 1:55:15 PM4/20/16
to Jenkins Users, zhan...@126.com
Hi,

Jenkins generates environment variable BUILD_CAUSE for each build that contains the information you seek. The values are something like 'UPSTREAMTRIGGER', 'SCMTRIGGER', 'TIMERTRIGGER', and so forth.
 
Also, if you have Conditional BuildStep Plugin, it contains condition for Build Cause, which lists all
registered triggers.

-Olli
Reply all
Reply to author
Forward
0 new messages