失败到安装jenkins插件从docker文件

luaexgnf  于 2023-01-16  发布在  Jenkins
关注(0)|答案(1)|浏览(179)
ARG JENKINS_VERSION=lts-jdk11
FROM jenkins/jenkins:${JENKINS_VERSION}
COPY docker_files/jenkins-log.properties /etc/jenkins-log.properties
USER root
RUN apt-get update && apt-get install -y \
       ca-certificates curl gnupg2 \
       software-properties-common && \
    mkdir -p /data1/jenkins /var/cache/jenkins/war && chown -R jenkins:jenkins /data1/jenkins /var/cache/jenkins

USER jenkins
ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false -Duser.home=/data1/jenkins -Djenkins.model.Jenkins.slaveAgentPort=50000 -Djava.util.logging.config.file=/etc/jenkins-log.properties" \
    JENKINS_HOME="/data1/jenkins" \
    JENKINS_OPTS="--webroot=/var/cache/jenkins/war --httpPort=8081" \
    JENKINS_SLAVE_AGENT_PORT="50000"

EXPOSE 8081

RUN jenkins-plugin-cli --latest false --plugins " \
ansicolor:1.0.1 \
ant:1.11 \
antisamy-markup-formatter:2.1 \
"

将导致以下错误'无法解析插件URL https://updates.jenkins.io/latest/.hpi,或无法将插件下载到文件:状态代码:404,原因短语:找不到从镜像下载失败,正在回退到https://archives.jenkins.io/无法解析插件URL https://archives.jenkins.io/plugins/latest/.hpi,或将插件下载到文件:状态代码:404,原因短语:未找到',,,
有什么帮助吗?

uttx8gqw

uttx8gqw1#

jenkins-plugin-cli命令对于空格非常严格。我在尝试使用新行来保持插件列表可读时遇到了同样的问题。这在我的Dockerfiles中有效

...
RUN jenkins-plugin-cli --plugins \
"\
active-directory:2.29 \
antisamy-markup-formatter:155.v795fb_8702324 \
ws-cleanup:0.44 \
"
...

或者,可以使用文本文件,类似于旧插件安装程序脚本的使用方式

FROM jenkins/jenkins:lts-jdk11
COPY --chown=jenkins:jenkins plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN jenkins-plugin-cli -f /usr/share/jenkins/ref/plugins.txt

https://github.com/jenkinsci/docker/#preinstalling-plugins

相关问题