问题
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