checkoutToSubdirectory not affecting downstream stages

早过忘川 提交于 2019-12-12 01:23:53

问题


I found checkoutToSubdirectory in the Jenkins pipeline docs and in the build console I am seeing output saying Running in /home/ec2-user/workspace/projectDir/subDir but then when the first

stage('install/fetch dependencies') {
  steps {

block it gets run in the normal workspace projectDir, not subDir. What else do I need to add to ensure my stages are run in the subDir?


回答1:


The checkoutToSubdirectory don't change the workspace for the build. You can change your workspace by setting WORKSPACE environment at the starting of stages. Use below lines to change workspace

pipeline{
    agent { label 'master' }
    environment { 
    WORKSPACE="${WORKSPACE}/subdir" 
    }
    stages{}
}


来源:https://stackoverflow.com/questions/53661791/checkouttosubdirectory-not-affecting-downstream-stages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!