This is duplicated with: how to know which git branch triggered the jenkins job, however the answer below it cannot solve, which is:
commit = checkout scm
println commit.GIT_URL
above code could just return the GIT_URL that which repository the Jenskinsfile on.
So I have to answer again:
My job polling three GIT repository:
repos-A, repos-B, repos-C
with follow code:
triggers {
pollSCM '* * * * *'
}
checkout changelog: false, scm: [$class: 'GitSCM', branches: [[name: 'refs/heads/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [...]
checkout changelog: false, scm: [...]
checkout changelog: false, scm: [...]
Any of their commit will trigger my job, then during the job execution, I need to tell which repository trigger the job, to determine different stage to going on.
How can I get the repository info?