Permalink
Browse files

Merge "add wardenized service ci support for warden v2"

  • Loading branch information...
2 parents 840d03c + 638c649 commit a7ee865a43cab6905f620dd976fb60cf20c65042 @SlimYang SlimYang committed with Gerrit Code Review Nov 6, 2012
View
@@ -27,10 +27,6 @@ ruby/ruby-1.8.7-p357.tar.bz2:
object_id: eyJvaWQiOiI0ZTRlNzhiY2E1MWUxMjEyMDRlNGU4NmVlOGUyYzkwNTA1MmU1%0AY2EzNGI4NCIsInNpZyI6Im9haVBNWVJxTmxEaE1ZM3RXbWpBbkplY0xUUT0i%0AfQ==%0A
sha: ba5ec0ab663976f00fb405be6cfef546bcf0e4e9
size: 4208157
-warden_service/warden-service.tgz:
- object_id: eyJvaWQiOiI0ZTRlNzhiY2EzMWUxMjIwMDRlNGU4ZWM2NDZlMjEwNTA1MmU1%0AY2QyYjI0ZiIsInNpZyI6InM1NDRKOElmbUxNdWNOdWtZTk5NT2svL1F3az0i%0AfQ==%0A
- sha: a08307c5051aa155831d91bb09b562334677bc2a
- size: 185472587
sqlite/sqlite-autoconf-3070500.tar.gz:
object_id: eyJvaWQiOiI0ZTRlNzhiY2ExMWUxMjIyMDRlNGU5ODYzOGI3NjMwNTA1MmU1%0AZGI0NjhhYyIsInNpZyI6ImxVK3hDU2NMWE51SGhJazlmcUFtSEQ4bjQybz0i%0AfQ==%0A
sha: 4e1338497b8da50b84307191bb3418e9ec5715d7
@@ -207,3 +203,7 @@ vpostgres/vpostgres.tgz:
object_id: eyJvaWQiOiI0ZTRlNzhiY2E0MWUxMjIwMDRlNGU4ZWM2NWY2N2YwNTA1MmU2%0AMzJkZDFlMyIsInNpZyI6Im0zbGUyTnQvZ3R0ZW9zZE1zckdWaDc5T0Ivaz0i%0AfQ==%0A
sha: adfebccef8c102d145cf00284f9b19b99087e0b4
size: 16459135
+wardenized_services/wardenized_services.tar.gz:
+ object_id: eyJvaWQiOiI0ZTRlNzhiY2EzMWUxMjEyMDRlNGU4NmVlMzk2OTIwNTA5NzRl%0AZDQ4MzUyYyIsInNpZyI6IjRVOXNucmRjaVU3cXdaZzI3L1RoK29VT1U0OD0i%0AfQ==%0A
+ sha: 072cb3ffc526471d78a89c624e91dd60c9c5aa95
+ size: 477551550
@@ -76,7 +76,7 @@
<string>VCAP_MEMCACHED</string>
<string>/var/vcap/packages/memcached</string>
<string>VCAP_WARDEN_SERVICE</string>
- <string>/var/vcap/packages/warden-service</string>
+ <string>/var/vcap/packages/wardenized_services</string>
<string>VCAP_ELASTIC</string>
<string>/var/vcap/packages/elasticsearch</string>
<string>VCAP_COUCHDB</string>
@@ -38,7 +38,7 @@ packages:
- vblob
- mysql-service
- vpostgres
- - warden-service
+ - wardenized_services
- elasticsearch
- couchdb
- zabbix_agent
@@ -1,10 +0,0 @@
-# abort script on any command that exit with a non zero value
-set -e
-
-mkdir unpack_warden_service
-tar zxf warden_service/warden-service.tgz -C unpack_warden_service
-
-(
- cd unpack_warden_service
- cp -af 1.1/* $BOSH_INSTALL_TARGET
-)
@@ -1,4 +0,0 @@
----
-name: warden-service
-files:
-- warden_service/warden-service.tgz
@@ -0,0 +1,10 @@
+# abort script on any command that exit with a non zero value
+set -e
+
+mkdir unpack_wardenized_services
+tar zxf wardenized_services/wardenized_services.tar.gz -C unpack_wardenized_services
+(
+ cd unpack_wardenized_services
+ rm -rf ${BOSH_INSTALL_TARGET}
+ cp -af 1.1 ${BOSH_INSTALL_TARGET}
+)
@@ -0,0 +1,4 @@
+---
+name: wardenized_services
+files:
+- wardenized_services/wardenized_services.tar.gz
@@ -3,12 +3,12 @@
<actions/>
<description></description>
<displayName>Mongodb Warden Unit Test</displayName>
-  <logRotator>
-    <daysToKeep>30</daysToKeep>
-    <numToKeep>-1</numToKeep>
-    <artifactDaysToKeep>-1</artifactDaysToKeep>
-    <artifactNumToKeep>-1</artifactNumToKeep>
-  </logRotator>
+ <logRotator>
+ <daysToKeep>30</daysToKeep>
+ <numToKeep>-1</numToKeep>
+ <artifactDaysToKeep>-1</artifactDaysToKeep>
+ <artifactNumToKeep>-1</artifactNumToKeep>
+ </logRotator>
<keepDependencies>false</keepDependencies>
<properties>
<hudson.plugins.throttleconcurrents.ThrottleJobProperty>
@@ -23,13 +23,13 @@
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name></name>
- <refspec>$GERRIT_REFSPEC</refspec>
+ <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>$GERRIT_BRANCH</name>
+ <name>master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<disableSubmodules>false</disableSubmodules>
@@ -40,9 +40,7 @@
<wipeOutWorkspace>false</wipeOutWorkspace>
<pruneBranches>false</pruneBranches>
<remotePoll>false</remotePoll>
- <buildChooser class="com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser">
- <separator>#</separator>
- </buildChooser>
+ <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
<gitTool>Default</gitTool>
<submoduleCfg class="list"/>
<relativeTargetDir></relativeTargetDir>
@@ -72,15 +70,18 @@ MONGODB_REALPATH=`readlink -nf $VCAP_MONGODB`
WARDEN_SRV_REALPATH=`readlink -nf $VCAP_WARDEN_SERVICE`
WARDEN_PKG=/var/vcap/packages/warden/warden
-MONGO_SVC=$PWD/mongodb
+MONGO_SVC=$PWD/ng/mongodb
+rm -rf $MONGO_SVC/spec_reports
-#
-# HACK - Base expects to be able to write to /var/vcap/sys/run/LOCK
-#
-SCRATCHPAD=$MONGO_SVC/xxx_scratchpad
-rm -rf $SCRATCHPAD
-mkdir -p $SCRATCHPAD/log/warden
-mkdir -p $SCRATCHPAD/run/warden
+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 &quot;$SQLITE_REALPATH&quot; --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 \
+--bind_mounts[6].src_path &quot;$MONGODB_REALPATH&quot; --bind_mounts[6].dst_path &quot;$MONGODB_REALPATH&quot; --bind_mounts[6].mode RW \
+| cut -d &quot; &quot; -f 3`
TEST_RUNNER=`mktemp`
cat &lt;&lt;-EOT &gt; $TEST_RUNNER
@@ -93,44 +94,74 @@ export LIBRARY_PATH=$SQLITE_REALPATH/lib:$LIBRARY_PATH
export C_INCLUDE_PATH=$SQLITE_REALPATH/include:$C_INCLUDE_PATH
export CI_ENV=&apos;jenkins&apos;
-sudo mkdir -p /var/vcap/sys/log/warden
+# 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
-cd $WARDEN_PKG
-bundle config
-bundle --local install --deployment --without=devlopment test
+# prepare the log dir for warden and other dirs for mongodb
+mkdir -p /var/vcap/sys/log/warden
+mkdir -p /tmp/warden
+cp -a /var/vcap/data/warden/rootfs /tmp/warden
+ls /tmp/warden/rootfs/usr/share/mongodb/mongodb-1.8/mongorestore
-cd /tmp/mongo_source/mongodb
-mkdir -p /tmp/mongo_backup
-rm -rf .bundle
-rm -rf vendor/bundle
-sed -i -e &quot;s/mongodump_path: mongodump/mongodump_path: \/usr\/bin\/mongodump/g&quot; config/mongodb_backup.yml
-bundle config
-bundle install --path vendor/bundle
+# 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: 50.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[config/mongodb.yml] &gt;&gt; /var/vcap/sys/log/warden/warden.stdout.log 2&gt;&gt;/var/vcap/sys/log/warden/warden.stderr.log &amp;
+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
+which mongodump
+
cd /tmp/mongo_source/mongodb
-bundle exec nats-server --daemonize --pid /tmp/nats.pid
+mkdir -p /tmp/mongo_backup
+rm -rf .bundle
+rm -rf vendor/bundle
+bundle install --deployment
bundle exec rake spec:ci
EOT
-echo &quot;creating the warden container for unit-test&quot;
-HANDLE=`$WARDEN_REPL -e -c &quot;create bind_mount:$RUBY19_REALPATH,$RUBY19_REALPATH,ro bind_mount:$GIT_REALPATH,$GIT_REALPATH,ro bind_mount:$SQLITE_REALPATH,$SQLITE_REALPATH,ro bind_mount:$SCRATCHPAD,/var/vcap/sys/run,rw bind_mount:$MONGODB_REALPATH,$MONGODB_REALPATH,ro bind_mount:$VCAP_WARDEN_SERVICE,/var/vcap/packages/warden/warden,rw disk_size_mb:4096 &quot;`
-
echo &quot;enable vcap could execute sudo without password within warden&quot;
-sudo ls $WARDEN_PKG/root/linux/instances/$HANDLE/ssh/ssh_config
+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_PKG/root/linux/instances/$HANDLE/ssh/ssh_config root@container cat /etc/sudoers | grep &quot;$vcap_sudo_line&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_PKG/root/linux/instances/$HANDLE/ssh/ssh_config root@container chmod 740 /etc/sudoers
- sudo ssh -T -F $WARDEN_PKG/root/linux/instances/$HANDLE/ssh/ssh_config root@container &quot;echo \&quot;Defaults:vcap !requiretty\&quot; &gt;&gt; /etc/sudoers&quot;
- sudo ssh -T -F $WARDEN_PKG/root/linux/instances/$HANDLE/ssh/ssh_config root@container &quot;echo \&quot;$vcap_sudo_line\&quot; &gt;&gt; /etc/sudoers&quot;
- sudo ssh -T -F $WARDEN_PKG/root/linux/instances/$HANDLE/ssh/ssh_config root@container chmod 440 /etc/sudoers
+ 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
@@ -150,16 +181,16 @@ rm -f $TEST_RUNNER</command>
</builders>
<publishers>
<hudson.tasks.ArtifactArchiver>
- <artifacts>mongodb/spec_reports/**</artifacts>
+ <artifacts>ng/mongodb/spec_reports/**</artifacts>
<latestOnly>false</latestOnly>
</hudson.tasks.ArtifactArchiver>
<hudson.tasks.junit.JUnitResultArchiver>
- <testResults>mongodb/spec_reports/*.xml</testResults>
+ <testResults>ng/mongodb/spec_reports/*.xml</testResults>
<keepLongStdio>false</keepLongStdio>
<testDataPublishers/>
</hudson.tasks.junit.JUnitResultArchiver>
<hudson.plugins.rubyMetrics.rcov.RcovPublisher>
- <reportDir>mongodb/spec_coverage/rcov</reportDir>
+ <reportDir>ng/mongodb/spec_coverage/rcov</reportDir>
<targets>
<hudson.plugins.rubyMetrics.rcov.model.MetricTarget>
<metric>TOTAL_COVERAGE</metric>
@@ -177,4 +208,4 @@ rm -f $TEST_RUNNER</command>
</hudson.plugins.rubyMetrics.rcov.RcovPublisher>
</publishers>
<buildWrappers/>
-</project>
+</project>
Oops, something went wrong.

0 comments on commit a7ee865

Please sign in to comment.