Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add packer based docker builds #69

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mapuri
Copy link
Contributor

@mapuri mapuri commented Jun 2, 2016

Overview of changes:

  • packer/docker/centos: added packer build scripts to build centos based docker images
  • vendor in the updated ansible repo

Motivation:

  • we would like to sandbox our CI builds inside a container to secure our baremetal test environments from rogue PRs, without needing any special handling inside the projects.
  • a docker image provisioned using our ansible will ensure that we have all necessary tools to stage our CI environment in a container
  • this will also take us closer to trying parallel builds on same bare-metal host for better resource utilization. But this is not the primary goal atm.
  • @unclejack proved that this is doable with his simple experiments for the same!! It was easy to take it to next logical level.

What I have tested:

  • I was able to verify a local build and test of cluster manager using this container image, i.e.
#  docker run --name sysd --privileged -itd \
   -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
   -v /tmp/$(mktemp -d):/run \
   -v /home/ladmin/goroot/src/github.com/contiv/cluster:/go/src/github.com/contiv/cluster \
   -v /home/ladmin/.vagrant.d:/.vagrant.d \
   -e VAGRANT_HOME=/.vagrant.d \
   -e http_proxy=$http_proxy \
   -e https_proxy=$https_proxy \
   contiv/centos7:0.1 /usr/sbin/init

# docker exec -it sysd /bin/bash
[root@386b7c8ec8c0 /]# cd /go/src/github.com/contiv/cluster/management/src
[root@386b7c8ec8c0 /]# make build unit-test system-test
...
...

Notes / Observations:

  • docker image size is considerably huge. I measured it to be around 100G with docker 1.9 but it was reduced considerably to only around 10G with docker 1.11.
    • I think the new image size with docker 1.11 should not be a big concern as this image will only need occasional updates just like our vagrant boxes
  • the vbox version need to be same between the the test container and the host.
    • I think this should also not be an issue as we use the same ansible to configure our baremetal hosts using contiv/lab repo !
  • we need to mount the vagrant directory inside the test container to make the boxes available and save a lot of time not having to download these boxes inside the test container.
    • again this should not be an issue as I was able to see it work but I still need to try it out in CI environment.
  • user is root inside the test container.
    • I don't think it should be an issue as we are in a sandbox, but please let me know if I am missing something.
  • container needs to run as --privileged to be able to run docker, vbox etc in it
    • will this be a security issue??

Next steps :

  • Get a yay! or nay! to the approach from you folks
  • integrate this image with the docker plugin for jenkins (https://wiki.jenkins-ci.org/display/JENKINS/Docker+Plugin), especially :
    • need to figure out how to remove the need to mount the git workspace being tested inside the container and rather have it pulled.
    • need to study the configuration part of the docker plugin in more detail and map what I did in manual steps above to it. Otherwise we may need to write a simple bash wrapper for our use.
  • slowly transition all CI jobs to use docker plugin before we start getting more public contributions

/cc @erikh @unclejack @shaleman @jainvipin

mapuri added 2 commits June 2, 2016 09:23
4ada60b Merge pull request #214 from mapuri/misc
31cc9d8 install a few base packages - e2fsprogs that provides mkfs.ext4 needed by docker - openssh-server provides sshd needed when provisioning a container.   It is otherwise should already be installed.
e7d6fbe use 'become' in place of 'sudo'
f372501 use version variables for vbox, vagrant and packer
5691a77 Merge pull request #211 from mapuri/contivctl
522290b use recent contivctl released script
22b36af Merge pull request #210 from mapuri/ucp
ef419e6 cleanup volplugin socket file once the service stops
1d6c546 cleanup netplugin socket file once the service stops
0a6db33 etcd setup enhancements - remove Requires attribute from etcd unit   - this ensures that systemd tries to restart etcd     even when docker service is manually restarted. - set RestartSec for etcd service to prevent too fast restarts - exit early on service start if docker is not running - remove an un-needed exit from etcd stop script
81312f0 remove the fifo file as part of ucp service stop
ca0f1b6 Merge pull request #209 from mapuri/netctl
11530b2 temporarily use netctl for setting aci mode
429a6e5 Merge pull request #203 from mapuri/etcd
ea12c7f add make file targets for common testing tasks
3f626e8 run etcd inside a container
14f0f95 Merge pull request #202 from mapuri/ucp
172ffc2 use the id command to get ucp instance-id
f2c0f5c Merge pull request #200 from mapuri/ucarp
502f40e don't copy clusterm conf file if it exists
b9e9302 Merge pull request #197 from mapuri/docker
8ce63b8 bump up versions of contiv services
a4ce37f Add support for installing Docker CS engine
641fef9 Merge pull request #196 from vvb/ovs_fix
135dfdb using the latest openvswitch rpm as in openstak-kilo repo

git-subtree-dir: vendor/ansible
git-subtree-split: 4ada60bbbe4b0e765ce4c3cbcfd5e9bbe7ce5920
@erikh
Copy link
Contributor

erikh commented Jun 3, 2016

+1 for the idea. I'll review the code tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants