Skip to content

Commit

Permalink
Merge pull request apache#370 from theopenlab/docker-machine-refactor
Browse files Browse the repository at this point in the history
Do refactor for docker-machine jobs
  • Loading branch information
liusheng authored Nov 28, 2018
2 parents fdc3950 + c076e78 commit 64c68af
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 51 deletions.
45 changes: 20 additions & 25 deletions playbooks/docker-machine-functional-devstack/run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,16 @@
- clone-devstack-gate-to-workspace
- create-devstack-local-conf
- install-devstack
- config-golang
- config-docker-machine
tasks:
- name: Run Integration tests of Docker machine against devstack
shell:
cmd: |
set -ex
git clone https://github.com/sstephenson/bats.git
pushd bats
./install.sh /usr/local
popd
apt-get update
apt-get install apt-transport-https ca-certificates
wget -qO- https://get.docker.com/ | sh
curl -O http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
openstack image create --file xenial-server-cloudimg-amd64-disk1.img --min-disk 1 --container-format bare \
--disk-format qcow2 "Ubuntu 16.04 Server 64bit"
mkdir -p $GOPATH/src/github.com/docker/machine
cp -r '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}' $GOPATH/src/github.com/docker
pushd $GOPATH/src/github.com/docker/machine
# NOTE: backport fix of PR 4543 and PR 4545
git config --global user.email '[email protected]'
git config --global user.name 'openlab'
git cherry-pick 9ec6729
git cherry-pick 7909ee3
make build
cp ./bin/docker-machine /usr/local/bin/
docker-machine version
export OS_FLAVOR_ID=11
export OS_IMAGE_NAME="Ubuntu 16.04 Server 64bit"
export OS_SSH_USER=ubuntu
export OS_NETWORK_NAME=private
export OS_FLOATINGIP_POOL=public
export OS_DOMAIN_ID=default
project_id=$(openstack token issue -f value -c project_id)
sg_id=$(openstack security group list | grep default | grep $project_id | head -n 1 | awk '{print $2}')
Expand All @@ -54,6 +30,18 @@
$sg_cmd_prefix icmp $sg_id
neutron subnet-update --dns-nameserver 8.8.8.8 private-subnet
openstack flavor create --vcpus 1 --ram 1024 --disk 10 --id 11 docker-machine-test
pushd '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}'
export OS_FLAVOR_ID=11
export OS_IMAGE_NAME="Ubuntu 16.04 Server 64bit"
export OS_SSH_USER=ubuntu
export OS_TENANT_ID=$(openstack token issue -f value -c project_id)
export OS_NETWORK_NAME=private
export OS_FLOATINGIP_POOL=public
export OS_SECURITY_GROUPS=default
export OS_DOMAIN_ID=default
export DRIVER=openstack
export DEBUG=true
export VERBOSE=true
Expand All @@ -65,6 +53,13 @@
export B2D_LOCATION=~/.docker/machine/cache/boot2docker.iso
export SHARED_NAME="bats-$DRIVER-test-shared-$(date +%s)"
export MACHINE_BUGSNAG_API_TOKEN=no-report
# Install bats
git clone https://github.com/sstephenson/bats.git '{{ ansible_user_dir }}/bats'
pushd '{{ ansible_user_dir }}/bats'
./install.sh /usr/local
popd
function machine() {
"$MACHINE_ROOT"/bin/"$MACHINE_BIN_NAME" "$@"
}
Expand Down
38 changes: 12 additions & 26 deletions playbooks/docker-machine-functional-public-clouds/run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,30 @@
become: yes
roles:
- export-cloud-openrc
- config-golang
- config-docker-machine
tasks:
- name: Run integration tests of docker machine aganist {{ cloud_name }}
block:
- name: Run docker machine intetration tests
shell:
cmd: |
set -ex
unset OS_DOMAIN_ID
pip install python-openstackclient
git clone https://github.com/sstephenson/bats.git
pushd bats
./install.sh /usr/local
popd
apt-get update
apt-get install apt-transport-https ca-certificates
wget -qO- https://get.docker.com/ | sh
mkdir -p $GOPATH/src/github.com/docker/machine
cp -r '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}' $GOPATH/src/github.com/docker/
pushd $GOPATH/src/github.com/docker/machine
# NOTE: backport fix of PR 4543 and PR 4545
git config --global user.email '[email protected]'
git config --global user.name 'openlab'
git cherry-pick 9ec6729
git cherry-pick 7909ee3
make build
cp ./bin/docker-machine /usr/local/bin/
docker-machine version
popd
pip install python-openstackclient
pushd '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}'
# Select a flavor have 2048M memory and 2 vCPU at least
export OS_FLAVOR_ID=$(openstack flavor list -f value -c ID -c RAM -c VCPUs --sort-column RAM --sort-column \
VCPUs | awk '{if($2>=2048 && $3>=2){print $1}}' | head -n 1)
export OS_IMAGE_NAME="Ubuntu 16.04 Server 64bit"
export OS_SSH_USER="{{ ssh_user | default('ubuntu') }}"
export OS_TENANT_ID=$(openstack token issue -f value -c project_id)
export OS_NETWORK_NAME=openlab-jobs-net
export OS_FLOATINGIP_POOL="admin_external_net"
export OS_SECURITY_GROUPS="openlab-jobs-sg"
export OS_SSH_USER="{{ ssh_user | default('ubuntu') }}"
unset OS_AVAILABILITY_ZONE
pushd $GOPATH/src/github.com/docker/machine
unset OS_AVAILABILITY_ZONE
unset OS_DOMAIN_ID
export DRIVER=openstack
export DEBUG=true
Expand All @@ -59,6 +39,12 @@
export SHARED_NAME="bats-$DRIVER-test-shared-$(date +%s)"
export MACHINE_BUGSNAG_API_TOKEN=no-report
# Install bats
git clone https://github.com/sstephenson/bats.git '{{ ansible_user_dir }}/bats'
pushd '{{ ansible_user_dir }}/bats'
./install.sh /usr/local
popd
function machine() {
"$MACHINE_ROOT"/bin/"$MACHINE_BIN_NAME" "$@"
}
Expand Down
28 changes: 28 additions & 0 deletions roles/config-docker-machine/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
- name: Install and config golang
include_role:
name: config-golang

- name: Compiled and install docker-machine from source
shell:
cmd: |
set -ex
# Install docker
apt-get update
apt-get install apt-transport-https ca-certificates
wget -qO- https://get.docker.com/ | sh
# NOTE: backport fix of PR 4543 and PR 4545
git config --global user.email '[email protected]'
git config --global user.name 'openlab'
git cherry-pick 9ec6729
git cherry-pick 7909ee3
# Build docker-machine
make build
cp ./bin/docker-machine /usr/local/bin/
docker-machine version
executable: /bin/bash
chdir: '{{ zuul.project.src_dir }}'
environment: '{{ global_env }}'

0 comments on commit 64c68af

Please sign in to comment.