Skip to content

Commit

Permalink
Use Jenkins Plugin Installation manager for showing updates
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg-nenashev committed May 27, 2020
1 parent 8723e7e commit 1c081df
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 334 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
Jenkins Config As Code Example.iml

# Plugin installation manager dev tools
jenkins-plugin-manager-*.jar
tmp/

# IDE
.classpath
.project
.settings
.factorypath
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM jenkins/jenkins:2.164.1
ARG JENKINS_VERSION=2.238
FROM jenkins/jenkins:$JENKINS_VERSION
MAINTAINER Oleg Nenashev <o.v.nenashev@gmail.com>
LABEL Description="This demo shows how to setup Jenkins Config-as-Code with Docker, Pipeline, and Groovy Hook Scripts" Vendor="Oleg Nenashev" Version="0.2"

# Plugin Installation Manager
ARG PLUGIN_MANAGER_TOOL_VERSION=1.0.2
RUN wget https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/plugin-management-parent-pom-$PLUGIN_MANAGER_TOOL_VERSION/jenkins-plugin-manager-$PLUGIN_MANAGER_TOOL_VERSION.jar -O /usr/share/jenkins/ref/jenkins-plugin-manager.jar

ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
COPY download-and-check-updates.sh /usr/local/bin/download-and-check-updates.sh
RUN /usr/local/bin/download-and-check-updates.sh < /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt

COPY init_scripts/src/main/groovy/ /usr/share/jenkins/ref/init.groovy.d/

Expand Down
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
PLUGIN_MANAGER_TOOL_VERSION=1.0.2
JENKINS_VERSION=2.238

build:
docker build -t onenashev/demo-jenkins-config-as-code .

Expand All @@ -6,3 +9,18 @@ run:

debug:
docker run --rm --name ci-jenkins-io-dev -e DEBUG=true -p 5005:5005 -v maven-repo:/root/.m2 -v ${MY_PIPELINE_LIBRARY_DIR}:/var/jenkins_home/pipeline-library -v ${MY_OTHER_PIPELINE_LIBS_DIRS}:/var/jenkins_home/pipeline-libs -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000 onenashev/demo-jenkins-config-as-code

clean:
rm -rf tmp

tmp/jenkins.war:
wget https://repo.jenkins-ci.org/releases/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war -O tmp/jenkins.war
touch tmp/jenkins.war

tmp/jenkins-plugin-manager.jar:
wget https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/plugin-management-parent-pom-${PLUGIN_MANAGER_TOOL_VERSION}/jenkins-plugin-manager-${PLUGIN_MANAGER_TOOL_VERSION}.jar -O tmp/jenkins-plugin-manager.jar
touch tmp/jenkins-plugin-manager.jar

show-updates: tmp/jenkins-plugin-manager.jar tmp/jenkins.war
mkdir -p tmp/plugins
java -jar tmp/jenkins-plugin-manager.jar --list -f plugins.txt --no-download -d tmp/plugins -w tmp/jenkins.war --available-updates
304 changes: 0 additions & 304 deletions download-and-check-updates.sh

This file was deleted.

Loading

4 comments on commit 1c081df

@reinholdfuereder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oleg-nenashev Just out of interest, why aren't you using the new "jenkins-plugin-manager.jar" (that you download at

RUN wget https://github.com/jenkinsci/plugin-installation-manager-tool/releases/download/plugin-management-parent-pom-$PLUGIN_MANAGER_TOOL_VERSION/jenkins-plugin-manager-$PLUGIN_MANAGER_TOOL_VERSION.jar -O /usr/share/jenkins/ref/jenkins-plugin-manager.jar
) instead of the "install-plugins.sh" (from Docker base image)?

@oleg-nenashev
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reinholdfuereder There were some fatal flaws in Plugin Installation Manager which prevented me from using it at that point. Many of them have been resolved in 1.1.0 and above, so now it totally makes sense to use Plugin Installation Manager instead

@reinholdfuereder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extremely fast response and your explanation!

@reinholdfuereder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dared to make a pull request for switching: #20

Please sign in to comment.