Skip to content

Commit

Permalink
Issue projectatomic#195 Adding travis support
Browse files Browse the repository at this point in the history
  • Loading branch information
hferentschik committed Apr 25, 2016
1 parent 4021187 commit 75de634
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.ruby-version
.ruby-gemset
pkg
tmp
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
language: ruby

before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq bsdtar libvirt-dev libvirt-bin qemu-kvm qemu

rvm:
- 2.0

env:
global:
- VAGRANT_SPEC_BOX="file://$TRAVIS_BUILD_DIR/tmp/cdk.box"
- secure: "XO8175zGTqCfKfofkQhn2RonCdBOkoPic0TophmUmhNW2UKmdodo+JyX4pgC+sIT+X4BM37OPQz3mNNi+94h4l14KcU5VaNk2dkpxM25eQE7i0Znwff9fhFI74QAMfywTEwsLU+Fn1JfzqTrfvspSSKfGkkF+qVGeOjoIZ3VgEo0GOkYQpX8CaL/IXC2+h4cdEPlF3fTAZShA9UODsmplJ2q7lwFbpqDxVq2m3IkAGmGdC0+6+LN4uUUfnipiBgDCHGUpBWAVheKaZd9iL7J5SzzYd/PAsmC+OwCyrArmN3nu1RIUSrzCjLEkcGE3aCOCXbX9V60o4NnhwQbh7WuOMcgM8iMx1rAumlHI7BEaZDz8b+irkDgi4YAMxG6JwfRSkxZ/XvNXFgDXAXPl4RFfux4jhiHQAy0WPjyBanY+h33go6t60AKmLmILo6OtAU+yuWhiavpuiNeheXBuJ3ZWvyeVD+JKXEQ741DwHjYTDiKVXvlk+F/+iTX2v9ndxOrn+jgcYyNnTXadjRS78YYKkz2bu39MNtlJNWIzWQawjBer7zZkh4kHICA+DyDrWO13eHFwoLEH+bRcVHMNdu58Hkpdrk0MDfk8kCOI1/L5r81t3YA/U/H/3iGuTfmGnSWKX0E6G8PwMORReU3W0qHdu+RXxAMxGxtb3xqivrrv+E="
- secure: "fbUYIxRO3PIderFD/VigPtF7DgckHlNFMZnAsP3v7rLGLlG9ljy0LKmvF16uW9xTAsRF2sgSNFItzXraZnFOKoRtZQ7j4rA7dBmJQzVMWZ5t6fxZC9OZAgM/9yj6GtU7PpshDJjCa7uErTpe4KaMe80lNIawH8bwnWltEyaBoV/fqGMrDeWaXPGrA+d79w6nEprBSBjrosX6xts0zfEJRqiD1jcQ5lIp9OWo8Tv034EG0YKxKW6t+caRtXNK3Zv5g9KQ13O3xYn8zKg86HuBdi0394D4RHWRHF3IjFu7Wto6ZwbqZpX5L+zbI30x1IZYueCA2WT9rAc+rz9d2V5eJF/b7YULNPJYkDoxGPIEWfWMjfZC+saD3aJS2L1CMPRaF0CiS6dMd98nfd2I6xVUZR1Xl2+KhHU8Q6a84ry714eAp/xKXlidyEUpUTIooCkjryJ6HoU5d7zAOHgpDuHfaOZaGYIeUsX+NCAd8O0UG0UzpU4DA4M+ymx1fEvKPRhfUAE1AiK29+TxXvNBh3dMEnzaWn7caf/fLug9JTTtCrc3GoeM9umRyaQH6GK/lZ+qarPWc9bh1hFnhyQZfc40hSmGdVkGBfAU2HgaIg6pIo0VJ8k5oNa1I7nOmLKhc/UEtGbpX5rZgABOPQrYqCctkvMZnxOhY8YA/SskVKibI30="

cache:
directories:
- $TRAVIS_BUILD_DIR/tmp

# uncomment this line if your project needs to run something other than `rake`:
script:
- export rvmsudo_secure_path=1
- rvmsudo ruby --version
- rvmsudo gem --version
- rvmsudo bundle --version
- rvmsudo bundle exec rake getbox acceptance['libvirt']
- grep '0 failures' spec.log
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ group :development do
gem 'rake'
gem 'vagrant-vbguest'
gem 'vagrant-libvirt'
gem 'mechanize'
gem 'fog-libvirt', '0.0.3' # https://github.com/pradels/vagrant-libvirt/issues/568

