首页 > 解决方案 > 如何在 dir() 步骤中跳过工作区文件夹创建?

问题描述

每当我尝试使用以下代码运行作业时:

agent { 
    node {
        label 'my-label'
        customWorkspace "$workspacePath"
    }
}

steps {
    script {
        dir ("$dirPath") {

詹金斯的行为是这样的:

Running on my-label in /home/jenkins/default-workspace/my-job
Running in /home/jenkins/custom-workspace
Running in /home/somebody/dir-step-path

并尝试在dir(){}步骤中指定的文件夹内创建工作区目录

有没有办法强制詹金斯不在dir(){}步骤中指定的文件夹中创建工作区目录?

标签: jenkinsjenkins-pipeline

解决方案


推荐阅读