Skip to content

Commit

Permalink
Merge pull request #1 from afaundez/node-build-dependencies
Browse files Browse the repository at this point in the history
Node build dependencies
  • Loading branch information
afaundez authored Apr 1, 2020
2 parents 02db1aa + 400a254 commit b801584
Show file tree
Hide file tree
Showing 17 changed files with 292 additions and 159 deletions.
68 changes: 0 additions & 68 deletions .kitchen.dokken.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .kitchen.yml

This file was deleted.

53 changes: 30 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
sudo: required
dist: trusty
os: linux
dist: bionic
language: ruby
services: docker

addons:
apt:
sources:
- chef-current-trusty
- sourceline: 'deb https://packages.chef.io/repos/apt/stable bionic main'
key_url: 'https://packages.chef.io/chef.asc'
packages:
- chefdk
- chef-workstation

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

branches:
only:
- master

services: docker

env:
global:
- KITCHEN_YAML=.kitchen.yml
- KITCHEN_LOCAL_YAML=.kitchen.dokken.yml
matrix:
- INSTANCE=default-amazonlinux
- INSTANCE=default-centos-6
- INSTANCE=default-centos-7
- INSTANCE=default-debian-8
- INSTANCE=default-debian-9
- INSTANCE=default-fedora-26
- INSTANCE=default-ubuntu-1404
- INSTANCE=default-ubuntu-1604
allowed_failures:
- KITCHEN_LOCAL_YAML=kitchen.dokken.yml
- CHEF_LICENSE=accept
jobs:
- INSTANCE=default-amazonlinux-1
- INSTANCE=default-amazonlinux-2
- INSTANCE=default-centos-6
- INSTANCE=default-centos-7
- INSTANCE=default-centos-8
- INSTANCE=default-debian-8
- INSTANCE=default-debian-9
- INSTANCE=default-debian-10
- INSTANCE=default-fedora-30
- INSTANCE=default-fedora-31
- INSTANCE=default-fedora-latest
# - INSTANCE=default-opensuse-leap-15
- INSTANCE=default-oraclelinux-6
- INSTANCE=default-oraclelinux-7
- INSTANCE=default-oraclelinux-8
- INSTANCE=default-ubuntu-1604
- INSTANCE=default-ubuntu-1804
- INSTANCE=default-ubuntu-1910
- INSTANCE=default-ubuntu-2004

before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
Expand All @@ -41,7 +48,7 @@ before_script:

script: kitchen verify ${INSTANCE}

matrix:
jobs:
include:
- script:
- chef exec delivery local all
Expand Down
1 change: 0 additions & 1 deletion Berksfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ source 'https://supermarket.chef.io'
metadata

group :integration do
cookbook 'apt'
cookbook 'test', path: 'test/fixtures/cookbooks/test'
end
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ node_build_plugin_install '/path/to/install/node-build'
| git_revision | String | master | You can choose a branch, tag, or commit to be synchronized with git |

`node_build_root` is the name property.

## Testing

Check [Test Kitchen](https://kitchen.ci/docs/getting-started/running-test).

- dokken: `KITCHEN_LOCAL_YAML=kitchen.dokken.yml kitchen test`
- vagrant/virtualbox: `kitchen test`
4 changes: 0 additions & 4 deletions TESTING.md

This file was deleted.

109 changes: 109 additions & 0 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
driver:
name: dokken
privileged: true

transport:
name: dokken

provisioner:
name: dokken
deprecations_as_errors: true
chef_license: accept-no-persist

verifier:
name: inspec
chef_license: accept-no-persist

platforms:
- name: amazonlinux-1
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: centos-6
driver:
image: dokken/centos-6
pid_one_command: /sbin/init
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
- name: debian-8
driver:
image: dokken/debian-8
pid_one_command: /bin/systemd
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
- name: fedora-30
driver:
image: dokken/fedora-30
pid_one_command: /usr/lib/systemd/systemd
- name: fedora-31
driver:
image: dokken/fedora-31
pid_one_command: /usr/lib/systemd/systemd
- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
# - name: freebsd-11
# - name: freebsd-12
# - name: opensuse-leap-15
# driver:
# image: dokken/opensuse-leap-15
# pid_one_command: /bin/systemd
- name: oraclelinux-6
driver:
image: dokken/oraclelinux-6
pid_one_command: /sbin/init
- name: oraclelinux-7
driver:
image: dokken/oraclelinux-7
pid_one_command: /usr/lib/systemd/systemd
- name: oraclelinux-8
driver:
image: dokken/oraclelinux-8
- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install sudo -y
- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install sudo -y
- name: ubuntu-19.10
driver:
image: dokken/ubuntu-19.10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install sudo -y
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install sudo -y

suites:
- name: default
run_list:
- recipe[test::default]
49 changes: 49 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
driver:
name: vagrant

provisioner:
name: chef_zero
always_update_cookbooks: true
chef_license: accept-no-persist

verifier:
name: inspec

platforms:
- name: amazonlinux-1
driver_config:
box: mvbcoding/awslinux
- name: amazonlinux-2
- name: centos-6
- name: centos-7
- name: centos-8
- name: debian-8
- name: debian-9
- name: debian-10
- name: fedora-30
- name: fedora-31
- name: fedora-latest
# - name: freebsd-11
# - name: freebsd-12
# - name: opensuse-leap-15
- name: oraclelinux-6
driver_config:
box: bento/oracle-6
- name: oraclelinux-7
driver_config:
box: bento/oracle-7
- name: oraclelinux-8
driver_config:
box: bento/oracle-8
- name: ubuntu-16.04
- name: ubuntu-18.04
- name: ubuntu-19.10
- name: ubuntu-20.04
driver_config:
box: ubuntu/xenial64

suites:
- name: default
run_list:
- recipe[test::default]
31 changes: 31 additions & 0 deletions libraries/chef/node_build.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
class Chef
module NodeBuild
def node_build_dependencies
[python, gcc, make].compact
end

def python
version = node['platform_version'].to_i
if platform?('centos') && version >= 8 then 'python3'
elsif platform?('oracle') && version >= 8 then 'python36'
elsif platform?('ubuntu') && version >= 20 then 'python3'
elsif platform?(*supported_plaftorms) then 'python'
end
end

def gcc
case node['platform_family']
when 'amazon', 'fedora', 'rhel' then 'gcc-c++'
when 'debian' then 'g++'
end
end

def make
'make' if platform?(*supported_plaftorms)
end

def supported_plaftorms
%w(amazon centos debian fedora oracle ubuntu)
end
end
end
Loading

0 comments on commit b801584

Please sign in to comment.