Jenkins管道如何更改为另一个文件夹 [英] Jenkins pipeline how to change to another folder

查看:82
本文介绍了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.

推荐答案

您可以使用

You can use the dir step, example:

dir("folder") {
    sh "pwd"
}

folder可以是相对路径,也可以是绝对路径.

The folder can be relative or absolute path.

这篇关于Jenkins管道如何更改为另一个文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