Skip to content

Commit e9c988b

Browse files
committed
polish
back to Jenkins LTS (2.73.2) update docker / docker-compose add ansible
1 parent d710fe3 commit e9c988b

16 files changed

+387
-311
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ And _yes_ docker-plugin in jenkins works (docker in docker, usefull but not reco
133133

134134
### My next steps
135135

136-
* give you some more preconfiguratiom
136+
* give you some more preconfiguration
137+
* ~~install docker~~
138+
* ~~install docker-compose~~
139+
* ~~install ansible~~
137140
* ~~apply a gitlab runner~~
138141
* apply git-lfs
139142

docker-compose.yml.template

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
# Consider to Backup BASE_DATA_DIR
77
#
88
version: "3"
9+
10+
networks:
11+
devstacknetwork:
12+
driver: bridge
13+
914
services:
1015
ngnix:
1116
build: nginx-reverse
@@ -14,9 +19,13 @@ services:
1419
# SSH Bypassing into gitlab, if you want to change this edit nginx.conf also
1520
- "2222:2222" #ssh port of gitlab (ssh://git@myhostname:2222/scott/foo.git)
1621
- "5555:5555" #Gitlab Docker Registry do NOT use 5000, this is an internal PORT of the gitlab-ce Image
22+
networks:
23+
- devstacknetwork
1724
jenkins-fat:
1825
build: jenkins-fat
1926
dns: DNS_SERVER
27+
networks:
28+
- devstacknetwork
2029
volumes:
2130
- BASE_DATA_DIR/jenkins:/var/jenkins_home
2231
- /var/run/docker.sock:/var/run/docker.sock
@@ -30,9 +39,13 @@ services:
3039
# This needs explicit mapping due to
3140
# https://github.com/docker-library/postgres/blob/4e48e3228a30763913ece952c611e5e9b95c8759/Dockerfile.template#L52
3241
- BASE_DATA_DIR/sonar-db/postgresql_data:/var/lib/postgresql/data
42+
networks:
43+
- devstacknetwork
3344
sonar:
3445
image: sonarqube
3546
dns: DNS_SERVER
47+
networks:
48+
- devstacknetwork
3649
environment:
3750
- SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-db:5432/sonar
3851
volumes:
@@ -43,6 +56,8 @@ services:
4356
gitlab:
4457
image: 'gitlab/gitlab-ce:latest'
4558
dns: DNS_SERVER
59+
networks:
60+
- devstacknetwork
4661
environment:
4762
GITLAB_OMNIBUS_CONFIG: |
4863
external_url 'http://HOSTNAME/gitlab'
@@ -68,19 +83,22 @@ services:
6883
gitlabrunner:
6984
build: gitlabrunner
7085
dns: DNS_SERVER
86+
networks:
87+
- devstacknetwork
7188
environment:
7289
- DOCKER_DNS=DNS_SERVER
7390
- GITLAB_URL=http://HOSTNAME/gitlab
7491
- REGISTER_TOKEN=s3cretToken4Runner
75-
- REGISTER_MODE=KEEP #KEEP register a new runner an keep it. FRESH unregister all runners and always install a new (pipeline-history lost!)
92+
- REGISTER_MODE=FRESH #KEEP register a new runner an keep it. FRESH unregister all runners and always install a new (pipeline-history lost!)
7693
- REGISTER_TRYS=60 # every 10 seconds a try to register the runner..gitlab takes a long time to startup
7794
volumes:
7895
- BASE_DATA_DIR/gitlab-runner/config:/etc/gitlab-runner
7996
- /var/run/docker.sock:/var/run/docker.sock
80-
8197
nexus:
8298
image: sonatype/nexus3
8399
dns: DNS_SERVER
100+
networks:
101+
- devstacknetwork
84102
environment:
85103
- NEXUS_CONTEXT=nexus
86104
volumes:

gitlabrunner/entrypointAutoregister

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if test $REGISTER_MODE = "FRESH" -o $RUNNER_IS_PRESENT -ne 0 ; then
3636
while test $TRYS -gt 0 -a $REGISTERED -gt 0 ; do
3737
TRYS=$(expr $TRYS - 1)
3838
gitlab-runner register -n --url=${GITLAB_URL} --registration-token=${REGISTER_TOKEN} \
39-
--executor=docker --name=docker-runner \
39+
--executor=docker --name=docker-multi-runner \
4040
--run-untagged=true --locked=false --docker-image=docker:latest \
4141
--docker-privileged
4242
REGISTERED=$?
@@ -52,7 +52,7 @@ if test $REGISTER_MODE = "FRESH" -o $RUNNER_IS_PRESENT -ne 0 ; then
5252
gitlab-runner verify --delete
5353
sleep 1
5454
gitlab-runner register -n --url=${GITLAB_URL} --registration-token=${REGISTER_TOKEN} \
55-
--executor=docker --name=docker-runner \
55+
--executor=docker --name=docker--multi-runner \
5656
--run-untagged=true --locked=false --docker-image=docker:latest \
5757
--docker-privileged
5858
fi

jenkins-fat/Dockerfile

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,21 @@ RUN apt-get install -y openjdk-8-jdk
1313
#------------ Tools f Jenkins and apt-get to use SSL Repositorys
1414
RUN apt-get install -y --no-install-recommends apt-utils git wget curl graphviz \
1515
apt-transport-https ca-certificates software-properties-common
16+
#-----------------------------------------------
17+
#--------------- Ansible
18+
#-----------------------------------------------
19+
RUN apt-add-repository ppa:ansible/ansible 2>/dev/null
20+
RUN apt-get update && apt-get -y install ansible
21+
#--------------------------------------------
1622
#------------ Docker
23+
#--------------------------------------------
1724
RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg > docker-public-key && apt-key add docker-public-key && rm docker-public-key
1825
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
1926
RUN apt-get update && apt-get install -y docker-ce
27+
#--------------------------------------------
2028
#------------ Docker Compose
21-
RUN curl -o /usr/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.15.0/docker-compose-$(uname -s)-$(uname -m)" \
29+
#--------------------------------------------
30+
RUN curl -o /usr/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.16.1/docker-compose-$(uname -s)-$(uname -m)" \
2231
&& chmod +x /usr/bin/docker-compose
2332

2433
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
@@ -30,8 +39,7 @@ ENV GIT_SSL_NO_VERIFY=1
3039
#-----------------------------------------------
3140
# install Oracle Java if you want ... and
3241
# remove the line "RUN apt-get install -y openjdk-8-jdk"
33-
# and uncomment the next lines
34-
# above ... but openjdk is pretty good !
42+
# and uncomment the next lines above ... but openjdk is pretty good !
3543
#-----------------------------------------------
3644
#------------ Download
3745
# ## ENV filename jdk-8u131-linux-x64.tar.gz
@@ -63,9 +71,7 @@ ARG user=jenkins
6371
ARG group=jenkins
6472
ARG uid=1000
6573
ARG gid=1000
66-
# Jenkins is run with user `jenkins`, uid = 1000
67-
# If you bind mount a volume from the host or a data container,
68-
# ensure you use the same uid
74+
# Jenkins is run with user `jenkins`, uid = 1000 If you bind mount a volume from the host or a data container, ensure you use the same uid
6975
RUN groupadd -g ${gid} ${group} && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user}
7076
# Jenkins home directory is a volume, so configuration and build history
7177
# can be persisted and survive image upgrades
@@ -85,24 +91,34 @@ RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION
8591
COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy
8692

