4

How do we achieve Git Additional Behavior in Jenkins pipeline?

Additional Behaviors
=> checkout to specific local branch

Mike G
  • 4,232
  • 9
  • 40
  • 66
Tarun Prakash
  • 93
  • 1
  • 5

2 Answers2

4

check this one http://your-Jenkins:8080/pipeline-syntax/ , you can have samples of all your installed plugins.

checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'your-sub-directory']], gitTool: 'Default', submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'd767bb7a-4c1e-4654-a310-996d4ece5b02', url: 'git@github.com:yyy/xxx.git']]])

enter image description here

Mor Lajb
  • 2,546
  • 1
  • 15
  • 28
1

you can find the pipeline syntax in your Jenkins job slide bar Pipeline Syntax section.

enter image description here

1、Sample Step select checkout: Check out from version control

2、click Additional Behaviours Add button

3、select checkout to specific local branch

4、click bottom Generate Pipeline Script button,you will get pipeline script.

nikeee
  • 10,248
  • 7
  • 40
  • 66
fzh
  • 688
  • 1
  • 6
  • 14