JENKINS中是否有用于从节点主目录的env变量? [英] Is there a env variables for slave node home in JENKINS?

查看:279
本文介绍了JENKINS中是否有用于从节点主目录的env变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道有一个名为JENKINS_HOME的环境变量,因此我们可以在任何地方将其用作$ JENKINS_HOME. 但是现在当我在从属节点上运行项目时,我需要在从属节点上使用jenkins的主目录(在定义从属节点时命名为远程FS根目录")作为变量.而且我发现$ JENKINS_HOME始终是主节点上jenkins的主目录,即使我正在从属节点上运行项目.

We know there's a environment variable named JENKINS_HOME so we can use it anywhere as $JENKINS_HOME. But now when I running projects on slave nodes, I need to use the home directory of jenkins (which named "remote FS root" when defining a slave node) on slave node as a variable. And I found $JENKINS_HOME always be the home directory of jenkins on master node even I'm running projects on slave node.

任何人都可以帮忙吗?谢谢!

Anyone can help? Thank you!

推荐答案

我使用Jenkins管道插件,检索了作业运行所在的从节点的远程根目录

Using the Jenkins pipeline plugin, I retrieve the remote root directory of the slave node where the job is running at with

run.getEnvironment(listener).get("BASE")

这篇关于JENKINS中是否有用于从节点主目录的env变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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