8793
# jenkins version being bundled in this docker image
94+
# This is the latest stable version
8895
ARG JENKINS_VERSION
89-
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.79}
96+
ENV JENKINS_VERSION ${JENKINS_VERSION:-2.73.2}
9097

91-
# jenkins.war checksum, download will be validated using it
92-
ARG JENKINS_SHA=272e035475837b5e1c4efb84c8b65949e3f658a3
98+
#### jenkins.war checksum, download will be validated using it
99+
ARG JENKINS_SHA=1489e498f682e8b61ce4cf8124de200f264b087c
93100

94-
# Can be used to customize where jenkins.war get downloaded from http://updates.jenkins-ci.org/download/war/2.79/jenkins.war
95101
ARG JENKINS_URL=https://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war
96102

97103
# could use ADD but this one does not check Last-Modified header neither does it allow to control checksum
98104
# see https://github.com/docker/docker/issues/8331
99105
RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha1sum -c -
100106

107+
#------------------ Optional lokal caching of files
108+
# Download jenkins with yout favorite browser and put the war in the current dir.
109+
#COPY jenkins-war-2.73.2.war /usr/share/jenkins/jenkins.war
110+
###### # Copy all Cached plugins ...
111+
# to preLoad all Plugins listed in active-plugins.txt use the command
112+
# ./preDownload.sh $(cat active-plugins.txt)
113+
# this will download all the plugins in th Folder Plugins
114+
# COPY Plugins/* /usr/share/jenkins/ref/plugins/
115+
#------------------ Optional lokal caching of files end block
101116

102117
ENV JENKINS_UC https://updates.jenkins.io
118+
ENV JENKINS_UC_EXPERIMENTAL=https://updates.jenkins.io/experimental
103119
RUN chown -R ${user} "$JENKINS_HOME" /usr/share/jenkins/ref
104120

105-
# for main web interface:
121+
# for main web interface, reversed-proxied by nginx
106122
EXPOSE 8080
107123

108124
ENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.log
@@ -115,24 +131,25 @@ COPY jenkins.sh /usr/local/bin/jenkins.sh
115131
ENV JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.security.csrf.requestfield=crumb"
116132

