There may be an easier way, but you can load the build.environment and 
evaluate the 'BUILD_CAUSE_UPSTREAMTRIGGER' environment variables to 
determine this.  The value is boolean.  There is also a 'BUILD_CAUSE' 
environment variable with values of 'MANUALTRIGGER', 'TIMERTRIGGER' and 
'UPSTREAMTRIGGER'.  There are probably more values, but that is what I see 
for my jobs.  

For a groovy template, this would be:

def env = build.environment
def cause = env.BUILD_CAUSE_UPSTREAMTRIGGER

Assume the same for a script.  If you want to find out the user information 
in the event of a manual trigger, you can install the Build User Vars 
<https://wiki.jenkins-ci.org/display/JENKINS/Build+User+Vars+Plugin> plugin.


On Tuesday, October 14, 2014 7:27:00 AM UTC-4, niraj nandane wrote:
>
> I have one job which i start as a downstream job. I want a groovy script 
> which will detect wheather this job is started as a downstream job or user 
> has started it customly by clicking build now button.
> Based on that i want to execute another job say "abc" .Means if current 
> job started as downstream job then do not execute "abc" otherwise execute 
> "abc" and wait until it finish
> -- 
> Thanks and regards--
> Niraj Nandane(Vit pune)
>
>  

-- 
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-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to