diff options
author | Yonghee Han <onstudy@samsung.com> | 2015-09-08 17:14:43 +0900 |
---|---|---|
committer | Yonghee Han <onstudy@samsung.com> | 2015-09-08 17:14:43 +0900 |
commit | ee800bbe1f65e69bc39ee42cc0cee5448d1ff633 (patch) | |
tree | cc4c83e37f2361b4dbc26317d03feca89c3030e7 | |
parent | a3015a4908942ecbf87d76b283da4e8221eae93b (diff) | |
download | docker-script-ee800bbe1f65e69bc39ee42cc0cee5448d1ff633.tar.gz docker-script-ee800bbe1f65e69bc39ee42cc0cee5448d1ff633.tar.bz2 docker-script-ee800bbe1f65e69bc39ee42cc0cee5448d1ff633.zip |
fix a problem that Image is not work on docker-engine 1.8.1 versionjenkins
Change-Id: I582ba51ea2cd2e58f465f3372f9d5bf85a1b9074
-rwxr-xr-x | clientjenkins/config.conf | 3 | ||||
-rwxr-xr-x | clientjenkins/root/jobs/configuration | 86 | ||||
-rwxr-xr-x | devjenkins/Dockerfile | 84 | ||||
-rwxr-xr-x | devjenkins/config.conf | 3 | ||||
-rwxr-xr-x | devjenkins/root/jobs/configuration | 86 | ||||
-rwxr-xr-x | devjenkins/script/jenkins.sh | 22 | ||||
-rwxr-xr-x | devjenkins/script/rsync.sh | 4 | ||||
-rwxr-xr-x | devjenkins/script/startup.sh | 7 | ||||
-rwxr-xr-x | devjenkins/supervisor/supervisord.conf | 13 |
9 files changed, 252 insertions, 56 deletions
diff --git a/clientjenkins/config.conf b/clientjenkins/config.conf index 5f7b640..aaebc5f 100755 --- a/clientjenkins/config.conf +++ b/clientjenkins/config.conf @@ -17,7 +17,7 @@ export IMAGES="tizendocker:443/jenkins" ### Repository name (and optionally a tag) to be applied to the resulting image in case of success -export TAG="1.580.3-1.2.0.3" +export TAG="1.580.3-1.2.0.4" ### Assign a name to the container export CONTAINER="jenkins" @@ -34,6 +34,7 @@ export VOLUMES=" /home/jenkins/var/lib/jenkins/:/var/lib/jenkins/ /home/jenkins/var/lib/redis/default/:/var/lib/redis/default/ /home/jenkins/srv/obs/:/srv/obs/ + $(pwd)/root/jobs/:/root/jobs/ " ### Container host name diff --git a/clientjenkins/root/jobs/configuration b/clientjenkins/root/jobs/configuration new file mode 100755 index 0000000..f2677ab --- /dev/null +++ b/clientjenkins/root/jobs/configuration @@ -0,0 +1,86 @@ +# OBS related parameters +OBS_URL= +OBS_API_URL= +OBS_API_USERNAME= +OBS_API_PASSWD= + +# Gerrit related parameters +GERRIT_USERNAME=tizenrobot +GERRIT_HOSTNAME=tz.otcshare.org +GERRIT_SSHPORT=29418 +GERRIT_SILENT_MODE=0 + +# Redis server +REDIS_HOST=127.0.0.1 +REDIS_PORT=6379 + +# Git related parameters +GIT_CACHE_DIR=/var/lib/jenkins/git-cache +MAPPING_PROJECTS= +MAPPING_PRJ=scm/git-obs-mapping +REPOSYAML_PRJ=scm/meta/snapshot-repo-conf + +# Image Testing parameters +TESTABLE_IMAGE_DOWNLOADABLES=bz2,bmap +TESTABLE_IMAGE_FILTER=*.bz2 + +#Host name of smtp server +SMTP_SERVER= +#The name displayed in mail for jenkins usage +NOREPLY_EMAIL_SENDER=noreply@tizen.org +#Mailinglist which jenkins will send SR notification to it +MAILINGLIST= + +# Download server configuration +URL_PUBLIC_REPO_BASE= +PATH_REPO_BASE=/srv/download/ +PATH_LIVE_REPO_BASE=/srv/download/live/ + +# IRIS server configuration +IRIS_PUB_ENABLED=0 +IRIS_USERNAME= +IRIS_PASSWORDX= +IRIS_SERVER= + +## Image sync configuration +IMG_SYNC_DEST_BASE= + +## VM configuration +USE_VM=1 +VM_IMAGE=mic-appliance +VM_MEMORY=8192 +VM_CPUS=8 + +## Manifest content configuraion +GERRIT_FETCH_URL=ssh://review.tizen.org +GERRIT_REVIEW_URL=https://review.tizen.org/gerrit + +## List of active projects +ACTIVE_PROJECTS=Tizen:Common,Tizen:IVI,Tizen:Mobile,Tizen:TV,Tizen:Wearable +# Dry-run mode for sync-obs +SYNCOBS_DRYRUN=1 + +############################################ +# Below are sync instance parameters. Please +# enable them when deploy sync instance. +############################################ + +# Sync target gerrit related parameters +#SYNC_GERRIT_USERNAME= +#SYNC_GERRIT_HOSTNAME= +#SYNC_GERRIT_SSHPORT=29418 + +# The parent project of projects sync to gerrit +#GERRIT_PARENT_PROJECT=rsa-public-project + +# Use below regular expression to control which project should be synced to +# inside gerrit. Generally, projects under scm/ are specified for each domain, +# which should not be synced to inside. +# +# Example to sync all refs for platform/.* projects, and tizen branches and tags +# for apps/web/.* projects. +# [{'project':'^platform/.*$', 'refname':'.*'}, +# {'project':'^apps/web/.*$', 'refname':'^(tizen|refs/tags/.*)$'} +# ] +# +#SYNC_GERRIT_PROJECT_PATTERN=[{'project':'^(?!scm/).*$', 'refname':'.*'}] diff --git a/devjenkins/Dockerfile b/devjenkins/Dockerfile index 654ced0..0cd80e4 100755 --- a/devjenkins/Dockerfile +++ b/devjenkins/Dockerfile @@ -14,31 +14,30 @@ MAINTAINER onstudy@samsung.com #### addrepo #### RUN zypper --non-interactive addrepo "http://download.opensuse.org/repositories/OBS:/Server:/2.4/openSUSE_12.3/OBS:Server:2.4.repo" -#RUN zypper --non-interactive addrepo "http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_12.3/devel:languages:python.repo" RUN zypper --non-interactive addrepo "http://download.opensuse.org/repositories/Apache:/Modules/openSUSE_12.3/Apache:Modules.repo" -#### addrepo tizen services,tools #### -RUN zypper ar -Gf -t rpm-md -n "Tizen Services (openSUSE_12.3)" http://download.tizen.org/services/archive/0.15.13/openSUSE_12.3 tizen-services -RUN zypper mr -p 1 "Tizen Services (openSUSE_12.3)" -RUN zypper ar -Gf -t rpm-md -n "Tizen Tools (openSUSE_12.3)" http://download.tizen.org/tools/latest-release/openSUSE_12.3 tizen-tools -RUN zypper mr -p 1 "Tizen Tools (openSUSE_12.3)" +#### addrepo tizen services,tools #### +RUN zypper ar -Gf -t rpm-md -n "Tizen Services (openSUSE_12.3)" http://download.tizen.org/services/archive/0.15.13/openSUSE_12.3 tizen-services \ + && zypper mr -p 1 "Tizen Services (openSUSE_12.3)" \ + && zypper ar -Gf -t rpm-md -n "Tizen Tools (openSUSE_12.3)" http://download.tizen.org/tools/latest-release/openSUSE_12.3 tizen-tools \ + && zypper mr -p 1 "Tizen Tools (openSUSE_12.3)" -### addrepo opensuse Jenkins #### +#### addrepo opensuse Jenkins #### #RUN zypper --non-interactive addrepo http://pkg.jenkins-ci.org/opensuse-stable/ jenkins #### Install some useful or needed tools RUN zypper --non-interactive --no-gpg-checks ref RUN zypper --non-interactive in --recommends vim tar wget telnet sudo -#### INSTALL supervisor #### +#### INSTALL supervisor #### # download from http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_12.3/ -# devel:languages:python.repo -ADD ./supervisor/supervisor-3.1.3-1.1.noarch.rpm / -ADD ./supervisor/python-meld3-1.0.0-1.1.noarch.rpm / -RUN zypper --non-interactive in --recommends python-meld3-1.0.0-1.1.noarch.rpm -RUN zypper --non-interactive in --recommends supervisor-3.1.3-1.1.noarch.rpm -RUN rm supervisor-3.1.3-1.1.noarch.rpm -RUN rm python-meld3-1.0.0-1.1.noarch.rpm +# devel:languages:python.repo +ADD ./supervisor/supervisor-3.1.3-1.1.noarch.rpm / +ADD ./supervisor/python-meld3-1.0.0-1.1.noarch.rpm / +RUN zypper --non-interactive in --recommends python-meld3-1.0.0-1.1.noarch.rpm \ + && zypper --non-interactive in --recommends supervisor-3.1.3-1.1.noarch.rpm \ + && rm supervisor-3.1.3-1.1.noarch.rpm \ + && rm python-meld3-1.0.0-1.1.noarch.rpm RUN zypper clean @@ -50,7 +49,7 @@ RUN zypper --non-interactive in --recommends jenkins-1.580.3-1.2.noarch.rpm RUN rm jenkins-1.580.3-1.2.noarch.rpm RUN zypper --non-interactive in --recommends jenkins-plugins RUN zypper --non-interactive in --recommends jenkins-jobs jenkins-scripts -RUN zypper --non-interactive in --recommends kvm libvirt libvirt-python qemu virt-manager qemu-linux-user +RUN zypper --non-interactive in --recommends kvm qemu #### INSTALL REDIS #### RUN zypper --non-interactive in --recommends redis @@ -67,7 +66,6 @@ RUN mv mic-appliance.tar.bz2 /var/lib/jenkins/ RUN zypper --non-interactive in --recommends apache2 php5 php5-mysql RUN zypper --non-interactive in --recommends apache2-mod_php5 php5-gd php5-gettext RUN zypper --non-interactive in --recommends php5-mbstring php5-pear php5-curl php5-suhosin -RUN zypper --non-interactive in --recommends apache2-mod_proxy_html RUN sed -i 's/variables_order = "GPCS"/variables_order = "EGPCS"/g' /etc/php5/apache2/php.ini RUN a2enmod proxy @@ -84,34 +82,34 @@ RUN sed -i 's/yes/no/g' /etc/xinetd.d/rsync \ && rm /etc/rsyncd.conf #### BACKUP JENKINS #### -RUN mkdir /home/jenkins -RUN mv /var/lib/jenkins /home/jenkins/backup -RUN rm -rf /var/lib/jenkins -RUN sed -i 's/jenkins:\/bin\/false/jenkins:\/bin\/bash/g' /etc/passwd +RUN mkdir /home/jenkins \ + && mv /var/lib/jenkins /home/jenkins/backup \ + && rm -rf /var/lib/jenkins \ + && sed -i 's/jenkins:\/bin\/false/jenkins:\/bin\/bash/g' /etc/passwd #### Create a user account for Redis #### -RUN chown -R redis:redis /etc/redis/ -RUN chown -R redis:redis /var/log/redis/ -RUN chown -R redis:redis /var/lib/redis/ +RUN chown -R redis:redis /etc/redis/ \ + && chown -R redis:redis /var/log/redis/ \ + && chown -R redis:redis /var/lib/redis/ #### FIX REDIS #### -RUN cp /etc/redis/default.conf.example /etc/redis/redis.conf -RUN sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf +RUN cp -a /etc/redis/default.conf.example /etc/redis/redis.conf \ + && sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf #### PERMISSION JENKINS #### -RUN mkdir -p /srv/obs/repos/build -RUN mkdir -p /srv/obs/repos/snapshots -RUN mkdir -p /srv/obs/repos/prerelease -RUN chown -R jenkins:jenkins /srv/obs/ +RUN mkdir -p /srv/obs/repos/build \ + && mkdir -p /srv/obs/repos/snapshots \ + && mkdir -p /srv/obs/repos/prerelease \ + && chown -R jenkins:jenkins /srv/obs/ -RUN mkdir -p /srv/obs/repos/live -RUN chown -R wwwrun:www /srv/obs/repos/live +RUN mkdir -p /srv/obs/repos/live \ + && chown -R wwwrun:www /srv/obs/repos/live -RUN mkdir -p /home/download/repos/ -RUN ln -s /srv/obs/repos/snapshots/ /home/download/repos/snapshots -RUN ln -s /srv/obs/repos/live/ /home/download/repos/live -RUN ln -s /srv/obs/repos/prerelease/ /home/download/repos/prerelease -RUN ln -s /home/download/repos/ /srv/www/download +RUN mkdir -p /home/download/repos/ \ + && ln -s /srv/obs/repos/snapshots/ /home/download/repos/snapshots \ + && ln -s /srv/obs/repos/live/ /home/download/repos/live \ + && ln -s /srv/obs/repos/prerelease/ /home/download/repos/prerelease \ + && ln -s /home/download/repos/ /srv/www/download #### FIX APACHE2 #### ADD ./jenkins/etc/apache2/vhosts.d/default.conf /etc/apache2/vhosts.d/default.conf @@ -135,8 +133,16 @@ ADD ./supervisor/supervisord.conf /etc/supervisord.conf # Set environment variables. ENV HOME /root ENV TERM xterm +ENV TMOUT 1800 EXPOSE 8080 8888 6379 873 -WORKDIR /srv/script -CMD ["/bin/bash","/srv/script/startup.sh"] +WORKDIR /var/lib/jenkins + +#### CHKCONFIG ADD supervisord #### +RUN ln -s '/usr/lib/systemd/system/supervisord.service' '/etc/systemd/system/multi-user.target.wants/supervisord.service' +# Because DHCP setting error was not to set up a network in the init.d. +RUN chkconfig --del network + +### Enable Systemd Service ### +CMD ["/sbin/init"] diff --git a/devjenkins/config.conf b/devjenkins/config.conf index 5f7b640..aaebc5f 100755 --- a/devjenkins/config.conf +++ b/devjenkins/config.conf @@ -17,7 +17,7 @@ export IMAGES="tizendocker:443/jenkins" ### Repository name (and optionally a tag) to be applied to the resulting image in case of success -export TAG="1.580.3-1.2.0.3" +export TAG="1.580.3-1.2.0.4" ### Assign a name to the container export CONTAINER="jenkins" @@ -34,6 +34,7 @@ export VOLUMES=" /home/jenkins/var/lib/jenkins/:/var/lib/jenkins/ /home/jenkins/var/lib/redis/default/:/var/lib/redis/default/ /home/jenkins/srv/obs/:/srv/obs/ + $(pwd)/root/jobs/:/root/jobs/ " ### Container host name diff --git a/devjenkins/root/jobs/configuration b/devjenkins/root/jobs/configuration new file mode 100755 index 0000000..f2677ab --- /dev/null +++ b/devjenkins/root/jobs/configuration @@ -0,0 +1,86 @@ +# OBS related parameters +OBS_URL= +OBS_API_URL= +OBS_API_USERNAME= +OBS_API_PASSWD= + +# Gerrit related parameters +GERRIT_USERNAME=tizenrobot +GERRIT_HOSTNAME=tz.otcshare.org +GERRIT_SSHPORT=29418 +GERRIT_SILENT_MODE=0 + +# Redis server +REDIS_HOST=127.0.0.1 +REDIS_PORT=6379 + +# Git related parameters +GIT_CACHE_DIR=/var/lib/jenkins/git-cache +MAPPING_PROJECTS= +MAPPING_PRJ=scm/git-obs-mapping +REPOSYAML_PRJ=scm/meta/snapshot-repo-conf + +# Image Testing parameters +TESTABLE_IMAGE_DOWNLOADABLES=bz2,bmap +TESTABLE_IMAGE_FILTER=*.bz2 + +#Host name of smtp server +SMTP_SERVER= +#The name displayed in mail for jenkins usage +NOREPLY_EMAIL_SENDER=noreply@tizen.org +#Mailinglist which jenkins will send SR notification to it +MAILINGLIST= + +# Download server configuration +URL_PUBLIC_REPO_BASE= +PATH_REPO_BASE=/srv/download/ +PATH_LIVE_REPO_BASE=/srv/download/live/ + +# IRIS server configuration +IRIS_PUB_ENABLED=0 +IRIS_USERNAME= +IRIS_PASSWORDX= +IRIS_SERVER= + +## Image sync configuration +IMG_SYNC_DEST_BASE= + +## VM configuration +USE_VM=1 +VM_IMAGE=mic-appliance +VM_MEMORY=8192 +VM_CPUS=8 + +## Manifest content configuraion +GERRIT_FETCH_URL=ssh://review.tizen.org +GERRIT_REVIEW_URL=https://review.tizen.org/gerrit + +## List of active projects +ACTIVE_PROJECTS=Tizen:Common,Tizen:IVI,Tizen:Mobile,Tizen:TV,Tizen:Wearable +# Dry-run mode for sync-obs +SYNCOBS_DRYRUN=1 + +############################################ +# Below are sync instance parameters. Please +# enable them when deploy sync instance. +############################################ + +# Sync target gerrit related parameters +#SYNC_GERRIT_USERNAME= +#SYNC_GERRIT_HOSTNAME= +#SYNC_GERRIT_SSHPORT=29418 + +# The parent project of projects sync to gerrit +#GERRIT_PARENT_PROJECT=rsa-public-project + +# Use below regular expression to control which project should be synced to +# inside gerrit. Generally, projects under scm/ are specified for each domain, +# which should not be synced to inside. +# +# Example to sync all refs for platform/.* projects, and tizen branches and tags +# for apps/web/.* projects. +# [{'project':'^platform/.*$', 'refname':'.*'}, +# {'project':'^apps/web/.*$', 'refname':'^(tizen|refs/tags/.*)$'} +# ] +# +#SYNC_GERRIT_PROJECT_PATTERN=[{'project':'^(?!scm/).*$', 'refname':'.*'}] diff --git a/devjenkins/script/jenkins.sh b/devjenkins/script/jenkins.sh index 95c562d..4d0c0f5 100755 --- a/devjenkins/script/jenkins.sh +++ b/devjenkins/script/jenkins.sh @@ -21,10 +21,12 @@ chmod -R g+rw /dev/kvm if [ ! -d "/var/lib/jenkins/jobs" ]; then + /usr/sbin/rcjenkins stop cp -r /home/jenkins/backup/* /var/lib/jenkins tar -C /var/lib/jenkins -jxSf /var/lib/jenkins/mic-appliance.tar.bz2 rm /var/lib/jenkins/mic-appliance.tar.bz2 chown -R jenkins:jenkins /var/lib/jenkins + /usr/sbin/rcjenkins start fi if [ ! -d "/srv/obs/repos/" ]; @@ -58,8 +60,24 @@ then chmod -R a+rw /srv/obs/repos/prerelease fi +if [ -e "/root/jobs/configuration" ] +then + echo "cp jobs configuration" + cp /root/jobs/configuration /var/lib/jenkins/jobs/configuration + chown -R jenkins:jenkins /var/lib/jenkins/jobs/configuration +fi - - +if [ ! -e /var/lib/jenkins/docker_bootstrapped_0 ]; then + chown -R jenkins:jenkins /var/lib/jenkins + chown -R jenkins:jenkins /srv/obs/repos + chown -R wwwrun:www /srv/obs/repos/live + + touch /srv/obs/docker_bootstrapped_0 + if [ -e /srv/obs/docker_bootstrapped ]; then + rm /srv/obs/docker_bootstrapped + fi +else + status "found docker_bootstrapped" +fi diff --git a/devjenkins/script/rsync.sh b/devjenkins/script/rsync.sh index 0ca2a32..863ead2 100755 --- a/devjenkins/script/rsync.sh +++ b/devjenkins/script/rsync.sh @@ -60,6 +60,10 @@ use slp = false incoming chmod = u+w,a=r,D+xw EOF +chown -R redis:redis /etc/rsyncd.conf + +## Restart Rsyncd ### +rcrsyncd restart diff --git a/devjenkins/script/startup.sh b/devjenkins/script/startup.sh index f413901..cf6b4e5 100755 --- a/devjenkins/script/startup.sh +++ b/devjenkins/script/startup.sh @@ -19,6 +19,9 @@ /srv/script/rsync.sh -# start daemon -/usr/bin/supervisord -n +#start redis service +chown -R redis:redis /var/lib/redis +rcredis start +#start apache2 service +rcapache2 start
\ No newline at end of file diff --git a/devjenkins/supervisor/supervisord.conf b/devjenkins/supervisor/supervisord.conf index 0687287..0907bd8 100755 --- a/devjenkins/supervisor/supervisord.conf +++ b/devjenkins/supervisor/supervisord.conf @@ -3,15 +3,6 @@ nodaemon=true ;pidfile=/var/run/supervisord.pid ;logfile=/var/log/supervisor/supervisord.log -[program:jenkins] -command=/usr/sbin/rcjenkins start - -[program:redis] -command=redis-server /etc/redis/redis.conf - -[program:rcapache2] -command=/usr/sbin/rcapache2 start - -[program:rsyncd] -command=service rsyncd restart +[program:startup] +command=/srv/script/startup.sh |