Skip to content

Commit

Permalink
Update platforms and add support for Amazon Linux 2
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoaleman committed Dec 6, 2018
1 parent d5a2c28 commit 883f3b7
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 49 deletions.
21 changes: 13 additions & 8 deletions .kitchen.dokken.yml
Expand Up @@ -14,6 +14,19 @@ verifier:
name: inspec

platforms:
# Amazon Linux 2 can't be fully tested yet on Test Kitchen because the inspec
# tests error out due to a bug in the current train 1.5.6 gem. The issue has
# been fixed in version 1.5.10, but that hasn't been released yet. Until then,
# we can converge the test and see that everything runs without errors.
# https://github.com/inspec/train/blob/v1.5.6/lib/train/platforms/detect/helpers/os_linux.rb#L13
#
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN /usr/bin/yum -y update

- name: centos-7
driver:
image: dokken/centos-7
Expand Down Expand Up @@ -49,14 +62,6 @@ platforms:
intermediate_instructions:
- RUN /usr/bin/yum -y update

- name: ubuntu-14.04
driver:
image: dokken/ubuntu-14.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get -y update
- RUN /usr/bin/apt-get install -y sudo

- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
Expand Down
17 changes: 14 additions & 3 deletions .kitchen.yml
Expand Up @@ -3,28 +3,39 @@ driver:
name: vagrant

provisioner:
name: chef_zero
product_name: chefdk

verifier:
name: inspec

platforms:
# Amazon Linux 2 can't be fully tested yet on Test Kitchen because the inspec
# tests error out due to a bug in the current train 1.5.6 gem. The issue has
# been fixed in version 1.5.10, but that hasn't been released yet. Until then,
# we can converge the test and see that everything runs without errors.
# https://github.com/inspec/train/blob/v1.5.6/lib/train/platforms/detect/helpers/os_linux.rb#L13
#
- name: amazonlinux-2
driver_config:
box: gbailey/amzn2
- name: centos-7
- name: debian-8
- name: debian-9
- name: fedora-27
- name: fedora-28
- name: ubuntu-14.04
- name: ubuntu-16.04
- name: ubuntu-18.04

suites:
- name: test
run_list:
- recipe[test::asdf_user_install]
- recipe[test::asdf_script]
- recipe[test::asdf_plugin]
- recipe[test::asdf_package]
verifier:
inspec_tests:
- test/smoke/default/asdf_test.rb

- name: user_install
run_list:
- recipe[test::user_install]
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -19,9 +19,10 @@ services: docker
env:
matrix:
- INSTANCE=test-centos-7
- INSTANCE=test-debian-8
- INSTANCE=test-debian-9
- INSTANCE=test-fedora-27
- INSTANCE=test-fedora-28
- INSTANCE=test-ubuntu-1404
- INSTANCE=test-ubuntu-1604
- INSTANCE=test-ubuntu-1804

