且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何知道哪个git分支触发了詹金斯工作

更新时间:2023-02-13 20:36:44

您可以获取 GIT插件变量作为步骤结帐的返回值

You can get GIT Plugin variables as a return value of step checkout

即:

commit = checkout scm
println commit.GIT_URL

PS:您的标题应该是如何知道哪个git 存储库并触发了詹金斯工作".确实,对于获得分支的名称,我只会得到env.BRANCH_NAME

PS: your title should be "how to know which git repository and triggered the jenkins job". Indeed for getting a branch's name I would just get the value of env.BRANCH_NAME