I was thinking of using the Groovy script for my build job in Jenkins, because I have some conditions to verify that this might require access to the Jenkins API.
Can I find out who or what caused the build from the Groovy script? Or an SCM change, another project or user. I just started reading a little bit about Groovy and the Jenkins API.
I want to check the following conditions and build accordingly. Some pseudo codes:
def buildTrigger JenkinsAPI.thisBuild.Trigger
if (buildTrigger == scm) {
execute build_with_automake
def new_version = check_git_and_look_up_tag_for_version
if (new_version) {
execute git tag new_release_candidate
publish release_candidate
}
} else if (buildTrigger == "Build other projects") {
execute build_with_automake
}
The design should be based on every SCM change, but only the tag and publication if the version has been increased. It should also build when the assembly was initiated by another project.
source
share