From 30726c378572f8aa2256875b1b39b94144acff80 Mon Sep 17 00:00:00 2001 From: Daniel Mizyrycki Date: Tue, 20 Aug 2013 12:18:29 -0700 Subject: [PATCH] Improve docker-ci deployment and tests --- testing/Vagrantfile | 27 +++++++++++++++++---------- testing/buildbot/master.cfg | 8 ++++---- testing/buildbot/requirements.txt | 1 + 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/testing/Vagrantfile b/testing/Vagrantfile index 033f14b3de..fd1c5916c8 100644 --- a/testing/Vagrantfile +++ b/testing/Vagrantfile @@ -2,11 +2,10 @@ # vi: set ft=ruby : BOX_NAME = "docker-ci" -BOX_URI = "http://files.vagrantup.com/precise64.box" -AWS_AMI = "ami-d0f89fb9" +BOX_URI = "http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box" +AWS_AMI = "ami-10314d79" DOCKER_PATH = "/data/docker" CFG_PATH = "#{DOCKER_PATH}/testing/buildbot" -BUILDBOT_IP = "192.168.33.41" on_vbox = File.file?("#{File.dirname(__FILE__)}/.vagrant/machines/default/virtualbox/id") | \ Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty? & \ (on_vbox=true; ARGV.each do |arg| on_vbox &&= !arg.downcase.start_with?("--provider") end; on_vbox) @@ -16,16 +15,22 @@ Vagrant::Config.run do |config| # Setup virtual machine box. This VM configuration code is always executed. config.vm.box = BOX_NAME config.vm.box_url = BOX_URI + config.vm.forward_port 8010, 8010 config.vm.share_folder "v-data", DOCKER_PATH, "#{File.dirname(__FILE__)}/.." - config.vm.network :hostonly, BUILDBOT_IP # Deploy buildbot and its dependencies if it was not done if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty? # Add memory limitation capabilities pkg_cmd = 'sed -Ei \'s/^(GRUB_CMDLINE_LINUX_DEFAULT)=.+/\\1="cgroup_enable=memory swapaccount=1 quiet"/\' /etc/default/grub; ' - # Install new kernel - pkg_cmd << "apt-get update -qq; apt-get install -q -y linux-image-generic-lts-raring; " + # Adjust kernel + pkg_cmd << "apt-get update -qq; " + if on_vbox + pkg_cmd << "apt-get install -q -y linux-image-extra-`uname -r`; " + else + pkg_cmd << "apt-get install -q -y linux-image-generic; " + end + # Deploy buildbot CI pkg_cmd << "apt-get install -q -y python-dev python-pip supervisor; " \ "pip install -r #{CFG_PATH}/requirements.txt; " \ @@ -36,10 +41,12 @@ Vagrant::Config.run do |config| "#{CFG_PATH}/setup_credentials.sh #{USER} " \ "#{ENV['REGISTRY_USER']} #{ENV['REGISTRY_PWD']}; " # Install docker dependencies - pkg_cmd << "apt-get install -q -y python-software-properties; " \ - "add-apt-repository -y ppa:dotcloud/docker-golang/ubuntu; apt-get update -qq; " \ - "DEBIAN_FRONTEND=noninteractive apt-get install -q -y lxc git mercurial golang-stable aufs-tools make; " - # Activate new kernel + pkg_cmd << "curl -s https://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz | " \ + "tar -v -C /usr/local -xz; ln -s /usr/local/go/bin/go /usr/bin/go; " \ + "DEBIAN_FRONTEND=noninteractive apt-get install -q -y lxc git mercurial aufs-tools make; " \ + "export GOPATH=/data/docker-dependencies; go get -d github.com/dotcloud/docker; " \ + "rm -rf ${GOPATH}/src/github.com/dotcloud/docker; " + # Activate new kernel options pkg_cmd << "shutdown -r +1; " config.vm.provision :shell, :inline => pkg_cmd end diff --git a/testing/buildbot/master.cfg b/testing/buildbot/master.cfg index 05dcacbf58..6714f2fa8a 100644 --- a/testing/buildbot/master.cfg +++ b/testing/buildbot/master.cfg @@ -22,7 +22,6 @@ GITHUB_DOCKER = 'github.com/dotcloud/docker' BUILDBOT_PATH = '/data/buildbot' DOCKER_PATH = '/data/docker' BUILDER_PATH = '/data/buildbot/slave/{0}/build'.format(BUILDER_NAME) -DOCKER_BUILD_PATH = BUILDER_PATH + '/src/github.com/dotcloud/docker' # Credentials set by setup.sh and Vagrantfile BUILDBOT_PWD = '' @@ -57,9 +56,10 @@ c['schedulers'] += [Nightly(name='daily', branch=None, builderNames=['coverage', # Docker commit test factory = BuildFactory() factory.addStep(ShellCommand(description='Docker',logEnviron=False,usePTY=True, - command=["sh", "-c", Interpolate("cd ..; rm -rf build; export GOPATH={0}; " - "go get -d {1}; cd {2}; git reset --hard %(src::revision:-unknown)s; " - "go test -v".format(BUILDER_PATH,GITHUB_DOCKER,DOCKER_BUILD_PATH))])) + command=["sh", "-c", Interpolate("cd ..; rm -rf build; mkdir build; " + "cp -r {2}-dependencies/src {0}; export GOPATH={0}; go get {3}; cd {1}; " + "git reset --hard %(src::revision)s; go test -v".format( + BUILDER_PATH, BUILDER_PATH+'/src/'+GITHUB_DOCKER, DOCKER_PATH, GITHUB_DOCKER))])) c['builders'] = [BuilderConfig(name=BUILDER_NAME,slavenames=['buildworker'], factory=factory)] diff --git a/testing/buildbot/requirements.txt b/testing/buildbot/requirements.txt index 4e183ba062..c5d7dd0191 100644 --- a/testing/buildbot/requirements.txt +++ b/testing/buildbot/requirements.txt @@ -5,3 +5,4 @@ buildbot_slave==0.8.7p1 nose==1.2.1 requests==1.1.0 flask==0.10.1 +simplejson==2.3.2