从 Jenkins 中的管道脚本获取 github webhook 信息
Get github webhook info from pipeline script in Jenkins
是否可以从 jenkins 管道脚本中获取 github webhook 信息?
例如,我想知道分支名称和 repo url。此外,它将用于将 github 存储库克隆到本地计算机:
git credentialsId: 'xxx', url: 'xxx', branch: 'xxx'
我认为更好的方法是使用 https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Multibranch+Plugin. By using this plugin and this answer - - 你可以找到分支名称。
我通过打印出作业可用的环境变量解决了这个问题:
echo "env: ${env.getEnvironment()}"
看看有什么可用的。
我正在使用 Github 并看到:
BRANCH, BRANCH_NAME, CHANGE_AUTHOR, CHANGE_AUTHOR_DISPLAY_NAME, CHANGE_BRANCH, CHANGE_ID, CHANGE_TARGET, CHANGE_TITLE, CHANGE_URL...
是否可以从 jenkins 管道脚本中获取 github webhook 信息?
例如,我想知道分支名称和 repo url。此外,它将用于将 github 存储库克隆到本地计算机:
git credentialsId: 'xxx', url: 'xxx', branch: 'xxx'
我认为更好的方法是使用 https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Multibranch+Plugin. By using this plugin and this answer -
我通过打印出作业可用的环境变量解决了这个问题:
echo "env: ${env.getEnvironment()}"
看看有什么可用的。
我正在使用 Github 并看到:
BRANCH, BRANCH_NAME, CHANGE_AUTHOR, CHANGE_AUTHOR_DISPLAY_NAME, CHANGE_BRANCH, CHANGE_ID, CHANGE_TARGET, CHANGE_TITLE, CHANGE_URL...