Jenkins 管道如何更改到另一个文件夹 [英] Jenkins pipeline how to change to another folder
本文介绍了Jenkins 管道如何更改到另一个文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我正在使用 Jenkins 管道脚本.
Currently i am using Jenkins pipeline script.
要运行一个命令,我需要访问其工作区目录之外的文件夹.
For running one command, I need to access a folder outside its workspace directory.
我尝试了 sh "cd $workspace/"
,但它返回了当前工作区文件夹.
I tried sh "cd $workspace/"
, but it returned current workspace folder.
我如何更改到根工作区目录,然后 cd 到另一个文件夹.请帮忙.
How I can change to root workspace directory and then cd to another folder. Please help.
推荐答案
您可以使用 dir 步骤,示例:
You can use the dir step, example:
dir("folder") {
sh "pwd"
}
文件夹
可以是相对或绝对路径.
The folder
can be relative or absolute path.
这篇关于Jenkins 管道如何更改到另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文