diff options
author | Salim Alam <salam@chef.io> | 2016-02-05 12:50:33 -0800 |
---|---|---|
committer | Salim Alam <salam@chef.io> | 2016-02-05 13:20:57 -0800 |
commit | 757f38cf5a004dbd3f97c8eff30761744b4051cd (patch) | |
tree | fbfa3fbf62837d0f7aedf5f7e32c46c6e699cbc7 /acceptance/.shared | |
parent | aa2d22fc80e67f607f8cd7feb7cc02bb09b9a377 (diff) | |
download | chef-757f38cf5a004dbd3f97c8eff30761744b4051cd.tar.gz |
Update to use .shared cookbooksalam/unique-gems
Diffstat (limited to 'acceptance/.shared')
5 files changed, 397 insertions, 0 deletions
diff --git a/acceptance/.shared/kitchen_acceptance/.kitchen.digitalocean.yml b/acceptance/.shared/kitchen_acceptance/.kitchen.digitalocean.yml new file mode 100644 index 0000000000..50558c3d39 --- /dev/null +++ b/acceptance/.shared/kitchen_acceptance/.kitchen.digitalocean.yml @@ -0,0 +1,27 @@ +# Not quite ready yet + +driver: + name: digitalocean + digitalocean_access_token: <%= ENV['DIGITALOCEAN_API_TOKEN'] %> + region: <%= ENV['DIGITALOCEAN_REGION'] %> + size: 2gb + ssh_key_ids: <%= ENV['DIGITALOCEAN_SSH_KEYS'] %> + transport: + ssh_key: <%= ENV['DIGITALOCEAN_SSH_KEY_PATH'] %> + +provisioner: + name: chef_zero + product_name: chef + product_version: latest + channel: current + +platforms: +<% %w(centos-6.5 centos-7.0 + fedora-21 + debian-8.1 + ubuntu-12.04 ubuntu-14.04 ubuntu-15.10 +).each do |platform| %> + - name: #{platform} + driver_config: + image: <%= "#{platform.gsub('.', '-')}-x64" %> +<% end %> diff --git a/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml b/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml new file mode 100644 index 0000000000..fc82c907e6 --- /dev/null +++ b/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml @@ -0,0 +1,279 @@ +# Not quite ready yet + +<% +def file_if_exists(path) + path = File.expand_path(path) + File.exist?(path) ? path : nil +end +%> + +driver: + name: ec2 + tags: + X-Project: Kitchen Tests + aws_ssh_key_id: <%= ENV['AWS_SSH_KEY_ID'] || ENV['USER'] || ENV['USERNAME'] %> + # test-specific stuff + region: us-west-2 + availability_zone: a + subnet_id: subnet-19ac017c + security_group_ids: ["sg-e401eb83", "sg-96274af3"] + instance_type: m3.large +# associate_public_ip: true # Don't enable public IP, as subnet specified is behind VPN + +transport: + ssh_key: <%= file_if_exists("~/.ssh/#{ENV['AWS_SSH_KEY_ID'] || ENV['USER'] || ENV['USERNAME']}.pem") || + file_if_exists("~/.ssh/#{ENV['AWS_SSH_KEY_ID'] || ENV['USER'] || ENV['USERNAME']}") || + file_if_exists("~/.ssh/id_rsa") %> + +provisioner: + name: chef_zero + product_name: <%= ENV["KITCHEN_CHEF_PRODUCT"] %> + product_version: <%= ENV["KITCHEN_CHEF_VERSION"] %> + channel: <%= ENV["KITCHEN_CHEF_CHANNEL"] %> + +platforms: + # + # AIX + # + # - name: aix-6.1 + # - name: aix-7.1 + # + # Debian + # + - name: debian-8 + driver: + image_search: + name: debian-jessie-* + owner-id: 379101102735 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: admin + - name: debian-7 + driver: + image_search: + name: debian-wheezy-* + owner-id: 379101102735 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: standard + image-type: machine + transport: + username: admin + # + # Ubuntu + # + - name: ubuntu-15.10 + driver: + image_search: + name: ubuntu/images/*/ubuntu-*-15.10-amd64-server-* + owner-id: 099720109477 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ubuntu + - name: ubuntu-14.04 + driver: + image_search: + name: ubuntu/images/*/ubuntu-*-14.04-*-server-* + owner-id: 099720109477 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ubuntu + # - name: ubuntu-12.04 + # driver: + # image_search: + # name: ubuntu/images/*/ubuntu-*-12.04-*-server-* + # owner-id: 099720109477 + # architecture: x86_64 + # virtualization-type: hvm + # block-device-mapping.volume-type: gp2 + # image-type: machine + # transport: + # username: ubuntu + # + # Red Hat Enterprise Linux + # + - name: el-7 + driver: + image_search: + name: RHEL-7.* + owner-id: 309956199498 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ec2-user + - name: el-6 + driver: + image_search: + name: RHEL-6.* + owner-id: 309956199498 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ec2-user + - name: el-5 + driver: + image_search: + name: RHEL-5.* + owner-id: 309956199498 + architecture: x86_64 + virtualization-type: paravirtual + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ec2-user + # + # FreeBSD + # + - name: freebsd-10 + driver: + image_search: + name: FreeBSD/EC2 10.*-RELEASE* + owner-id: 118940168514 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ec2-user + - name: freebsd-9 + driver: + image_search: + name: FreeBSD/EC2 9.*-RELEASE* + owner-id: 118940168514 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ec2-user + # - name: freebsd-8 + # driver: + # image_search: + # name: FreeBSD/EC2 8.*-RELEASE* + # owner-id: 118940168514 + # architecture: x86_64 + # virtualization-type: hvm + # block-device-mapping.volume-type: standard + # image-type: machine + # transport: + # username: ec2-user + # + # OS/X + # + # - name: mac_os_x-10.11 + # - name: mac_os_x-10.10 + # - name: mac_os_x-10.9 + # - name: mac_os_x-10.8 + # + # Nexus??? + # + # - name: nexus-7 + # + # Solaris + # + # - name: solaris-11 + # - name: solaris-10 + # + # Windows + # + - name: windows-2012r2 + driver: + image_search: + name: Windows_Server-2012-R2*-English-*-Base-* + owner-alias: amazon + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + user_data: | + <powershell> + $logfile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Logs\\kitchen-ec2.log" + #PS Remoting and & winrm.cmd basic config + Enable-PSRemoting -Force -SkipNetworkProfileCheck + & winrm.cmd set winrm/config '@{MaxTimeoutms="1800000"}' >> $logfile + & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile + & winrm.cmd set winrm/config/winrs '@{MaxShellsPerUser="50"}' >> $logfile + #Server settings - support username/password login + & winrm.cmd set winrm/config/service/auth '@{Basic="true"}' >> $logfile + & winrm.cmd set winrm/config/service '@{AllowUnencrypted="true"}' >> $logfile + & winrm.cmd set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' >> $logfile + #Firewall Config + & netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any >> $logfile + #Set script execution to unrestricted + & Set-ExecutionPolicy Unrestricted -Force + </powershell> + transport: + username: administrator + + - name: windows-2012 + driver: + image_search: + name: Windows_Server-2012-RTM*-English-*-Base-* + owner-alias: amazon + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: administrator + - name: windows-2008r2 + driver: + image_search: + name: Windows_Server-2008-R2*-English-*-Base-* + owner-alias: amazon + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: administrator + # + # Centos + # + # - name: centos-7 + # driver: + # image_search: + # name: CentOS Linux 7 * + # owner-alias: aws-marketplace + # architecture: x86_64 + # virtualization-type: hvm + # block-device-mapping.volume-type: standard + # image-type: machine + # transport: + # username: root + # - name: centos-6 + # driver: + # image_search: + # name: CentOS-6.5-GA-* + # owner-alias: aws-marketplace + # architecture: x86_64 + # virtualization-type: paravirtual + # block-device-mapping.volume-type: standard + # image-type: machine + # transport: + # username: root + # + # Fedora + # + - name: fedora-21 + driver: + image_search: + name: Fedora-Cloud-Base-21-* + owner-id: 125523088429 + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine diff --git a/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml b/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml new file mode 100644 index 0000000000..f978658477 --- /dev/null +++ b/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml @@ -0,0 +1,47 @@ +driver: + name: vagrant + forward_agent: yes + customize: + cpus: 2 + memory: 1024 + +provisioner: + name: chef_zero + product_name: <%= ENV["KITCHEN_CHEF_PRODUCT"] %> + product_version: <%= ENV["KITCHEN_CHEF_VERSION"] %> + channel: <%= ENV["KITCHEN_CHEF_CHANNEL"] %> + +platforms: +<% %w( +debian-8 +debian-7 +debian-6 +ubuntu-15.10 +ubuntu-14.04 +el-7 +el-6 +el-5 +freebsd-10 +freebsd-9 +fedora-21 +).each do |platform| %> + - name: <%= platform %> + driver: + box: opscode-<%= platform %> + box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_<%= platform %>_chef-provisionerless.box +<% end %> +# freebsd-8 +# ubuntu-12.04 +# centos-7 +# centos-6 + +<% %w( +2012r2 +2012 +2008r2 +).each do |version| %> + - name: windows-<%= version %> + driver: + box: chef/windows-server-<%= version %>-standard +# URL is atlas +<% end %> diff --git a/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb new file mode 100644 index 0000000000..5380b7002c --- /dev/null +++ b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb @@ -0,0 +1,43 @@ +class Kitchen < Chef::Resource + resource_name :kitchen + + property :command, String, name_property: true + property :driver, %w(ec2 vagrant), coerce: proc { |v| v.to_s }, default: lazy { ENV["KITCHEN_DRIVER"] || :ec2 } + property :instances, String, default: lazy { ENV["KITCHEN_INSTANCES"] } + property :kitchen_dir, String, default: Chef.node['chef-acceptance']['suite-dir'] + property :chef_product, String, default: lazy { + ENV["KITCHEN_CHEF_PRODUCT"] || + # If we're running the chef or chefdk projects in jenkins, pick up the project name. + (%w(chef chefdk).include?(ENV["PROJECT_NAME"]) ? ENV["PROJECT_NAME"] : "chef") + } + property :chef_channel, String, default: lazy { + ENV["KITCHEN_CHEF_CHANNEL"] || + # Pick up current if we can't connect to artifactory + (ENV["ARTIFACTORY_USERNAME"] ? "unstable" : "current") + } + property :chef_version, String, default: lazy { + ENV["KITCHEN_CHEF_VERSION"] || + # If we're running the chef or chefdk projects in jenkins, pick up the project name. + (ENV["PROJECT_NAME"] == chef_product ? ENV["OMNIBUS_BUILD_VERSION"] : nil) || + "latest" + } + property :artifactory_username, String, default: lazy { ENV["ARTIFACTORY_USERNAME"] } + property :artifactory_password, String, default: lazy { ENV["ARTIFACTORY_PASSWORD"] } + property :env, Hash, default: {} + + action :run do + execute "bundle exec kitchen #{command}#{instances ? " #{instances}" : ""}" do + cwd kitchen_dir + env({ + "KITCHEN_DRIVER" => driver, + "KITCHEN_INSTANCES" => instances, + "KITCHEN_LOCAL_YAML" => ::File.expand_path("../../.kitchen.#{driver}.yml", __FILE__), + "KITCHEN_CHEF_PRODUCT" => chef_product, + "KITCHEN_CHEF_CHANNEL" => chef_channel, + "KITCHEN_CHEF_VERSION" => chef_version, + "ARTIFACTORY_USERNAME" => artifactory_username, + "ARTIFACTORY_PASSWORD" => artifactory_password + }.merge(new_resource.env)) + end + end +end diff --git a/acceptance/.shared/kitchen_acceptance/metadata.rb b/acceptance/.shared/kitchen_acceptance/metadata.rb new file mode 100644 index 0000000000..70dc342d09 --- /dev/null +++ b/acceptance/.shared/kitchen_acceptance/metadata.rb @@ -0,0 +1 @@ +name "kitchen_acceptance" |