Arun
Arun

Reputation: 1

failing to install jenkins plugins from docker file

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 \
"

it results in following error `Unable to resolve plugin URL https://updates.jenkins.io/latest/.hpi, or download plugin to file: status code: 404, reason phrase: Not Found Downloading from mirrors failed, falling back to https://archives.jenkins.io/ Unable to resolve plugin URL https://archives.jenkins.io/plugins/latest/.hpi, or download plugin to file: status code: 404, reason phrase: Not Found`` ,,,

any help with this ??

Upvotes: 0

Views: 1675

Answers (1)

rgb3998Q
rgb3998Q

Reputation: 11

The jenkins-plugin-cli command is very strict regarding spaces. I ran into the same issue trying to use new lines to keep a readable plugin list. This works in my Dockerfiles

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

Alternatively, a text file can be used similar to how the old plugin installer script was used

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

Upvotes: 1

Related Questions