There is a BUILD_CAUSE environment variable that can have values like: 
SCMTRIGGER, MANUALTRIGGER, and others

From: [email protected] 
[mailto:[email protected]] On Behalf Of Sverre Moe
Sent: Monday, February 16, 2015 7:06 AM
To: [email protected]
Subject: Groovy build script: What triggered the build

Is it possible to find out who or what triggered the build from a Groovy 
script? Either an SCM change, another project or user. I have just begun 
reading a little about Groovy and the Jenkins API.

I want to check for the following conditions and build accordingly.

if (trigger == scm) {
  build_with_automake
  new_version = git tag exist for version
  if (new_version) {
    tag new release candidate in Git
    publish rc
  }
}
else if (trigger == "Build other projects") {
  build_with_automake
}

The project should build on every SCM change, but only tag and publish if 
version has been increased. It should also build when a build has been 
triggered by another project.
--
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]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a4a10f09-9846-4c6e-b572-ed5123f0977d%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/a4a10f09-9846-4c6e-b572-ed5123f0977d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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/6C6EE445A6F6CE4E8A0FFB51B071A4E26E4F9B58%40AMERMBX02.PERKINELMER.NET.
For more options, visit https://groups.google.com/d/optout.

Reply via email to