Commit 11a5922a authored by Clément Igonet's avatar Clément Igonet

Add jenkins container.

parent 670479b0
---
- name: jenkins4OEV
hosts: all
tasks:
- name: Copy jenkins4OEV plugins file
copy:
src: "{{ item.source}}"
dest: "{{ item.dest }}"
with_items:
- { source: '../jenkins/jenkins4OEV_home/plugins.txt', dest: '/home/oev/Projects/OpenEarthView/ci/becky.framasoft.org/docker/oev-jenkins/' }
register: copyJenkins4OEVPlugins
- debug: var=copyJenkins4OEVPlugins
- name: OEV Jenkins4OEV docker image
shell: |
groups
docker build -t 'oev-jenkins:jenkins4OEV' /home/oev/Projects/OpenEarthView/ci/becky.framasoft.org/docker/oev-jenkins/
register: jenkins4OEVImage
- debug: var=jenkins4OEVImage
- file: path=/home/oev/jenkins4FTP state=directory
- name: jenkins container for OEV
shell: |
# Remove old docker if any
docker ps -a | grep jenkins4OEV && docker rm -f jenkins4OEV
docker run \
-d \
--network="host" \
-v /home/oev/jenkins4FTP:/var/jenkins_home \
--name "jenkins4OEV" \
-e JAVA_OPTS="-Dhudson.diyChunking=false" \
'oev-jenkins:jenkins4OEV'
register: jenkins4OEVContainer
- debug: var=jenkins4OEVContainer
- name: Setup hosts in jenkins4OEV
shell: docker exec -u root jenkins4OEV /usr/local/bin/hosts.sh
- name: Generate new ssh keys for jenkins4OEV
shell: docker exec -u jenkins jenkins4OEV /usr/local/bin/ssh-keygen.sh "jenkins@jenkins4OEV"
- name: Get jenkins@jenkins4OEV public key
shell: docker exec jenkins4OEV cat /var/jenkins_home/.ssh/id_rsa.pub
register: jenkins4OEVPubKey
- name: Insert jenkins4OEVPubKey in hakan authorized_key
authorized_key: user=gexprod key="{{ jenkins4OEVPubKey.stdout }}"
......@@ -6,3 +6,4 @@
- include: bootstrap.yml
- include: docker.yml
- include: gitRepo.yml
- include: jenkins.yml
FROM jenkins:2.7.1
# Add script
USER root
ADD ./ssh-keygen.sh /usr/local/bin/
# JDK 7
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
RUN echo "deb http://apt.dockerproject.org/repo debian-jessie main" > /etc/apt/sources.list.d/docker.list
RUN apt-get update && apt-get install -y openjdk-7-jdk
RUN apt-get remove -y openjdk-8-jdk
RUN apt-get autoremove -y
#fontconfig fonts-dejavu-extra hicolor-icon-theme libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libcairo2 libdatrie1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libelf1 libgconf2-4 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif4 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgnome2-0 libgraphite2-3 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libharfbuzz0b libice-dev libjasper1 libjbig0 libllvm3.5 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libpciaccess0 libpixman-1-0 libpthread-stubs0-dev libsm-dev libthai-data libthai0 libtiff5 libtxc-dxtn-s2tc0 libx11-dev libx11-doc libxau-dev libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcb1-dev libxcomposite1 libxcursor1 libxdamage1 libxdmcp-dev libxfixes3 libxinerama1 libxrandr2 libxshmfence1 libxt-dev libxt6 libxxf86vm1 openjdk-7-jre x11proto-core-dev x11proto-input-dev x11proto-kb-dev xorg-sgml-doctools xtrans-dev
# Add hosts
USER root
ADD ./hosts /tmp/
ADD ./hosts.sh /usr/local/bin/
RUN /usr/local/bin/hosts.sh
# Add plugins
USER root
COPY plugins.txt /usr/share/jenkins/ref/
RUN /usr/local/bin/plugins.sh /usr/share/jenkins/ref/plugins.txt
# Start jenkins
USER jenkins
CMD ["/usr/local/bin/jenkins.sh"]
#!/bin/sh
while read p; do echo $p >> /etc/hosts ; done </tmp/hosts
#!/bin/sh
if [ $# -lt 1 ]; then
user="jenkins@gs-jenkins"
else
user="$1"
fi
if [ ! -f /var/jenkins_home/.ssh/id_rsa ]; then
ssh-keygen -t rsa -f /var/jenkins_home/.ssh/id_rsa -b 4096 -N "" -C "$user"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment