[英]Jenkins scripted pipeline to trigger for every new commit
Below is the groovy syntax, that checkout develop
branch on Build now
(manual checkout). 下面是常规语法,即结账develop
分支Build now
(手动检出)。
node('node_1'){
stage('dev-staging'){
sh "cd ${WORKSPACE}"
dir('xyz') {
git branch: 'develop',
credentialsId: '71111-222-333-444-43333333a40',
url: 'ssh://git@10.xx.xx.xx:2222/abc_project/xyz.git'
}
dir('def') {
git branch: 'develop',
credentialsId: '71111-222-333-444-43333333a40',
url: 'ssh://git@10.xx.xx.xx:2222/abc_project/def.git'
}
}
}
How to trigger checkout from develop
branch, on every new commit on develop
branch? 如何在develop
分支上的每个新提交上触发从develop
分支签develop
? automatic trigger but not manual trigger... 自动触发而不是手动触发...
You can use Webhook to trigger your job in Jenkins on new commit. 您可以使用Webhook在新提交时触发您在Jenkins中的工作。 Repeat same settings in gitlab for both xyz and def repos. 在gitlab中为xyz和def仓库重复相同的设置。
Jenkins Settings: Jenkins设置:
Build when a change is pushed to GitLab. GitLab webhook URL: http://yourjenkins/project/yourproject
Build when a change is pushed to GitLab. GitLab webhook URL: http://yourjenkins/project/yourproject
选择Build when a change is pushed to GitLab. GitLab webhook URL: http://yourjenkins/project/yourproject
Build when a change is pushed to GitLab. GitLab webhook URL: http://yourjenkins/project/yourproject
, copy job_url. Build when a change is pushed to GitLab. GitLab webhook URL: http://yourjenkins/project/yourproject
,复制job_url。 Allowed branches
, select Filter branches by name
and enter your branch name. 查找Allowed branches
,选择Filter branches by name
然后输入分支名称。 Gitlab settings: - repeat same steps for xyz repo also. Gitlab设置: -对xyz repo也重复相同的步骤。
http://yourjenkins/project/yourproject
, select Push events
and press Add webhook
从Jenkins http://yourjenkins/project/yourproject
输入URL文本框job_url,选择“ Push events
,然后按“ Add webhook
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.