# added as the vagrant component wouldn't build without it
Expand Down
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,21 @@ GEM
logging (2.0.0)
little-plugger (~> 1.1)
multi_json (~> 1.10)
mechanize (2.7.4)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0)
mime-types (>= 1.17.2, < 3)
net-http-digest_auth (~> 1.1, >= 1.1.1)
net-http-persistent (~> 2.5, >= 2.5.2)
nokogiri (~> 1.6)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (>= 0.0.9, < 0.2)
micromachine (1.1.0)
mime-types (2.99.1)
mini_portile2 (2.0.0)
multi_json (1.11.2)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
Expand All @@ -104,6 +115,7 @@ GEM
nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2)
nori (2.6.0)
ntlm-http (0.1.1)
rainbow (2.1.0)
rake (11.1.0)
rb-fsevent (0.9.7)
Expand Down Expand Up @@ -139,6 +151,7 @@ GEM
log4r
micromachine (~> 1.1.0)
wdm (0.1.1)
webrobots (0.1.2)
winrm (1.7.2)
builder (>= 2.1.2)
gssapi (~> 1.2)
Expand All @@ -160,6 +173,7 @@ DEPENDENCIES
fog-libvirt (= 0.0.3)
gem-compare
json
mechanize
rake
vagrant!
vagrant-libvirt
Expand Down
46 changes: 40 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
require "bundler/gem_tasks"
require 'bundler/gem_tasks'
require 'rake/clean'
require 'mechanize'
require 'fileutils'

CLOBBER.include('pkg/*')

desc 'Download Vagrant box'
task :getbox do
puts "Downloading box for #{ENV['REDHAT_USER']}"
agent = Mechanize.new
agent.follow_meta_refresh = true
agent.get('https://access.redhat.com/downloads/content/293/ver=2/rhel---7/2.0.0/x86_64/product-software') do |page|

# Submit first form which is the redirect to login page form
login_page = page.forms.first.submit

# Submit the login form
after_login = login_page.form_with(:name => 'login_form') do |f|
username_field = f.field_with(:id => 'username')
username_field.value = ENV['REDHAT_USER']
password_field = f.field_with(:id => 'password')
password_field.value = ENV['REDHAT_PASSWORD']
end.click_button

# There is one more redirect afte successful login
download_page = after_login.forms.first.submit

download_page.links.each do |link|
if link.href =~ /rhel-cdk-kubernetes-7.2-23.x86_64.vagrant-libvirt.box/
download_dir = File.join(File.dirname(__FILE__), 'tmp')
unless File.directory?(download_dir)
FileUtils.mkdir_p(download_dir)
end
agent.pluggable_parser.default = Mechanize::Download
agent.get(link.href).save(File.join(download_dir, 'cdk.box'))
end
end
end
end

desc 'Run acceptance specs using vagrant-spec'
task :acceptance, [:provider] do |t, args|
if args[:provider].nil?
provider='virtualbox'
provider='virtualbox'
else
provider=args[:provider]
provider=args[:provider]
end
components = %w(
cdk
).map{|s| "provider/#{provider}/#{s}" }
sh "export VAGRANT_SPEC_PROVIDER=#{provider} && bundle exec vagrant-spec test --components=#{components.join(' ')}"
sh "export VAGRANT_SPEC_PROVIDER=#{provider} && bundle exec vagrant-spec test --components=#{components.join(' ')} | tee spec.log"
end


8 changes: 1 addition & 7 deletions vagrant-spec/skeleton/cdk/Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
require 'vagrant-service-manager'
require 'vagrant-registration'
require 'vagrant-libvirt'

Vagrant.configure(2) do |config|
config.vm.box = 'box'

# config.vm.provider 'virtualbox' do |v, override|
# v.memory = 1024
# v.cpus = 2
# v.customize ['modifyvm', :id, '--ioapic', 'on']
# v.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
# end

config.registration.skip = true
config.vm.network 'private_network', ip: '10.10.2.2'

Expand Down

0 comments on commit 75de634

Please sign in to comment.