import jenkins.branch.BranchIndexingCause

    final def jenkinsInstance = jenkins.model.Jenkins.getInstance()
    final def jenkinsProject = jenkinsInstance.getItemByFullName(
jenkinsProjectName)
    if (jenkinsProject != null) {
        final def job = jenkinsProject.getAllJobs().first()
        final def lastBuild = job.getLastBuild()
        final def causes = previousBuild.getCauses()
        final def buildCause = causes.first()
        if (buildCause instanceof BranchIndexingCause) {

        }
    }


tirsdag 21. august 2018 19.01.57 UTC+2 skrev Ramanathan Muthaiah følgende:
>
> Am referring to this API doc to find out which method should be used to 
> identify the reason for a build job to be triggered.
>
> http://javadoc.jenkins-ci.org/hudson/model/class-use/Cause.html
>
> Would appreciate if anyone on this list could point me to the relevant 
> method ?
>
> For some strange reason, GHE org folder config (in prod Jenkins) does not 
> have periodic triggering / scanning (that initiates branch indexing) but 
> the detected repos have that option enabled !!!
>
> --
> regards
> Ram
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9f56b01b-fbe5-4051-a9cb-5f5e85da9706%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to