问题描述
我在 Jenkins管道文档和构建控制台中找到了checkoutToSub目录看到输出显示Running in /home/ec2-user/workspace/projectDir/subDir
,但是当第一个
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 {
阻止它在常规工作空间projectDir
中运行,而不是在subDir
中运行.我还需要添加什么来确保我的stages
在subDir
中运行?
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
?
推荐答案
checkoutToSub目录不会更改构建的工作空间.您可以通过在阶段开始时设置WORKSPACE环境来更改工作空间.在下面几行中更改工作区
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{}
}
这篇关于checkoutToSub目录不影响下游阶段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!