从机上的Jenkins工作区路径 [英] Jenkins workspace path on slave machines

查看:451
本文介绍了从机上的Jenkins工作区路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们设置了一些共享工作空间的作业.工作流程是:

We have some jobs set up which share a workspace. The workflow is:

对于各个分支机构:

  • 构建一个大型的c ++项目FOO.

  • Build a big honking c++ project FOO.

执行几个下游测试,每个下游测试都使用FOO的工作区.

Execute several downstream tests, each of which uses the workspace of FOO.

我们通过将下游作业的使用自定义工作空间"字段分配给构建工作空间来完成此操作.

We accomplish this by assigning the "Use custom workspace" field of the downstream jobs to the build workspace.

最近,我们采取了一个分支,并将其分配给在Jenkins从机而非主服务器上构建.我很惊讶地发现:

Recently we took one branch and assigned it to be build on a Jenkins slave machine rather than on the master. I was surprised to find that:

在主服务器上,将foo存储库克隆到$JENKINS_JOBS_PATH/FOO/workspace/foo_repo,而在从服务器上,将存储库克隆到$JENKINS_JOBS_PATH/FOO/foo_repo.这导致我们不得不另外更改

On master, the foo repository was cloned to $JENKINS_JOBS_PATH/FOO/workspace/foo_repo while on slave, the repository was cloned to $JENKINS_JOBS_PATH/FOO/foo_repo. This resulted in our having to additionally change the

这是设计使然,还是我们以某种方式不一致地配置了主服务器和从服务器?

Is this by design, or have we somehow configured master and slave inconsistently?

推荐答案

旧版本的Jenkins将工作空间放在$ {JENKINS_HOME}/jobs/JOB/workspace目录下.升级后,该模式将保留在Jenkins实例中.新版本将工作空间放置在$ {JENKINS_HOME}/workspace/中.我怀疑从服务器不需要遵循旧模式(特别是如果它是更新的从服务器),因此目录在机器之间可能不一致.

Older versions of Jenkins put the workspace under the ${JENKINS_HOME}/jobs/JOB/workspace directories. After upgrading, this pattern stays with the Jenkins instance. New versions put the workspaces in ${JENKINS_HOME}/workspace/. I suspect the slaves don't need to follow the old pattern (especially if it is a newer slave), so the directories may not be consistent across machines.

您可以在Jenkins->配置Jenkins->高级中更改主服务器上工作区的位置.

You can change the location of the workspaces on the master in Jenkins -> Configure Jenkins -> Advanced.

我认为处理此问题的安全方法...如果要使用自定义工作区,则应将其用于所有工作,包括第一个构建大型honking c ++项目的工作.

I think the safe way to handle this... If you are going to use a custom workspace, you should use that for all of your jobs, including the first one that builds the big honking c++ project.

如果您是在管道中完成所有操作,则可以在单个作业中运行所有这些操作,并且可以更好地控制所有文件的位置,并且可以选择stashunstash,但是如果文件很大,隐藏可能不是走的路.

If you did this all in a pipeline, you can run all of this in a single job and have more control over where all the files are, and you have the option of stash and unstash, but if the files are huge, stash may not be the way to go.

这篇关于从机上的Jenkins工作区路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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