10000 Expand testing, support Suse, Fix amazon, Update package versions (#164) · sous-chefs/nodejs@9ca9eed · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
Expand testing, support Suse, Fix amazon, Update package versions (#164)
Browse files Browse the repository at this point in the history
* Convert to Chef 12.1+ cookbook

Signed-off-by: Tim Smith <tsmith@chef.io>

* Expand kitchen testing

Signed-off-by: Tim Smith <tsmith@chef.io>

* Add suse support and Remove source testing on Ubuntu 12.04

Signed-off-by: Tim Smith <tsmith@chef.io>

* Require Ark 2.0.2 for suse

Prior versions are not compatible with suse

Signed-off-by: Tim Smith <tsmith@chef.io>

* Update travis / dokken config

Signed-off-by: Tim Smith <tsmith@chef.io>

* Fix the naming of leap in the travis config

Signed-off-by: Tim Smith <tsmith@chef.io>

* Fix suse package names for leap

13.X is EOL so it doesn't matter anymore.

Signed-off-by: Tim Smith <tsmith@chef.io>

* Add specs to ensure package installs and remove source in travis

Lets start with just package installs for now. Source installs are
harder in docker images

Signed-off-by: Tim Smith <tsmith@chef.io>

* Require a more recent compat_resource and fix license string

Signed-off-by: Tim Smith <tsmith@chef.io>

* Fix debian kitchen runs

Signed-off-by: Tim Smith <tsmith@chef.io>

* Make sure Amazon Linux works on Chef 13

Signed-off-by: Tim Smith <tsmith@chef.io>

* Make sure we have https support in apt

Fixes failures on Debian

Signed-off-by: Tim Smith <tsmith@chef.io>

* Set the default repos to Node 6 and iojs 3

The repo URLs

Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 authored Apr 28, 2017
1 parent a01cb0f commit 9ca9eed
Show file tree
Hide file tree
Showing 18 changed files with 306 additions and 65 deletions.
126 changes: 126 additions & 0 deletions .kitchen.dokken.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
chef_version: current

transport:
name: dokken

provisioner:
name: dokken

verifier:
name: inspec

platforms:
- name: debian-7
driver:
image: debian:7
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: debian-8
driver:
image: debian:8
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: centos-6
driver:
image: centos:6
platform: rhel
pid_one_command: /sbin/init
intermediate_instructions:
- RUN yum -y install lsof which initscripts net-tools wget net-tools

- name: centos-7
driver:
image: centos:7
platform: rhel
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN yum -y install lsof which systemd-sysv initscripts wget net-tools

- name: fedora-latest
driver:
image: fedora:latest
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN dnf -y install which systemd-sysv initscripts wget net-tools

- name: ubuntu-14.04
driver:
image: ubuntu-upstart:14.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: ubuntu-16.04
driver:
image: ubuntu:16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: opensuse-leap
driver:
image: opensuse:leap
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which net-tools

suites:
- name: default
run_list:
- recipe[nodejs]
- name: package
run_list:
- recipe[test::package]
- name: binary
run_list:
- recipe[test::binary]
- name: source
run_list:
- recipe[test::source]
excludes:
- centos-6
- name: source-iojs
run_list:
- recipe[source_iojs]
excludes:
- centos-6
- name: npm
run_list:
- recipe[test::npm]
- name: npm_embedded
run_list:
- recipe[test::npm]
attributes:
nodejs:
npm:
install_method: embedded
- name: npm_source
run_list:
- recipe[test::npm]
attributes:
nodejs:
npm:
install_method: source
excludes:
- centos-6
- name: npm_packages
run_list: recipe[nodejs]
attributes:
nodejs:
npm_packages:
- name: express
- name: socket.io
version: 1.0.4
- name: express
action: uninstall
43 changes: 7 additions & 36 deletions .kitchen.yml
10000
Original file line number Diff line number Diff line change
Expand Up @@ -11,79 +11,50 @@ platforms:
- name: centos-6.8
- name: centos-7.3
- name: debian-7.11
run_list: apt::default
- name: debian-8.7
run_list: apt::default
- name: fedora-25
- name: opensuse-leap-42.2
- name: ubuntu-14.04
run_list: apt::default
- name: ubuntu-16.04
run_list: apt::default

suites:
- name: default
run_list:
- recipe[nodejs]
- name: package
run_list:
- recipe[nodejs]
attributes:
nodejs:
install_method: package
- recipe[test::package]
- name: binary
run_list:
- recipe[nodejs]
attributes:
nodejs:
install_method: binary
- recipe[test::binary]
- name: source
run_list:
- recipe[nodejs]
attributes:
nodejs:
install_method: source
- recipe[test::source]
excludes:
- ubuntu-12.04
- centos-5.11
- centos-6.8
- name: source-iojs
run_list:
- recipe[nodejs]
attributes:
nodejs:
engine: iojs
install_method: source
source:
checksum: 55e79cc4f4cde41f03c1e204d2af5ee4b6e4edcf14defc82e518436e939195fa
version: 2.2.1
- recipe[source_iojs]
excludes:
- ubuntu-12.04
- centos-5.11
- centos-6.8
- name: npm
run_list:
- recipe[nodejs::npm]
- recipe[nodejs_test::npm]
- recipe[test::npm]
- name: npm_embedded
run_list:
- recipe[nodejs::npm]
- recipe[nodejs_test::npm]
- recipe[test::npm]
attributes:
nodejs:
npm:
install_method: embedded
- name: npm_source
run_list:
- recipe[nodejs::npm]
- recipe[nodejs_test::npm]
- recipe[test::npm]
attributes:
nodejs:
npm:
install_method: source
excludes:
- ubuntu-12.04
- centos-5.11
- centos-6.8
- name: npm_packages
run_list: recipe[nodejs]
Expand Down
33 changes: 25 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
# Use Travis's cointainer based infrastructure
sudo: false
sudo: required
dist: trusty

addons:
apt:
sources:
- chef-current-precise
- chef-current-trusty
packages:
- chefdk

# Don't `bundle install`
# Don't `bundle install` which takes about 1.5 mins
install: echo "skip bundle install"

branches:
only:
- master

# Ensure we make ChefDK's Ruby the default
services: docker

env:
matrix:
- INSTANCE=package-centos-6
- INSTANCE=package-centos-7
- INSTANCE=package-debian-7
- INSTANCE=package-debian-8
- INSTANCE=package-opensuse-leap
- INSTANCE=package-ubuntu-1404
- INSTANCE=package-ubuntu-1604

before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- eval "$(/opt/chefdk/bin/chef shell-init bash)"

script:
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/cookstyle --version
- /opt/chefdk/embedded/bin/foodcritic --version
- /opt/chefdk/bin/chef exec delivery local all

script: KITCHEN_LOCAL_YAML=.kitchen.dokken.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}

matrix:
include:
- script:
- /opt/chefdk/bin/chef exec delivery local all
env: UNIT_AND_LINT=1
4 changes: 1 addition & 3 deletions Berksfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ source 'https://supermarket.chef.io'
metadata

group :integration do
cookbook 'yum'
cookbook 'apt'
cookbook 'nodejs_test', path: './test/cookbooks/nodejs_test'
cookbook 'test', path: './test/cookbooks/test'
end
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ Installs node.js/io.js and manages npm

- Debian/Ubuntu
- RHEL/CentOS/Scientific/Amazon/Oracle
- openSUSE

Note: Source installs require GCC 4.8+, which is not included on older distro releases

### Chef

- Chef 11+
- Chef 12.1+

### Cookbooks

- yum-epel
- build-essential
- ark
- apt
- homebrew
- compat_resource

## Usage

Expand Down
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#

case node['platform_family']
when 'smartos', 'rhel', 'debian', 'fedora', 'mac_os_x'
when 'smartos', 'rhel', 'debian', 'fedora', 'mac_os_x', 'suse', 'amazon'
default['nodejs']['install_method'] = 'package'
else
default['nodejs']['install_method'] = 'source'
Expand Down
3 changes: 2 additions & 1 deletion attributes/packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
when 'node'
default['nodejs']['packages'] = value_for_platform_family(
'debian' => node['nodejs']['install_repo'] ? ['nodejs'] : ['nodejs', 'npm', 'nodejs-dev'],
%w(rhel fedora) => ['nodejs', 'nodejs-devel', 'npm'],
%w(rhel fedora amazon) => ['nodejs', 'nodejs-devel', 'npm'],
'suse' => node['platform_version'].to_i < 42 ? ['nodejs', 'nodejs-devel'] : ['nodejs4', 'npm4', 'nodejs4-devel'],
'mac_os_x' => ['node'],
'freebsd' => %w(node npm),
'default' => ['nodejs']
Expand Down
6 changes: 3 additions & 3 deletions attributes/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
when 'debian'
default['nodejs']['install_repo'] = true

default['nodejs']['repo'] = 'https://deb.nodesource.com/node'
default['nodejs']['repo'] = 'https://deb.nodesource.com/node_6.x'
default['nodejs']['keyserver'] = 'keyserver.ubuntu.com'
default['nodejs']['key'] = '1655a0ab68576280'
when 'rhel'
when 'rhel', 'amazon'
default['nodejs']['install_repo'] = true
end
when 'iojs'
case node['platform_family']
when 'debian'
default['nodejs']['install_repo'] = true

default['nodejs']['repo'] = 'https://deb.nodesource.com/iojs_2.x'
default['nodejs']['repo'] = 'https://deb.nodesource.com/iojs_3.x'
default['nodejs']['keyserver'] = 'keyserver.ubuntu.com'
default['nodejs']['key'] = '1655a0ab68576280'
end
Expand Down
15 changes: 7 additions & 8 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name 'nodejs'
maintainer 'redguide'
maintainer_email 'guilhem@lettron.fr'
license 'Apache 2.0'
license 'Apache-2.0'
description 'Installs/Configures node.js & io.js'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
source_url 'https://github.com/redguide/nodejs' if respond_to?(:source_url)
issues_url 'https://github.com/redguide/nodejs/issues' if respond_to?(:issues_url)
chef_version '>= 11.0' if respond_to?(:chef_version)
source_url 'https://github.com/redguide/nodejs'
issues_url 'https://github.com/redguide/nodejs/issues'
chef_version '>= 12.1' if respond_to?(:chef_version)
version '3.0.1'

depends 'yum-epel'
depends 'build-essential'
depends 'ark'
depends 'apt', '>= 2.9.1'
depends 'homebrew'
depends 'ark', '>= 2.0.2'
depends 'compat_resource', '>= 12.16'

%w(debian ubuntu centos redhat scientific oracle amazon smartos mac_os_x).each do |os|
%w(debian ubuntu centos redhat scientific oracle amazon smartos mac_os_x opensuse opensuseleap suse).each do |os|
supports os
end
2 changes: 1 addition & 1 deletion recipes/repo.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
case node['platform_family']
when 'debian'
include_recipe 'apt'
package 'apt-transport-https'

apt_repository 'node.js' do
uri node['nodejs']['repo']
Expand Down
Loading

0 comments on commit 9ca9eed

Please sign in to comment.
0