Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Plugins fails in jenkins docker image

I have a Dockerfile for a custom Jenkins master like so:

FROM jenkins/jenkins:lts
USER root
ENV http_proxy http://xx.xx.xx.xx:8080
ENV https_proxy http://xx.xx.xx.xx:8080
RUN apt-get update
RUN apt-get install -y --allow-unauthenticated ldap-utils curl wget vim nano sudo git
RUN adduser jenkins sudo
User jenkins
ENV http_proxy http://xx.xx.xx.xx:8080
ENV https_proxy http://xx.xx.xx.xx:8080
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN  /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
RUN echo 2.176.2 > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state
RUN echo 2.176.2 > /usr/share/jenkins/ref/jenkins.install.InstallUtil.lastExecVersion
EXPOSE 9081
EXPOSE 50000

I expected that the plugins will be installed during docker build command docker build --no-cache -t jenkins .

But the install-plugins.sh fails to install the plugins

-max-time 60 https://updates.jenkins.io/download/plugins/structs-plugin/1.5/structs-plugin.hpi -o /usr/share/jenkins/ref/plugins/structs-plugin.jpi)
Failed to download plugin: structs or structs-plugin
curl: (22) The requested URL returned error: 403 Forbidden
14:21:00 Failure (22) Retrying in 1 seconds...
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/github-branch-source/1.10/github-branch-source.hpi -o /usr/share/jenkins/ref/plugins/github-branch-source.jpi)
Downloading plugin: github-branch-source-plugin from https://updates.jenkins.io/download/plugins/github-branch-source-plugin/1.10/github-branch-source-plugin.hpi
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/dashboard-view/2.9.10/dashboard-view.hpi -o /usr/share/jenkins/ref/plugins/dashboard-view.jpi)
Downloading plugin: dashboard-view-plugin from https://updates.jenkins.io/download/plugins/dashboard-view-plugin/2.9.10/dashboard-view-plugin.hpi
curl: (22) The requested URL returned error: 403 Forbidden
14:21:01 Failure (22) Retrying in 1 seconds...
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/statusmonitor/1.3/statusmonitor.hpi -o /usr/share/jenkins/ref/plugins/statusmonitor.jpi)
Downloading plugin: statusmonitor-plugin from https://updates.jenkins.io/download/plugins/statusmonitor-plugin/1.3/statusmonitor-plugin.hpi
14:21:01 Failed in the last attempt (curl -sSfL --connect-timeout 20 --retry 3 --retry-delay 0 --retry-max-time 60 https://updates.jenkins.io/download/plugins/ssh-agent/1.8/ssh-agent.hpi -o /usr/share/jenkins/ref/plugins/ssh-agent.jpi)
like image 596
user2439278 Avatar asked Oct 29 '19 14:10

user2439278


1 Answers

I used your Dockerfile to build the image, without proxy and it works fine. i used some of the plugins written in your output. So, your Dockerfile is fine, this issue could be the proxy.

This could be easily evaluate. Try to build this/another image while downloading a plugin with/without proxy.

like image 52
Manuel Avatar answered Sep 21 '22 00:09

Manuel