从机上的Jenkins工作空间路径不一致 [英] Inconsistent Jenkins workspace path on slave machines

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

问题描述

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

We have some jobs set up which share a workspace. The workflow for the various branches is:

  • 构建一个大型的C ++项目,名为foo.
  • 执行几个下游测试,每个测试都使用foo的工作空间.
  • Build a big honking C++ project called foo.
  • Execute several downstream tests, each of which uses the workspace of foo.

我们通过将下游作业的Use custom workspace字段分配给构建工作区来实现这一点.

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

最近,我们采取了一个分支,并将其分配给在Jenkins从机而非主服务器上构建.我很惊讶地发现,在主服务器上,foo存储库被克隆到了$JENKINS_JOBS_PATH/FOO/workspace/foo_repo-而在从服务器上,该存储库被克隆了了$JENKINS_JOBS_PATH/FOO/foo_repo.

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 on master, the foo repository was cloned to $JENKINS_JOBS_PATH/FOO/workspace/foo_repo - while on the slave, the repository was cloned to $JENKINS_JOBS_PATH/FOO/foo_repo.

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

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天全站免登陆