Merge pull request #1010 from dotcloud/1009-testing-hack

Testing|hack, issue #1009: Update make hack environment
This commit is contained in:
Guillaume J. Charmes 2013-06-25 17:07:18 -07:00
Родитель 862e223cec cc63c1b584
Коммит b44e2e71aa
3 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -2,6 +2,8 @@ DOCKER_PACKAGE := github.com/dotcloud/docker
RELEASE_VERSION := $(shell git tag | grep -E "v[0-9\.]+$$" | sort -nr | head -n 1) RELEASE_VERSION := $(shell git tag | grep -E "v[0-9\.]+$$" | sort -nr | head -n 1)
SRCRELEASE := docker-$(RELEASE_VERSION) SRCRELEASE := docker-$(RELEASE_VERSION)
BINRELEASE := docker-$(RELEASE_VERSION).tgz BINRELEASE := docker-$(RELEASE_VERSION).tgz
BUILD_SRC := build_src
BUILD_PATH := ${BUILD_SRC}/src/${DOCKER_PACKAGE}
GIT_ROOT := $(shell git rev-parse --show-toplevel) GIT_ROOT := $(shell git rev-parse --show-toplevel)
BUILD_DIR := $(CURDIR)/.gopath BUILD_DIR := $(CURDIR)/.gopath
@ -71,8 +73,13 @@ else ifneq ($(DOCKER_DIR), $(realpath $(DOCKER_DIR)))
@rm -f $(DOCKER_DIR) @rm -f $(DOCKER_DIR)
endif endif
test: all test:
@(cd $(DOCKER_DIR); sudo -E go test $(GO_OPTIONS)) # Copy docker source and dependencies for testing
rm -rf ${BUILD_SRC}; mkdir -p ${BUILD_PATH}
tar --exclude=${BUILD_SRC} -cz . | tar -xz -C ${BUILD_PATH}
GOPATH=${CURDIR}/${BUILD_SRC} go get -d
# Do the test
sudo -E GOPATH=${CURDIR}/${BUILD_SRC} go test ${GO_OPTIONS}
testall: all testall: all
@(cd $(DOCKER_DIR); sudo -E go test ./... $(GO_OPTIONS)) @(cd $(DOCKER_DIR); sudo -E go test ./... $(GO_OPTIONS))

Просмотреть файл

@ -3,8 +3,8 @@ This directory contains material helpful for hacking on docker.
make hack make hack
========= =========
Set up an Ubuntu 13.04 virtual machine for developers including kernel 3.8 Set up an Ubuntu 12.04 virtual machine for developers including kernel 3.8
and buildbot. The environment is setup in a way that can be used through go1.1 and buildbot. The environment is setup in a way that can be used through
the usual go workflow and/or the root Makefile. You can either edit on the usual go workflow and/or the root Makefile. You can either edit on
your host, or inside the VM (using make ssh-dev) and run and test docker your host, or inside the VM (using make ssh-dev) and run and test docker
inside the VM. inside the VM.
@ -22,6 +22,7 @@ developers are inconvenienced by the failure.
When running 'make hack' at the docker root directory, it spawns a virtual When running 'make hack' at the docker root directory, it spawns a virtual
machine in the background running a buildbot instance and adds a git machine in the background running a buildbot instance and adds a git
post-commit hook that automatically run docker tests for you. post-commit hook that automatically run docker tests for you each time you
commit in your local docker repository.
You can check your buildbot instance at http://192.168.33.21:8010/waterfall You can check your buildbot instance at http://192.168.33.21:8010/waterfall

9
hack/Vagrantfile поставляемый
Просмотреть файл

@ -2,7 +2,7 @@
# vi: set ft=ruby : # vi: set ft=ruby :
BOX_NAME = "ubuntu-dev" BOX_NAME = "ubuntu-dev"
BOX_URI = "http://cloud-images.ubuntu.com/raring/current/raring-server-cloudimg-vagrant-amd64-disk1.box" BOX_URI = "http://files.vagrantup.com/precise64.box"
VM_IP = "192.168.33.21" VM_IP = "192.168.33.21"
USER = "vagrant" USER = "vagrant"
GOPATH = "/data/docker" GOPATH = "/data/docker"
@ -21,14 +21,15 @@ Vagrant::Config.run do |config|
# Touch for makefile # Touch for makefile
pkg_cmd = "touch #{DOCKER_PATH}; " pkg_cmd = "touch #{DOCKER_PATH}; "
# Install docker dependencies # Install docker dependencies
pkg_cmd << "export DEBIAN_FRONTEND=noninteractive; apt-get -qq update; " \ pkg_cmd << "apt-get update -qq; apt-get install -y python-software-properties; " \
"apt-get install -q -y lxc git aufs-tools golang make linux-image-extra-`uname -r`; " \ "add-apt-repository -y ppa:dotcloud/docker-golang/ubuntu; apt-get update -qq; " \
"apt-get install -y linux-image-generic-lts-raring lxc git aufs-tools golang-stable make; " \
"chown -R #{USER}.#{USER} #{GOPATH}; " \ "chown -R #{USER}.#{USER} #{GOPATH}; " \
"install -m 0664 #{CFG_PATH}/bash_profile /home/#{USER}/.bash_profile" "install -m 0664 #{CFG_PATH}/bash_profile /home/#{USER}/.bash_profile"
config.vm.provision :shell, :inline => pkg_cmd config.vm.provision :shell, :inline => pkg_cmd
# Deploy buildbot CI # Deploy buildbot CI
pkg_cmd = "apt-get install -q -y python-dev python-pip supervisor; " \ pkg_cmd = "apt-get install -q -y python-dev python-pip supervisor; " \
"pip install -r #{CFG_PATH}/requirements.txt; " \ "pip install -q -r #{CFG_PATH}/requirements.txt; " \
"chown #{USER}.#{USER} /data; cd /data; " \ "chown #{USER}.#{USER} /data; cd /data; " \
"#{CFG_PATH}/setup.sh #{USER} #{GOPATH} #{DOCKER_PATH} #{CFG_PATH} #{BUILDBOT_PATH}" "#{CFG_PATH}/setup.sh #{USER} #{GOPATH} #{DOCKER_PATH} #{CFG_PATH} #{BUILDBOT_PATH}"
config.vm.provision :shell, :inline => pkg_cmd config.vm.provision :shell, :inline => pkg_cmd