forked from cerc-io/plugeth
first version of automatic testrunner deployment. Uses ansible, vagrant
and virtualbox
This commit is contained in:
parent
762a93fec8
commit
74faa30af6
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
venv/
|
||||
*~
|
||||
*.swp
|
||||
.vagrant/
|
5
ansible/README.md
Normal file
5
ansible/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Automatic deployment of the random test generator
|
||||
|
||||
Testing is done in a Vagrant virtual machine
|
||||
|
||||
install vagrant, virtualbox, ansible, then do `vagrant up`. It should provison a basic machine. `vagrant ssh` to verify the machine is working as expected.
|
75
ansible/Vagrantfile
vendored
Normal file
75
ansible/Vagrantfile
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
||||
VAGRANTFILE_API_VERSION ||= "2"
|
||||
|
||||
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
# All Vagrant configuration is done here. The most common configuration
|
||||
# options are documented and commented below. For a complete reference,
|
||||
# please see the online documentation at vagrantup.com.
|
||||
|
||||
# Every Vagrant virtual environment requires a box to build off of.
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.define "random-test"
|
||||
|
||||
# Disable automatic box update checking. If you disable this, then
|
||||
# boxes will only be checked for updates when the user runs
|
||||
# `vagrant box outdated`. This is not recommended.
|
||||
# config.vm.box_check_update = false
|
||||
|
||||
# Create a forwarded port mapping which allows access to a specific port
|
||||
# within the machine from a port on the host machine. In the example below,
|
||||
# accessing "localhost:8080" will access port 80 on the guest machine.
|
||||
# config.vm.network "forwarded_port", guest: 80, host: 8080
|
||||
|
||||
# Create a private network, which allows host-only access to the machine
|
||||
# using a specific IP.
|
||||
# config.vm.network "private_network", ip: "192.168.33.10"
|
||||
|
||||
# Create a public network, which generally matched to bridged network.
|
||||
# Bridged networks make the machine appear as another physical device on
|
||||
# your network.
|
||||
# config.vm.network "public_network"
|
||||
|
||||
# If true, then any SSH connections made will enable agent forwarding.
|
||||
# Default value: false
|
||||
# config.ssh.forward_agent = true
|
||||
|
||||
# Share an additional folder to the guest VM. The first argument is
|
||||
# the path on the host to the actual folder. The second argument is
|
||||
# the path on the guest to mount the folder. And the optional third
|
||||
# argument is a set of non-required options.
|
||||
# config.vm.synced_folder "../data", "/vagrant_data"
|
||||
|
||||
# Provider-specific configuration so you can fine-tune various
|
||||
# backing providers for Vagrant. These expose provider-specific options.
|
||||
# Example for VirtualBox:
|
||||
#
|
||||
# config.vm.provider "virtualbox" do |vb|
|
||||
# # Don't boot with headless mode
|
||||
# vb.gui = true
|
||||
#
|
||||
# # Use VBoxManage to customize the VM. For example to change memory:
|
||||
# vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
# end
|
||||
|
||||
|
||||
# Ubuntu / Virtualbox workaround.
|
||||
# see http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
|
||||
end
|
||||
|
||||
#
|
||||
# View the documentation for the provider you're using for more
|
||||
# information on available options.
|
||||
|
||||
|
||||
# Ansible
|
||||
config.vm.provision "ansible" do |ansible|
|
||||
ansible.playbook = "host-config.yml"
|
||||
end
|
||||
|
||||
end
|
||||
|
8
ansible/host-config.yml
Normal file
8
ansible/host-config.yml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
- name: Provision the operation system for buildslave
|
||||
# testing
|
||||
hosts: all
|
||||
# live
|
||||
# hosts: poc-8.ethdev.com
|
||||
roles:
|
||||
- common
|
27
ansible/roles/common/tasks/main.yml
Normal file
27
ansible/roles/common/tasks/main.yml
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: install docker
|
||||
sudo: true
|
||||
# install script from https://docs.docker.com/installation/ubuntulinux/
|
||||
shell: curl -sSL https://get.docker.com/ubuntu/ | sudo sh
|
||||
|
||||
- name: install package dependencies
|
||||
sudo: true
|
||||
apt: name={{ item }}
|
||||
with_items:
|
||||
- python-pip
|
||||
|
||||
- name: install python dependencies
|
||||
sudo: true
|
||||
pip: name=docker-py
|
||||
|
||||
|
||||
- name: enable docker for standard user
|
||||
sudo: true
|
||||
# todo: how to logout after this command, otherwise won't be effective in this play
|
||||
user: name=vagrant groups=docker append=yes
|
||||
|
||||
- name: checkout test repo
|
||||
git:
|
||||
repo: https://github.com/sveneh/tests.git
|
||||
version: develop
|
||||
dest: git
|
6
ansible/roles/testrunner/tasks/main.yml
Normal file
6
ansible/roles/testrunner/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: update Go client
|
||||
docker_image:
|
||||
path: git/ansible/test-files/docker-go
|
||||
name: go
|
||||
state: build
|
3
ansible/site.yml
Normal file
3
ansible/site.yml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
- include: host-config.yml
|
||||
- include: testrunner-config.yml
|
46
ansible/test-files/docker-go/Dockerfile
Normal file
46
ansible/test-files/docker-go/Dockerfile
Normal file
@ -0,0 +1,46 @@
|
||||
# Adjusted from https://github.com/ethereum/go-ethereum/blob/develop/Dockerfile
|
||||
FROM ubuntu:14.04
|
||||
|
||||
## Environment setup
|
||||
ENV HOME /root
|
||||
ENV GOPATH /root/go
|
||||
ENV PATH /go/bin:/root/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
|
||||
|
||||
RUN mkdir -p /root/go
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
## Install base dependencies
|
||||
RUN apt-get update && apt-get upgrade -y
|
||||
RUN apt-get install -y git mercurial build-essential software-properties-common pkg-config libgmp3-dev libreadline6-dev libpcre3-dev libpcre++-dev
|
||||
|
||||
## Build and install Go
|
||||
RUN hg clone -u release https://code.google.com/p/go
|
||||
RUN cd go && hg update go1.4
|
||||
RUN cd go/src && ./all.bash && go version
|
||||
|
||||
## Install GUI dependencies
|
||||
RUN add-apt-repository ppa:ubuntu-sdk-team/ppa -y
|
||||
RUN apt-get update -y
|
||||
RUN apt-get install -y qtbase5-private-dev qtdeclarative5-private-dev libqt5opengl5-dev
|
||||
|
||||
## Fetch and install serpent-go
|
||||
RUN go get -v -d github.com/ethereum/serpent-go
|
||||
WORKDIR $GOPATH/src/github.com/ethereum/serpent-go
|
||||
# RUN git checkout master
|
||||
RUN git submodule update --init
|
||||
RUN go install -v
|
||||
|
||||
# Fetch and install go-ethereum
|
||||
RUN go get -v -d github.com/ethereum/go-ethereum/...
|
||||
WORKDIR $GOPATH/src/github.com/ethereum/go-ethereum
|
||||
|
||||
RUN git checkout develop
|
||||
|
||||
RUN git pull
|
||||
RUN ETH_DEPS=$(go list -f '{{.Imports}} {{.TestImports}} {{.XTestImports}}' github.com/ethereum/go-ethereum/... | sed -e 's/\[//g' | sed -e 's/\]//g' | sed -e 's/C //g'); if [ "$ETH_DEPS" ]; then go get $ETH_DEPS; fi
|
||||
RUN go install -v ./cmd/ethtest
|
||||
|
||||
# Run JSON RPC
|
||||
ENTRYPOINT ["ethtest"]
|
||||
EXPOSE 8080
|
||||
|
12
ansible/testrunner-config.yml
Normal file
12
ansible/testrunner-config.yml
Normal file
@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: setting up buildslave configuration
|
||||
# testing
|
||||
hosts: all
|
||||
# live
|
||||
# hosts: poc-8.ethdev.com
|
||||
|
||||
# TODO use the right user for configuring, until credentials set, stay with default vagrant user
|
||||
# remote_user: buildsalve
|
||||
|
||||
roles:
|
||||
- buildslave
|
Loading…
Reference in New Issue
Block a user