Jenkins 具有使用同一台机器的多个代理

发布于 2025-01-07 11:45:08 字数 2316 浏览 6 评论 0原文

目前我的 Jenkins 设置仅限于一个执行者。这几乎是我们构建的要求,因为我们有一个用户特定的日志文件,每个构建都会创建该文件。为了获得多个执行程序,我只是在本地机器上进行了从属设置。我希望我们所有的奴隶共享同一个工作区,所以我只是创建了一个符号链接。话虽这么说,我必须在工作区上 chmod 775,以便它更多地是基于组的工作区。无论如何,有没有办法让多个詹金斯奴隶共享一个工作区?

编辑:关于我的 1 个执行者限制。我们的应用程序是一个动作脚本应用程序,我们有很多在构建过程中运行的单元测试,并创建闪存日志。我们希望能够为每个构建提供闪存日志。 unix 上的 flash log 存储在用户主目录中。从版本 10.1 开始,您无法更改 mm.cfg 中的位置。由于 Jenkins 以用户身份运行,我们无法同时运行多个 Flexunit 测试实例,也无法正确捕获 flash 日志。

这是我遇到的一些烫发失败:

Fetching upstream changes from git@company:repo/repo.git
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
hudson.plugins.git.GitException: Error performing command: git fetch -t git@company:repo/repo.git             
+refs/heads/*:refs/remotes/origin/*
Command "git fetch -t git@company:repo/repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: error: insufficient permission for adding an object to repository database .git/objects

fatal: failed to write object
fatal: unpack-objects failed

at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:776)
at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741)
at hudson.plugins.git.GitAPI.fetch(GitAPI.java:190)
at hudson.plugins.git.GitAPI.fetch(GitAPI.java:978)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:765)
at hudson.plugins.git.GitSCM.access$100(GitSCM.java:80)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1003)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:970)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2045)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:287)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

Caused by: hudson.plugins.git.GitException: Command "git fetch -t git@company:repo/repo.git +refs/heads/:refs/remotes/origin /”返回状态代码128:错误:没有足够的权限将对象添加到存储库数据库.git/objects

Currently my Jenkins setup is limited to one executor. This is pretty much a requirement of our build because we have a user specific log file that's getting created every build. To get multiple executors I just made slaves setup on the local box. I wanted all of our slaves to share the same workspace so I just created a symlink. That being said I had to chmod 775 on the workspace so that it was more of group based workspace. Is there anyway to have multiple jenkins slaves share one workspace?

Edit: In regards to my 1 executor limitation. Our application is a actionscript app and we have a lot of unit tests that run during our build and that creates a flash log. We want to be able to have the flash log for every build. The flash log on unix is stored in the users home directory. As of version 10.1 you aren't able to change the location in mm.cfg. Since Jenkins runs as a user we can't run multiple instances of flexunit tests at the same time and be able to capture the flash log correctly.

Here is some perm failures I'm getting:

Fetching upstream changes from git@company:repo/repo.git
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
hudson.plugins.git.GitException: Error performing command: git fetch -t git@company:repo/repo.git             
+refs/heads/*:refs/remotes/origin/*
Command "git fetch -t git@company:repo/repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128: error: insufficient permission for adding an object to repository database .git/objects

fatal: failed to write object
fatal: unpack-objects failed

at hudson.plugins.git.GitAPI.launchCommandIn(GitAPI.java:776)
at hudson.plugins.git.GitAPI.launchCommand(GitAPI.java:741)
at hudson.plugins.git.GitAPI.fetch(GitAPI.java:190)
at hudson.plugins.git.GitAPI.fetch(GitAPI.java:978)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:765)
at hudson.plugins.git.GitSCM.access$100(GitSCM.java:80)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:1003)
at hudson.plugins.git.GitSCM$2.invoke(GitSCM.java:970)
at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2045)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:287)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

Caused by: hudson.plugins.git.GitException: Command "git fetch -t git@company:repo/repo.git +refs/heads/:refs/remotes/origin/" returned status code 128: error: insufficient permission for adding an object to repository database .git/objects

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

朦胧时间 2025-01-14 11:45:08

更新:此答案不正确,请参阅评论。

转到每个从站的节点配置 (http://[jenkins_server]/computer/[slave_name]/configure) 并将远程 FS 根设置为 的值主目录的主目录master的主目录可以通过http://[jenkins_server]/configure找到。以防万一,请单击主目录下的高级按钮,并确保工作区根目录设置为类似${ITEM_ROOTDIR}/工作空间(因为从站将在[Remote FS root]/workspace中创建其工作空间)。

也就是说,我不能保证您在尝试从同一工作区中的各个从站运行作业时不会遇到各种问题。

Update: this answer is incorrect, please see the comment.

Go to Node Configuration for every slave (http://[jenkins_server]/computer/[slave_name]/configure) and set Remote FS root to the value of Home directory of the master. master's home directory can be found via http://[jenkins_server]/configure. Just in case click Advanced button under Home Directory and make sure that Workspace Root Directory is set to something like ${ITEM_ROOTDIR}/workspace (because the slaves will create their workspaces in [Remote FS root]/workspace).

That said, I can't guarantee that you won't run into various problems trying to run jobs from various slaves in the same workspace.

漫漫岁月 2025-01-14 11:45:08

我假设您在工作区中存储了一些您想要在构建之间保留/共享的信息。为此,您可能需要考虑使用 复制到从属插件

I am assuming you store some information in the workspace that you want to persist/share among the builds. For that you may want to consider using Copy to Slave Plugin.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文