gpt4 book ai didi

docker - Jenkins CloudBees Docker Build插件如何设置其Shell路径

转载 作者:行者123 更新时间:2023-12-02 18:30:30 25 4
gpt4 key购买 nike

我正在使用继承的Jenkins安装。此安装已安装CloudBees Docker Custom Build Environment Plugin。我们认为此插件为我们的构建配置中的Docker容器复选框提供了一个不错的构建方式。当我们使用此选项配置作业时,看起来(基于Jenkins控制台输出),Jenkins使用以下命令运行构建

Docker container 548ab230991a452af639deed5eccb304026105804b38194d98250583bd7bb83q started to host the build
[WIP-Tests] $ docker exec -t 548ab230991a452af639deed5eccb304026105804b38194d98250583bd7bb83q /bin/sh -xe /tmp/hudson7939624860798651072.sh

但是-我们发现它运行的 /bin/sh具有非常有限的环境变量集-包括不包含 $PATH/bin!所以
  • CloudBees Docker自定义构建环境插件如何设置其/bin/sh环境。可以通过用户界面(如果是,在哪里)配置此用户吗?
  • 看起来Jenkins使用的是docker exec -我认为这意味着它必须使用docker run(在无形中)设置一个具有长时间运行过程的容器。没人知道CloudBees Docker自定义构建环境插件插件如何调用docker run,并且这是否可由用户管理?
  • 最佳答案

    考虑到此插件“可以接受”,我建议使用官方的JENKINS/Docker Pipeline Plugin

    source code show very few recent commits

    但不要忘记将任何容器has a default entrypoint设置为/bin/sh

    ENTRYPOINT ["/bin/sh", "-c"]

    然后:

    https://wiki.jenkins.io/download/attachments/78676506/Capture%20d%E2%80%99%C3%A9cran%202015-06-25%20%C3%A0%2018.07.49.png?version=1&modificationDate=1435248491000&api=v2

    The docker container is ran after SCM has been checked-out into a slave workspace, then all later build commands are executed within the container thanks to docker exec introduced in Docker 1.3



    这意味着您要拉取或构建/运行的图像必须具有 shell ,以允许 docker exec在其中执行命令。

    关于docker - Jenkins CloudBees Docker Build插件如何设置其Shell路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47893823/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com