Skip to content

Commit

Permalink
Merge pull request #10 from oleg-nenashev/plugin-manager-tool
Browse files Browse the repository at this point in the history
Update Dependencies + Switch the updates check flow to Plugin manager tool
  • Loading branch information
oleg-nenashev authored May 27, 2020
2 parents 427963d + 251f204 commit d249f6c
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 333 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 <[email protected]>
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.

4 changes: 1 addition & 3 deletions init_scripts/src/main/groovy/scripts/System.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import hudson.security.csrf.DefaultCrumbIssuer
import jenkins.model.Jenkins
import jenkins.model.JenkinsLocationConfiguration
import jenkins.CLI
import jenkins.security.s2m.AdminWhitelistRule
import org.kohsuke.stapler.StaplerProxy
import hudson.tasks.Mailer
Expand All @@ -10,8 +9,7 @@ import hudson.plugins.locale.PluginImpl
println("-- System configuration")

// TODO: Configure Job Restrictions, Script Security, Authorize Project, etc., etc.
println("--- Configuring Remoting (JNLP4 only, no Remoting CLI)")
CLI.get().enabled = false
println("--- Configuring Remoting (JNLP4 only)")
Jenkins.instance.getExtensionList(StaplerProxy.class)
.get(AdminWhitelistRule.class)
.masterKillSwitch = false
Expand Down
Loading

0 comments on commit d249f6c

Please sign in to comment.