117133
ENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
118-
#-----------------------------------------------
119-
# get all Plugins from existing Jenins
120-
#-----------------------------------------------
134+
#-------------------------------------------------------------------------
135+
# get all Plugins from existing Jenins without Version (latest is used)
136+
#--------------------------------------------------------------------------
121137
# JENKINS_HOST=username:password@myhost.com:port
122-
# curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/'
138+
# curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | \
139+
# perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/ ' | awk -F: '{ print $1 }' | sort'
140+
# ----------------------------------------------------
123141

142+
# 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
124143

125-
# ----------------------------------------------------
126144
COPY plugins.sh /usr/local/bin/plugins.sh
127145
COPY install-plugins.sh /usr/local/bin/install-plugins.sh
128-
# Install additional plugins
129-
COPY plugins.txt /usr/share/jenkins/ref/
130-
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/ref/plugins.txt
131-
132-
USER root
146+
COPY active-plugins.txt /active-plugins.txt
133147

134-
RUN apt-get clean
148+
RUN /usr/local/bin/plugins.sh active-plugins.txt
135149

150+
#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)
136151

152+
USER root
137153

154+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
138155

jenkins-fat/Plugins/.gitkeep

Whitespace-only changes.

jenkins-fat/active-plugins.txt

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
ace-editor
2+
analysis-collector
3+
analysis-core
4+
ansible
5+
ansicolor
6+
ant
7+
antisamy-markup-formatter
8+
apache-httpcomponents-client-4-api
9+
authentication-tokens
10+
bouncycastle-api
11+
branch-api
12+
buildgraph-view
13+
build-monitor-plugin
14+
build-name-setter
15+
build-timeout
16+
buildtriggerbadge
17+
build-view-column
18+
build-with-parameters
19+
checkstyle
20+
cloudbees-folder
21+
compact-columns
22+
conditional-buildstep
23+
config-file-provider
24+
console-badge
25+
console-column-plugin
26+
console-tail
27+
copyartifact
28+
credentials
29+
credentials-binding
30+
cvs
31+
delivery-pipeline-plugin
32+
dependencyanalyzer
33+
depgraph-view
34+
display-url-api
35+
docker-commons
36+
docker-java-api
37+
docker-plugin
38+
docker-workflow
39+
durable-task
40+
email-ext
41+
envfile
42+
envinject
43+
envinject-api
44+
extensible-choice-parameter
45+
external-monitor-job
46+
favorite
47+
file-operations
48+
findbugs
49+
git
50+
git-changelog
51+
git-client
52+
github
53+
github-api
54+
github-branch-source
55+
gitlab-hook
56+
gitlab-logo
57+
gitlab-merge-request-jenkins
58+
gitlab-oauth
59+
gitlab-plugin
60+
git-parameter
61+
git-server
62+
git-tag-message
63+
gradle
64+
greenballs
65+
handlebars
66+
htmlpublisher
67+
jackson2-api
68+
javadoc
69+
jdepend
70+
jira
71+
jobConfigHistory
72+
job-dsl
73+
jobtype-column
74+
jquery
75+
jquery-detached
76+
jquery-ui
77+
jsch
78+
junit
79+
lastfailureversioncolumn
80+
lastsuccessdescriptioncolumn
81+
lastsuccessversioncolumn
82+
ldap
83+
m2release
84+
m2-repo-reaper
85+
mailer
86+
mapdb-api
87+
matrix-auth
88+
matrix-project
89+
maven-artifact-choicelistprovider
90+
maven-plugin
91+
modernstatus
92+
momentjs
93+
nested-view
94+
nexus-artifact-uploader
95+
nexus-jenkins-plugin
96+
notification
97+
pam-auth
98+
parameterized-trigger
99+
pipeline-build-step
100+
pipeline-github-lib
101+
pipeline-graph-analysis
102+
pipeline-input-step
103+
pipeline-milestone-step
104+
pipeline-model-api
105+
pipeline-model-declarative-agent
106+
pipeline-model-definition
107+
pipeline-model-extensions
108+
pipeline-rest-api
109+
pipeline-stage-step
110+
pipeline-stage-tags-metadata
111+
pipeline-stage-view
112+
plain-credentials
113+
post-completed-build-result
114+
promoted-builds
115+
promoted-builds-simple
116+
pubsub-light
117+
repository-connector
118+
resource-disposer
119+
ruby-runtime
120+
run-condition
121+
saferestart
122+
scm-api
123+
script-security
124+
sonar
125+
sonar-quality-gates
126+
sse-gateway
127+
ssh-credentials
128+
ssh-slaves
129+
structs
130+
subversion
131+
timestamper
132+
token-macro
133+
variant
134+
violation-comments-to-github
135+
virtualbox
136+
windows-slaves
137+
workflow-aggregator
138+
workflow-api
139+
workflow-basic-steps
140+
workflow-cps
141+
workflow-cps-global-lib
142+
workflow-durable-task-step
143+
workflow-job
144+
workflow-multibranch
145+
workflow-scm-step
146+
workflow-step-api
147+
workflow-support
148+
ws-cleanup

0 commit comments

Comments
 (0)