简体   繁体   中英

How to only git pull in particular folder from a repository using Jenkins?

I have a folder inside D:/TestFolder/ Now I need to git pull inside TestFolder using Jenkins every time I trigger a job. How is it possible?

Can anyone guide me on Jenkins git pull in a particular folder?

git plugins for Jenkins come with that option -

If you are using Jenkins freestyle job, 在此处输入图像描述

If you are using Jenkins scripted pipeline, It will be like

node() {
  stage('checkout') {
     checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'sub_folder']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'credentialId', url: 'http://repourl.net/x.git']]])

  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM