Open fatmcgav opened 9 years ago
@fatmcgav Hi Gav, sorry been really busy, haven't had a chance to look into this properly yet.
BUUUUT I did find a good example on using Beaker with Travis encrypted values: http://www.camptocamp.com/de/actualite/puppet-acceptance-testing-travis-ci/
So I might be able to look into this soon-ish :dancer:
@petems No worries... I did make a start on this, but got distracted by other stuff...
Will see if I can dig my code out :)
Gav
I stumbled on this when looking for a way to inject environment vars into beaker instead of dropping a .fog file.
Any renewed interest in this module or as the last post is 11 months old, maybe one of you guys have found a better way?
I have some modules that aren't public, and we don't have a hosted travis.ci, which means I'm still looking into using ec2.
I can see loading env vars to take precedence of hostfile configs here:
https://github.com/petems/beaker-fog/blob/master/lib/beaker/hypervisor/fog.rb#L93
But there'd also need to be work on making this generic and not just for digital ocean (for my specific use case!).
Thoughts? Updates?
@brettswift Hi! I haven't used this in a while, my original intention was to make this as generic as possible, but I've got distracted. There's probably some fancy yaml/hash work that could be done to make this a lot more extendable. What provider arey ou interested in, is it ec2 specficially? I have an ec2 branch somewhere, I could push it up? :smile:
Sure. I'd love to see what you have on the ec2 branch.
Our company is starting to dabble in ec2, and that's the only cloud I have an account with at work.
I also did a double post this morning, one here: https://groups.google.com/forum/#!topic/puppet-beaker/o4IBzy7CdDk just for visibility in case others didn't know about this module. Beaker has been a "backburner" task for a long time, but I'm trying to get more momentum going now, and the capability this plugin will offer would help a lot!
w.r.t. plugins - it seems like they are just installed as gems. I can't seem to find any documentation on how to install / write / test plugins.. is there a place where these live?
@brettswift Do you have the ability to run docker in your current CI environment? Because the beaker docker stuff is super easy to setup and a lot faster (plus cheaper: no EC2 costs! :smile:)
Not currently, but I've heard the same from the camptocamp guys.
We're just getting access to build our own CI servers, so running docker in a teamcity build agent would be interesting.
It'd be a great opportunity to get some docker stuff going as well.
Happen to have a role/profile for a docker container to help get me going here? I've seen this: https://blog.travis-ci.com/2015-08-19-using-docker-on-travis-ci/ but docker locally would be a different setup.
Try the following:
git clone https://github.com/petems/petems-hyperic_agent
cd petems-hyperic_agent
bundle install
PUPPET_VERSION="3.8.4" BEAKER_set="centos-6-docker" bundle exec rake acceptance
If you're on Mac, you'll need to have the docker-toolbox installed and loaded in a terminal
Thanks. That worked, with a few things I had to learn my way through. Boot2docker has changed a lot in the last year and a bit since I looked at it last.
1) install the docker toolbox
default
that is ready to use, however I couldn't get it to work.
2) brew install boot2docker
3) boot2docker init
4) boot2docker up
5) then export the variables that it outputs to stdout: export DOCKER_CERT_PATH=/Users/bswift/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=1
export DOCKER_HOST=tcp://192.168.59.103:2376
then I ran:
PUPPET_VERSION="3.8.5" BEAKER_set="centos-6-docker" bundle exec rake acceptance
Note: the puppet version in your module has the puppet gem locked to 3.8.5 so I changed to that version.
That setup however seems to take a while.. I was able to spin up an ec2, run the simplest of puppet manifests (just configured a firewall port!) and shut it down. Took about 4min 30 sec.
I ran this one and it seems to be taking quite a bit longer than that.
However the capability and demonstration of this workflow is huge.
Thanks!
Are you running CoreOS or a CentOS image on your CI agents?
boot2docker is deprecated now (https://github.com/boot2docker/boot2docker-cli#deprecated).
You should use Docker Quickstart Terminal
or Kitematic, click the Docker CLI button, it autoloads a terminal with the right environment settings.
When you get the terminals setup, the docker tests should be pretty quick. Do you have a git repo of a module you can make public? I can do some PR's to get a basic boiler plate of the docker beaker stuff working?
a PR would be pretty awesome. Thanks!
I didn't see the deprecation - so thanks.
And I did the Quickstart CLI but when I exported the environment variable it still didn't seem to work. It didn't give me info on where the keys were etc.
https://github.com/brettswift/puppet-sensu_suite
That repo I was going to get going with EC2 as well, the one I have working on EC2 I can't make public though.
Ok, I'll see if I can get the beaker-docker working on that for you :+1:
This is what I saw when running the docker CLI:
And the initial error was:
cgml068918 福 ~/src/petems-hyperic_agent ➤ 7ed962a|master✓
10300 ± : PUPPET_VERSION="3.8.5" BEAKER_set="centos-6-docker" bundle exec rake acceptance ⏎ [6d4h25m]
/opt/rubies/2.0.0-p451/bin/ruby -I/Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/rspec-core-3.4.3/lib:/Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/rspec-support-3.4.1/lib /Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/rspec-core-3.4.3/exe/rspec spec/acceptance
/Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/beaker-rspec-5.3.0/lib/beaker-rspec/helpers/serverspec.rb:43: warning: already initialized constant Module::VALID_OPTIONS_KEYS
/Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/specinfra-2.52.0/lib/specinfra/configuration.rb:4: warning: previous definition of VALID_OPTIONS_KEYS was here
Hypervisor for centos-6-x64 is docker
Beaker::Hypervisor, found some docker boxes to create
/Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/beaker-2.35.0/lib/beaker/hypervisor/docker.rb:26:in `rescue in initialize': Docker instance not connectable. (RuntimeError)
Error was: Connection refused - connect(2) (Errno::ECONNREFUSED)
If you are on OSX, you might not have Boot2Docker setup correctly
Check your DOCKER_HOST variable has been set
from /Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/beaker-2.35.0/lib/beaker/hypervisor/docker.rb:23:in `initialize'
from /Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/beaker-2.35.0/lib/beaker/hypervisor.rb:74:in `new'
from /Users/bswift/src/petems-hyperic_agent/.bundle/ruby/2.0.0/gems/beaker-2.35.0/lib/beaker/hypervisor.rb:74:in `create'
~ ~ ~
Which is why I hunted down boot2docker. I exported the IP for the machine that was output above, but wasn't sure how much beaker takes care of - and if by "machine" it means "container" etc.
But yea, an example would be awesome.
Yeah, that's my bad, that error needs updating to remove the boot2docker reference! :-1: (See https://github.com/puppetlabs/beaker/pull/1075)
Just did a quick test on my private module and it was much simpler than the old vagrant way of running beaker. Especially the quick re-test.
Now I'm off to configure a build agent in our private cloud with docker.
Thanks for the help! I'll close this ticket up as it's already gone quite beyond the original ask :)
It would be cool if beaker-fog could be used with TravisCI. However in order to do that, need to have some way of "securing" the API and SSH keys used by Beaker.
One way to do this is to use TravisCI encryption, which then makes the decrypted values available as env variables.
Beaker-fog then needs to be updated to pull in the appropriate env variables, rather than use the nodeset config.
Options that should be considered: