Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Run test-kitchen suites in cloud hosting via Travis #108

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

Conversation

patcon
Copy link
Collaborator

@patcon patcon commented Jul 9, 2015

https://github.com/mission-impossible-android/chef-cm-update-server/blob/master/.travis.yml

I would basically set it up like I've done here, and then we could get tests running on master all the time for all platforms, and not worry about ever running locally just to know if things broke

And my client, @mrjcleaver of Blended Perspectives, has agreed to sponsor the AWS time (within reason) that we'll need to keep this going. Woo! Thanks @mrjcleaver!

@patcon
Copy link
Collaborator Author

patcon commented Jul 7, 2015

Hm. Maybe kitchen-digitalocean would be better. From our end, seems cheaper, and then we don't need to manage 2 AWS accounts in order to keep things clean and separate from our other running instances...
https://www.digitalocean.com/pricing/

Thoughts @mrjcleaver?

@mrjcleaver
Copy link

How much would the code need to change to use kitchen-digitalocean instead of aws (is it just 1 line in a config file?) Digital Ocean does charge to keep a switched-off image, can you confirm we'd be destroying?

@patcon
Copy link
Collaborator Author

patcon commented Jul 7, 2015

This seems to indicate positively on the hourly billing:
https://www.digitalocean.com/help/pricing-and-billing/

And this is all the AWS-specific stuff needed: https://github.com/mission-impossible-android/chef-cm-update-server/blob/master/.kitchen.travis.yml

Would be less for DigitalOcean, as there's no complexity in availability zones or ami ids

@patcon patcon changed the title Run test-kitchen suites on AWS via Travis Run test-kitchen suites in cloud hosting via Travis Jul 7, 2015
patcon added 3 commits July 9, 2015 17:36
When an attr is nil, it doesn't have this method and fails. This no
longer detects empty strings, but that's probably not something to rely
on anyhow.
@@ -3,10 +3,10 @@
# Local modifications will be overwritten by Chef.
#
<VirtualHost *:<%= node['stash']['apache2']['port'] %>>
<% unless node['stash']['apache2']['virtual_host_name'].empty? -%>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, DigitalOcean images don't have an FQDN (from which this is set in attributes), so it's nil and there's not #empty?. Realized we probably shouldn't be using this method anyhow, so swapped it out.

If we really want something robust (I'm not sure it's an edgecase worth pandering to) then we could perhaps use #blank? from chef-sugar cookbook:
https://github.com/sethvargo/chef-sugar#core-extensions

I don't think that's worth it though -- a blank string shouldn't be set for any of these anyhow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Seems we are using blank strings for some of this stuff in attributes/default.rb... what are your thoughts here @linc01n? Using nil for unset things seems more sensible to me. Or we could mix-and-match approaches in this template, and just assume nil is the blank value for the virtual_host_* attrs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And just confirmed that chef-sugar would resolve this. That cookbook is pretty established and has lots of other things that wemight benefit from using, so perhaps we could add it?

https://github.com/sethvargo/chef-sugar/blob/bd65556f7c101d9fa8cd68d6a7ded2a1daf6525b/lib/chef/sugar/core_extensions/object.rb#L21

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding chef-sugar is ok i think.

@patcon
Copy link
Collaborator Author

patcon commented Jul 9, 2015

Anyhow, added chef-sugar. Lemme know if that's not OK :)

@patcon
Copy link
Collaborator Author

patcon commented Jul 9, 2015

Hm. I'll still test on my repo, but we'll probbaly want to add convert the travis scripts into files in test/support so that we can wrap everything in checks for $TRAVIS_SECURE_ENV_VARS, since lots of stuff shouldn't run if those aren't available (ie. on pull requests from forks -- they can still run on pull requests in the main repo, which is another reason it would be helpful to get push access, as then I could create my PR's from the main repo and have them tested fully)

@patcon patcon force-pushed the feature/108-test-kitchen-cloud branch from a75b699 to 279c221 Compare July 9, 2015 22:42
patcon added 7 commits July 14, 2015 02:19
Long logs (4MB+) make Travis thing that it's in a loop, and it will
cancel the build job. We seem to hit this with the verbosity of chef 12.
Travis CI will cancel jobs when the logs get over 4MB, so this helps
avoid that.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants