Skip to content

Commit fedbe3f

Browse files
committedJun 26, 2019
Cleanup Jenkins
1 parent f72f74b commit fedbe3f

11 files changed

+71
-291
lines changed
 

‎jenkins-fat/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/active-plugins.txt_SAVE
2+
Plugins

‎jenkins-fat/Dockerfile

+22-58
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:19.04
22
ENV DEBIAN_FRONTEND noninteractive
33
ENV JAVA_VERSION=8 \
44
JAVA_UPDATE=131 \
@@ -22,10 +22,11 @@ RUN apt-get update && apt-get -y install ansible
2222
#--------------------------------------------
2323
#------------ Docker
2424
#--------------------------------------------
25+
RUN echo
2526
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg > docker-public-key && \
2627
apt-key add docker-public-key && \
2728
rm docker-public-key
28-
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge" && \
29+
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) edge test" && \
2930
apt-get update && apt-get install -y docker-ce
3031
#--------------------------------------------
3132
#------------ Docker Compose
@@ -40,26 +41,14 @@ RUN curl -o /usr/bin/docker-compose -L \
4041

4142
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
4243

43-
# This is the line for the Jenkins prefix to set ... remember
44+
# This is the line for the Jenkins prefix to set to get access with nginx and a
45+
# comfortable path like http://<yourhost>/jenins... remember
4446
# to set the location in the reverse-proxy.conf if you change this
4547

4648
ENV JENKINS_OPTS="--webroot=/var/cache/jenkins/war --prefix=/jenkins"
4749
ENV GIT_SSL_NO_VERIFY=1
48-
#-----------------------------------------------
49-
# install Oracle Java if you want ... and
50-
# remove the line "RUN apt-get install -y openjdk-8-jdk"
51-
# and uncomment the next lines above ... but openjdk is pretty good !
52-
#-----------------------------------------------
53-
#------------ Download
54-
# ## ENV filename jdk-8u131-linux-x64.tar.gz
55-
# ## ENV downloadlink http://download.oracle.com/otn-pub/java/jdk/${JAVA_VERSION}u${JAVA_UPDATE}-b${JAVA_BUILD}/d54c1d3a095b4ff2b6607d096fa80163/jdk-${JAVA_VERSION}u${JAVA_UPDATE}-linux-x64.tar.gz
56-
# ## RUN wget --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" -O /tmp/$filename $downloadlink
57-
# ---- unpack java
58-
# ## ENV UNPACK_DIR=jdk1.8.0_131/
59-
# ## RUN mkdir -p /opt/ && tar -zxf /tmp/$filename -C /opt/ && ln -s /opt/${UNPACK_DIR} /opt/java
60-
# ## ENV JAVA_HOME /opt/java
6150
#----------------------------------------
62-
# install Maven
51+
# Maven
6352
#----------------------------------------
6453
RUN wget --no-verbose -O /tmp/apache-maven-3.5.3.tar.gz \
6554
http://archive.apache.org/dist/maven/maven-3/3.5.3/binaries/apache-maven-3.5.3-bin.tar.gz
@@ -89,61 +78,43 @@ RUN groupadd -g ${gid} ${group} && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid
8978
# Jenkins home directory is a volume, so configuration and build history
9079
# can be persisted and survive image upgrades
9180

81+
RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d && mkdir /tmp
82+
9283
VOLUME /var/jenkins_home
9384

94-
# `/usr/share/jenkins/ref/` contains all reference configuration we want
95-
# to set on a fresh new installation. Use it to bundle additional plugins
96-
# or config file with your custom jenkins Docker image.
97-
RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d && mkdir /tmp
9885
ENV TINI_VERSION 0.18.0
9986
ENV TINI_SHA eadb9d6e2dc960655481d78a92d2c8bc021861045987ccd3e27c7eae5af0cf33
10087
# Use tini as subreaper in Docker container to adopt zombie processes
10188
RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini \
10289
&& echo "$TINI_SHA /bin/tini" | sha256sum -c -
10390

104-
COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
105-
10691
# jenkins version being bundled in this docker image
107-
# This is the latest stable version
108-
ARG JENKINS_VERSION
109-
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.125}
92+
# This is the latest stable version define in file ../.env
93+
ARG JENKINS_LTS_VERSION
94+
RUN echo JENKINS_LTS_VERSION=${JENKINS_LTS_VERSION}
11095

11196
#### jenkins.war checksum, download will be validated using it
112-
ARG JENKINS_SHA=80d9a44198195f70218867086759c108821ca0ce
113-
ARG JENKINS_URL=http://updates.jenkins-ci.org/download/war/${JENKINS_VERSION}/jenkins.war
114-
115-
# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum
116-
# see https://github.com/docker/docker/issues/8331
117-
# RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha1sum -c -
118-
119-
RUN wget --no-verbose ${JENKINS_URL} -O /usr/share/jenkins/jenkins.war && \
120-
echo "422ba2120ade4c39e19c1aa63684c5db /usr/share/jenkins/jenkins.war" | md5sum -c
97+
ARG JENKINS_SHA=1ab9577a29362ae9cb51742d9778b44a5c820a9e
98+
ARG JENKINS_URL=http://updates.jenkins-ci.org/download/war/${JENKINS_LTS_VERSION}/jenkins.war
99+
# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum see https://github.com/docker/docker/issues/8331
100+
RUN echo Download from ${JENKINS_URL} && \
101+
curl -fL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war && \
102+
echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha1sum -c -
121103

