【问题标题】:jenkins job build not in slave node詹金斯作业不在从节点中构建
【发布时间】:2016-10-24 03:24:04
【问题描述】:

通过配置在从机中构建作业(构建 docker 映像,来自 github 的代码),但它不构建成功...如果在主服务器中更改工作,它构建成功


从属构建消息:

Started by user admin
Building remotely on jenkins-slave (slave) in workspace /home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq
Cloning the remote Git repository
Cloning repository git@github.com:xxxxxxx/wcount.git
 > git init /home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq # timeout=10
Fetching upstream changes from git@github.com:xxxxxxx/wcount.git
 > git --version # timeout=10
using GIT_SSH to set credentials 71bnh6gke9kmabye9qu2qsazzpofjsa
 > git -c core.askpass=true fetch --tags --progress     git@github.com:xxxxxxx/wcount.git +refs/heads/*:refs/remotes/origin/*
 > git config remote.origin.url git@github.com:xxxxxxx/wcount.git # timeout=10
 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
 > git config remote.origin.url git@github.com:xxxxxxx/wcount.git # timeout=10
Fetching upstream changes from git@github.com:xxxxxxx/wcount.git
using GIT_SSH to set credentials 71bnh6gke9kmabye9qu2qsazzpofjsa
 > git -c core.askpass=true fetch --tags --progress     git@github.com:xxxxxxx/wcount.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse origin/master^{commit} # timeout=10
Checking out Revision 5730301886fa5c02522705de817c5ddac0f0dbce (origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 5730301886fa5c02522705de817c5ddac0f0dbce
 > git rev-list 5730301886fa5c02522705de817c5ddac0f0dbce # timeout=10
ERROR: Build step failed with exception
java.lang.IllegalArgumentException: configured dockerFolder     '/home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq' does not exist.
        at     org.jenkinsci.plugins.dockerbuildstep.cmd.CreateImageCommand.execute(CreateImageCommand.java:93)
        at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:75)



主工作区是 /home/jenkins_home/workspace

从工作区是 /home/jenkins/workspace

我可以在从节点找到 /home/jenkins/workspace/71bnh8co385ctlmoxgbumdnpnet3ywq 目录。

我猜这是在主节点中构建的,但我在从属队列中看到了任务

【问题讨论】:

    标签: jenkins


    【解决方案1】:

    jenkins docker-build-step 插件不支持任务在从节点上运行,所以你可以修改一些代码来支持它。 给slave添加一个jar,可以创建镜像和推送镜像。然后master在slave中调用这个jar

    【讨论】:

      【解决方案2】:

      不确定这里是否是这种情况,但似乎 Jenkins 在构建阶段将Docker build/create 任务中的 Dockerfile 路径设置为$WORKSPACE/docker,因此您要么必须确保拥有该文件夹(包含 Dockerfile 和其他需要的文件) 在您的工作区/git repo 中,或者只是从上面的路径 ENV 中删除 docker(这是一个更好的解决方案,恕我直言),Jenkins 将从主工作区/git 目录中读取 Dockerfile。希望对您有所帮助。

      【讨论】:

        猜你喜欢
        • 2019-08-03
        • 2023-01-07
        • 1970-01-01
        • 2014-10-23
        • 2020-07-04
        • 1970-01-01
        • 1970-01-01
        • 2022-07-06
        • 1970-01-01
        相关资源
        最近更新 更多