Reputation: 1
Below is the groovy syntax, that checkout develop
branch on Build now
(manual checkout).
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? automatic trigger but not manual trigger...
Upvotes: 0
Views: 2246
Reputation: 12255
You can use Webhook to trigger your job in Jenkins on new commit. Repeat same settings in gitlab for both xyz and def repos.
Jenkins Settings:
Build when a change is pushed to GitLab. GitLab webhook URL:
http://yourjenkins/project/yourproject
, copy job_url.Allowed branches
, select Filter branches by name
and enter your branch name.Gitlab settings: - repeat same steps for xyz repo also.
http://yourjenkins/project/yourproject
, select Push events
and
press Add webhook
Upvotes: 2