122-
#------------------ Optional local caching of files
123-
# Download jenkins with yout favorite browser and put the war in the current dir.
124-
# COPY jenkins-war-${JENKINS_VERSION:-2.99}.war /usr/share/jenkins/jenkins.war
125104
###### # Copy all Cached plugins ...
126-
# to preLoad all Plugins listed in active-plugins.txt use the command
127-
# ./preDownload.sh $(cat active-plugins.txt)
128-
# this will download all the plugins in th Folder Plugins
129-
# COPY Plugins/* /usr/share/jenkins/ref/plugins/
130-
#------------------ Optional lokal caching of files end block
105+
COPY Plugins/${JENKINS_LTS_VERSION}/* /usr/share/jenkins/ref/plugins/
131106

132107
ENV JENKINS_UC https://updates.jenkins.io
133108
ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
134109
RUN chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref
135110

136111
# for main web interface, reversed-proxied by nginx
137112
EXPOSE 8080
138-
139113
ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
140-
141114
USER ${user}
142-
143115
COPY jenkins-support /usr/local/bin/jenkins-support
144116
COPY jenkins.sh /usr/local/bin/jenkins.sh
145-
146-
ENV JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.security.csrf.requestfield=crumb"
117+
ENV JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.security.csrf.requestfield=crumb -Djenkins.install.runSetupWizard=false"
147118

148119
ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
149120
#-------------------------------------------------------------------------
@@ -154,16 +125,9 @@ ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
154125
# curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | \
155126
# perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/ ' | awk -F: '{ print $1 }' | sort'
156127
# ----------------------------------------------------
157-
158-
# from a derived Dockerfile, can use `RUN /usr/local/bin/install-plugins.sh active.txt` to setup /usr/share/jenkins/ref/plugins from a support bundle
159-
160-
COPY plugins.sh /usr/local/bin/plugins.sh
161-
COPY install-plugins.sh /usr/local/bin/install-plugins.sh
162-
COPY active-plugins.txt /active-plugins.txt
163-
164-
RUN /usr/local/bin/plugins.sh active-plugins.txt
165-
166-
#install-plugins.sh get in trouble with curl maybe better next time in Jenkins ---> RUN /usr/local/bin/install-plugins.sh $(cat active-plugins.txt)
128+
# Prevent Setup Wizard .. all Plugins copied before
129+
RUN echo ${JENKINS_LTS_VERSION} > /usr/share/jenkins/ref/jenkins.install.UpgradeWizard.state
130+
RUN echo ${JENKINS_LTS_VERSION} > /usr/share/jenkins/ref/jenkins.install.InstallUtil.lastExecVersion
167131

168132
USER root
169133

‎jenkins-fat/Plugins/.gitkeep

Whitespace-only changes.

‎jenkins-fat/active-plugins.txt

Whitespace-only changes.

‎jenkins-fat/buildDockerImages.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
2-
docker build --tag jenkins-fat --file Dockerfile .
1+
. ../.env
2+
docker build --build-arg JENKINS_LTS_VERSION=$JENKINS_LTS --tag jenkins-fat --file Dockerfile .

‎jenkins-fat/docker-compose.yml

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
master:
2-
build: .
3-
environment:
4-
JAVA_OPTS: "-Djava.awt.headless=true"
5-
ports:
6-
- "50000:50000"
7-
- "8080:8080"
8-
volumes:
9-
- /var/jenkins_home
1+
version: "3"
2+
3+
networks:
4+
devstacknetwork:
5+
driver: bridge
6+
7+
services:
8+
jenkins:
9+
ports:
10+
- 8080:8080 # http://
11+
build:
12+
context: .
13+
args:
14+
JENKINS_LTS_VERSION: 2.176
15+
container_name: jenkins-fat
16+
networks:
17+
- devstacknetwork
18+
volumes:
19+
- /home/tom/devstack-data/jenkins:/var/jenkins_home
20+
- /var/run/docker.sock:/var/run/docker.sock
21+
22+

‎jenkins-fat/init.groovy

-12
This file was deleted.

‎jenkins-fat/plugins.sh

-130
This file was deleted.

‎jenkins-fat/max-plugins.txt ‎jenkins-fat/plugins.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
analysis-collector
21
ace-editor
2+
analysis-collector
33
analysis-core
44
ansible
55
ansicolor
@@ -21,12 +21,14 @@ cloudbees-folder
2121
compact-columns
2222
conditional-buildstep
2323
config-file-provider
24+
configuration-as-code
2425
console-badge
2526
console-column-plugin
2627
console-tail
2728
copyartifact
2829
credentials
2930
credentials-binding
31+
cucumber-reports
3032
cvs
3133
delivery-pipeline-plugin
3234
dependencyanalyzer
@@ -79,6 +81,7 @@ junit
7981
lastfailureversioncolumn
8082
lastsuccessversioncolumn
8183
ldap
84+
lockable-resources
8285
m2release
8386
mailer
8487
mapdb-api
@@ -130,8 +133,6 @@ timestamper
130133
token-macro
131134
variant
132135
violation-comments-to-github
133-
virtualbox
134-
windows-slaves
135136
workflow-aggregator
136137
workflow-api
137138
workflow-basic-steps

0 commit comments

Comments
 (0)
Failed to load comments.