Permalink
Browse files

add memcached ci job

Change-Id: I32b3c262c1f9f3851078b199918997c2da431cfa
  • Loading branch information...
1 parent 7993093 commit 2f5dc4be6646332821b984f0d806d66db6478f91 @SlimYang SlimYang committed Nov 14, 2012
Showing with 206 additions and 3 deletions.
  1. +3 −3 config/blobs.yml
  2. +203 −0 src/jenkins_jobs/SERVICES_Memcached_Warden/config.xml.erb
View
@@ -204,6 +204,6 @@ vpostgres/vpostgres.tgz:
sha: adfebccef8c102d145cf00284f9b19b99087e0b4
size: 16459135
wardenized_services/wardenized_services.tar.gz:
- object_id: eyJvaWQiOiI0ZTRlNzhiY2EzMWUxMjEyMDRlNGU4NmVlMzk2OTIwNTA5NzRl%0AZDQ4MzUyYyIsInNpZyI6IjRVOXNucmRjaVU3cXdaZzI3L1RoK29VT1U0OD0i%0AfQ==%0A
- sha: 072cb3ffc526471d78a89c624e91dd60c9c5aa95
- size: 477551550
+ object_id: eyJvaWQiOiI0ZTRlNzhiY2E0MWUxMjIyMDRlNGU5ODYzZDA3NjMwNTBhMzA1%0AZDM1NTFmNyIsInNpZyI6IjNJMFF4eDAxdzhxUVlZd3lqT1pvVUhVT2tLRT0i%0AfQ==%0A
+ sha: f77ed63486178a3417216c13f96c6ede12431c70
+ size: 478281511
@@ -0,0 +1,203 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<project>
+ <actions/>
+ <description></description>
+ <displayName>Memcached Warden Unit Test</displayName>
+ <logRotator>
+ <daysToKeep>30</daysToKeep>
+ <numToKeep>-1</numToKeep>
+ <artifactDaysToKeep>-1</artifactDaysToKeep>
+ <artifactNumToKeep>-1</artifactNumToKeep>
+ </logRotator>
+ <keepDependencies>false</keepDependencies>
+ <properties>
+ <hudson.plugins.throttleconcurrents.ThrottleJobProperty>
+ <maxConcurrentPerNode>0</maxConcurrentPerNode>
+ <maxConcurrentTotal>0</maxConcurrentTotal>
+ <throttleEnabled>false</throttleEnabled>
+ <throttleOption>project</throttleOption>
+ </hudson.plugins.throttleconcurrents.ThrottleJobProperty>
+ </properties>
+ <scm class="hudson.plugins.git.GitSCM">
+ <configVersion>2</configVersion>
+ <userRemoteConfigs>
+ <hudson.plugins.git.UserRemoteConfig>
+ <name></name>
+ <refspec></refspec>
+ <url>ssh://<%= ENV['CF_CI_USER'] %>@<%= ENV['CF_GERRIT_ADDRESS'] %>:<%= ENV['CF_GERRIT_PORT'] %>/vcap-services.git</url>
+ </hudson.plugins.git.UserRemoteConfig>
+ </userRemoteConfigs>
+ <branches>
+ <hudson.plugins.git.BranchSpec>
+ <name>master</name>
+ </hudson.plugins.git.BranchSpec>
+ </branches>
+ <disableSubmodules>false</disableSubmodules>
+ <recursiveSubmodules>false</recursiveSubmodules>
+ <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
+ <authorOrCommitter>false</authorOrCommitter>
+ <clean>false</clean>
+ <wipeOutWorkspace>false</wipeOutWorkspace>
+ <pruneBranches>false</pruneBranches>
+ <remotePoll>false</remotePoll>
+ <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
+ <gitTool>Default</gitTool>
+ <submoduleCfg class="list"/>
+ <relativeTargetDir></relativeTargetDir>
+ <reference></reference>
+ <excludedRegions></excludedRegions>
+ <excludedUsers></excludedUsers>
+ <gitConfigName></gitConfigName>
+ <gitConfigEmail></gitConfigEmail>
+ <skipTag>false</skipTag>
+ <includedRegions></includedRegions>
+ <scmName></scmName>
+ </scm>
+ <canRoam>true</canRoam>
+ <disabled>false</disabled>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <triggers class="vector"/>
+ <concurrentBuild>true</concurrentBuild>
+ <builders>
+ <hudson.tasks.Shell>
+ <command>export PATH=$VCAP_RUBY19/bin:$PATH
+
+RUBY19_REALPATH=`readlink -nf $VCAP_RUBY19`
+SQLITE_REALPATH=`readlink -nf $VCAP_SQLITE`
+GIT_REALPATH=`readlink -nf $VCAP_GIT`
+WARDEN_SRV_REALPATH=`readlink -nf $VCAP_WARDEN_SERVICE`
+WARDEN_PKG=/var/vcap/packages/warden/warden
+
+MEMCACHED_SVC=$PWD/ng/memcached
+rm -rf MEMCACHED_SVC/spec_reports
+
+echo &quot;creating the warden container for unit-test&quot;
+HANDLE=`$WARDEN_REPL_V2 -- create --bind_mounts[0].src_path &quot;$RUBY19_REALPATH&quot; --bind_mounts[0].dst_path &quot;$RUBY19_REALPATH&quot; --bind_mounts[0].mode RO \
+--bind_mounts[1].src_path &quot;$GIT_REALPATH&quot; --bind_mounts[1].dst_path &quot;$GIT_REALPATH&quot; --bind_mounts[1].mode RO \
+--bind_mounts[2].src_path &quot;$SQLITE_REALPATH&quot; --bind_mounts[2].dst_path $SQLITE_REALPATH --bind_mounts[2].mode RO \
+--bind_mounts[3].src_path &quot;$VCAP_WARDEN_SERVICE&quot; --bind_mounts[3].dst_path &quot;$WARDEN_PKG&quot; --bind_mounts[3].mode RO \
+--bind_mounts[4].src_path &quot;$WARDEN_SRV_REALPATH/root/linux/base/rootfs&quot; --bind_mounts[4].dst_path &quot;/var/vcap/data/warden/rootfs&quot; --bind_mounts[4].mode RO \
+--bind_mounts[5].src_path &quot;$WARDEN_INSTANCES&quot; --bind_mounts[5].dst_path &quot;$WARDEN_INSTANCES&quot; --bind_mounts[5].mode RW \
+| cut -d &quot; &quot; -f 3`
+
+TEST_RUNNER=`mktemp`
+cat &lt;&lt;-EOT &gt; $TEST_RUNNER
+#!/bin/bash
+set -x
+set -o errexit
+
+export PATH=$RUBY19_REALPATH/bin:$GIT_REALPATH/bin:$PATH
+export LIBRARY_PATH=$SQLITE_REALPATH/lib:$LIBRARY_PATH
+export C_INCLUDE_PATH=$SQLITE_REALPATH/include:$C_INCLUDE_PATH
+export CI_ENV=&apos;jenkins&apos;
+
+# nats expects to write in /var/vcap/sys/run
+sudo mkdir -p /var/vcap/sys/run
+sudo chown -R vcap:vcap /var/vcap/sys/run
+
+# prepare the log dir for warden
+mkdir -p /var/vcap/sys/log/warden
+
+# echo the address of github into the /etc/hosts in case warden cannot find it
+sudo echo &quot;207.97.227.239 github.com&quot; &gt;&gt; /etc/hosts
+
+# dynamically generate the config for the warden server
+cat &gt; /tmp/warden_server.yml &lt;&lt;-EOF
+---
+server:
+ container_klass: Warden::Container::Linux
+ container_grace_time: 300
+ unix_domain_permissions: 0777
+ container_rootfs_path: /var/vcap/data/warden/rootfs
+ container_depot_path: /var/vcap/data/warden/depot/$HANDLE
+ container_limits_conf:
+ nofile: 8192
+ nproc: 512
+ as: 4194304
+ quota:
+ disk_quota_enabled: false
+
+logging:
+ level: debug2
+
+network:
+ pool_start_address: 80.254.0.0
+ pool_size: 256
+
+user:
+ pool_start_uid: 10000
+ pool_size: 256
+EOF
+
+# start the warden server
+cd $WARDEN_PKG
+nohup bundle exec rake warden:start[/tmp/warden_server.yml] &gt;&gt; /var/vcap/sys/log/warden/warden.stdout.log 2&gt;&gt;/var/vcap/sys/log/warden/warden.stderr.log &amp;
+sleep 5
+
+cd /tmp/memcached_source/memcached
+rm -rf .bundle
+rm -rf vendor/bundle
+
+bundle install --deployment
+bundle exec rake spec:ci
+EOT
+
+echo &quot;enable vcap could execute sudo without password within warden&quot;
+sudo ls $WARDEN_INSTANCES/$HANDLE/ssh/ssh_config
+set +e
+vcap_sudo_line=&quot;vcap ALL=(ALL) NOPASSWD:ALL&quot;
+vcap_chk_ret=`sudo ssh -T -F $WARDEN_INSTANCES/$HANDLE/ssh/ssh_config root@container cat /etc/sudoers | grep &quot;$vcap_sudo_line&quot;`
+if test -z &quot;$vcap_chk_ret&quot;
+then
+ sudo ssh -T -F $WARDEN_INSTANCES/$HANDLE/ssh/ssh_config root@container chmod 740 /etc/sudoers
+ sudo ssh -T -F $WARDEN_INSTANCES/$HANDLE/ssh/ssh_config root@container &quot;echo \&quot;Defaults:vcap !requiretty\&quot; &gt;&gt; /etc/sudoers&quot;
+ sudo ssh -T -F $WARDEN_INSTANCES/$HANDLE/ssh/ssh_config root@container &quot;echo \&quot;$vcap_sudo_line\&quot; &gt;&gt; /etc/sudoers&quot;
+ sudo ssh -T -F $WARDEN_INSTANCES/$HANDLE/ssh/ssh_config root@container chmod 440 /etc/sudoers
+fi
+set -e
+
+echo &quot;staring the unit test&quot;
+$WARDEN_REPL -e -x -c &quot;
+copy $HANDLE in $MEMCACHED_SVC /tmp/memcached_source
+copy $HANDLE in $TEST_RUNNER /tmp
+run $HANDLE chmod +x $TEST_RUNNER
+run $HANDLE sudo /bin/bash $TEST_RUNNER
+copy $HANDLE out /tmp/memcached_source/memcached/spec_reports $MEMCACHED_SVC vcap:vcap
+copy $HANDLE out /tmp/memcached_source/memcached/spec_coverage $MEMCACHED_SVC vcap:vcap
+destroy $HANDLE
+&quot;
+
+rm -f $TEST_RUNNER</command>
+ </hudson.tasks.Shell>
+ </builders>
+ <publishers>
+ <hudson.tasks.ArtifactArchiver>
+ <artifacts>ng/memcached/spec_reports/**</artifacts>
+ <latestOnly>false</latestOnly>
+ </hudson.tasks.ArtifactArchiver>
+ <hudson.tasks.junit.JUnitResultArchiver>
+ <testResults>ng/memcached/spec_reports/*.xml</testResults>
+ <keepLongStdio>false</keepLongStdio>
+ <testDataPublishers/>
+ </hudson.tasks.junit.JUnitResultArchiver>
+ <hudson.plugins.rubyMetrics.rcov.RcovPublisher>
+ <reportDir>ng/memcached/spec_coverage/rcov</reportDir>
+ <targets>
+ <hudson.plugins.rubyMetrics.rcov.model.MetricTarget>
+ <metric>TOTAL_COVERAGE</metric>
+ <healthy>80</healthy>
+ <unhealthy>0</unhealthy>
+ <unstable>0</unstable>
+ </hudson.plugins.rubyMetrics.rcov.model.MetricTarget>
+ <hudson.plugins.rubyMetrics.rcov.model.MetricTarget>
+ <metric>CODE_COVERAGE</metric>
+ <healthy>80</healthy>
+ <unhealthy>0</unhealthy>
+ <unstable>0</unstable>
+ </hudson.plugins.rubyMetrics.rcov.model.MetricTarget>
+ </targets>
+ </hudson.plugins.rubyMetrics.rcov.RcovPublisher>
+ </publishers>
+ <buildWrappers/>
+</project>

0 comments on commit 2f5dc4b

Please sign in to comment.