Expand Down
13 changes: 5 additions & 8 deletions README.md
Expand Up @@ -12,14 +12,11 @@ Installs and configures [asdf](https://github.com/asdf-vm/asdf) extendable versi

The following platforms are supported and tested with Test Kitchen:

- CentOS 7
- Debian 8
- Debian 9
- Fedora 27
- Fedora 28
- Ubuntu 14.04
- Ubuntu 16.04
- Ubuntu 18.04
- Amazon Linux 2+
- CentOS 7+
- Debian 8+
- Fedora 27+
- Ubuntu 16.04+

Other Debian and RHEL family distributions are assumed to work.

Expand Down
36 changes: 13 additions & 23 deletions libraries/package_helpers.rb
Expand Up @@ -12,7 +12,7 @@ def install_asdf_deps
asdf_deps = %w(automake git grep libtool mlocate unzip)

case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
asdf_deps.concat %w(bzip2 libffi-devel libxslt-devel libyaml-devel readline-devel openssl-devel unixODBC-devel)
when 'debian'
asdf_deps.concat %w(libffi-dev libreadline-dev libssl-dev libxslt-dev libyaml-dev unixodbc-dev)
Expand Down Expand Up @@ -68,7 +68,7 @@ def install_post_package_deps

def r_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
%w(libcurl-devel libgfortran libXt-devel pcre2 pcre2-devel xz-devel)
when 'debian'
%w(gfortran libbz2-dev libcurl3-dev liblzma-dev libpcre3 libpcre3-dev libxt-dev)
Expand All @@ -77,7 +77,7 @@ def r_deps

def clojure_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
'java-1.8.0-openjdk'
when 'debian'
'default-jre'
Expand All @@ -86,27 +86,18 @@ def clojure_deps

def erlang_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
%w(gcc gcc-c++ glibc-devel java-1.8.0-openjdk-devel ncurses-devel openssl-devel wget wxBase.x86_64)
when 'debian'
deps = %w(libgl1-mesa-dev libglu1-mesa-dev libpng3 libssh-dev xsltproc fop libxml2-utils default-jdk)

if node['platform'] == 'ubuntu'
deps << case node['platform_version']
when '14.04'
'libwxgtk2.8-dev'
else
'libwxgtk3.0-dev'
end
end

deps << 'libwxgtk3.0-dev' if node['platform'] == 'ubuntu'
deps
end
end

def gradle_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
'java-1.8.0-openjdk'
when 'debian'
'default-jre'
Expand All @@ -115,7 +106,7 @@ def gradle_deps

def haskell_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
'gmp-devel'
when 'debian'
'libgmp-dev'
Expand Down Expand Up @@ -143,7 +134,7 @@ def ocaml_deps

def openresty_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
%w(openssl openssl-devel pcre2 pcre2-devel)
when 'debian'
%w(openssl libssl-dev libpcre3 libpcre3-dev)
Expand All @@ -152,7 +143,7 @@ def openresty_deps

def php_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
%w(libcurl libcurl-devel libcxx libcxx-devel libjpeg-turbo-devel libpng-devel openssl openssl-devel re2c readline-devel libedit-devel zlib-devel libicu-devel libxml2-devel postgresql-libs)
when 'debian'
# Fix for PHP bug
Expand All @@ -178,7 +169,6 @@ def php_deps
deps = %w(curl libjpeg-dev openssl libssl-dev libcurl4-openssl-dev pkg-config libreadline-dev libedit-dev zlib1g-dev libicu-dev libxml2-dev libmysqlclient-dev libpq-dev)

if node['platform'] == 'ubuntu'
deps << 'libpng12-dev' if node['platform_version'] == '14.04'
deps << 'libpng16-dev' if node['platform_version'] == '16.04'
deps.concat %w(libcurl4 libpng-dev re2c) if node['platform_version'] == '18.04'
end
Expand All @@ -189,7 +179,7 @@ def php_deps

def postgres_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
'readline-devel'
when 'debian'
'libreadline-dev'
Expand All @@ -198,7 +188,7 @@ def postgres_deps

def python_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
%w(openssl-dev zlib-devel readline-devel sqlite-devel wget curl llvm)
when 'debian'
%w(libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm xz-utils tk-dev)
Expand All @@ -218,7 +208,7 @@ def ruby_deps

def sbt_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
'java-1.8.0-openjdk'
when 'debian'
'default-jre'
Expand All @@ -227,7 +217,7 @@ def sbt_deps

def scala_deps
case node['platform_family']
when 'rhel', 'fedora'
when 'amazon', 'fedora', 'rhel'
'java-1.8.0-openjdk'
when 'debian'
'default-jre'
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Expand Up @@ -10,7 +10,7 @@
issues_url 'https://github.com/asdf-chef/asdf/issues'
source_url 'https://github.com/asdf-chef/asdf'

%w(centos debian fedora oracle redhat scientific ubuntu).each do |os|
%w(amazon centos debian fedora oracle redhat scientific ubuntu).each do |os|
supports os
end

Expand Down
2 changes: 1 addition & 1 deletion resources/user_install.rb
Expand Up @@ -100,7 +100,7 @@
link '/usr/bin/shasum' do
to '/usr/bin/sha1sum'
not_if 'test -L /usr/bin/shasum'
only_if { node['platform_family'] == 'rhel' }
only_if { %w(amazon fedora rhel).include?(node['platform_family']) }
end
end

Expand Down
10 changes: 6 additions & 4 deletions spec/spec_helper.rb
Expand Up @@ -2,11 +2,13 @@
require 'chefspec'
require 'chefspec/berkshelf'

# rubocop:disable Style/WordArray
SUPPORTED_PLATFORMS = {
'centos' => %w(7),
'debian' => %w(8 9),
'fedora' => %w(27 28),
'ubuntu' => %w(14.04 16.04 18.04),
'amazon' => ['2'],
'centos' => ['7'],
'debian' => ['8', '9'],
'fedora' => ['27', '28'],
'ubuntu' => ['16.04', '18.04'],
}.freeze

RSpec.configure do |config|
Expand Down

0 comments on commit 883f3b7

Please sign in to comment.