Skip to content

Commit f27ec2e

Browse files
committed
ci(kitchen+travis): test with pre-salted Docker images
1 parent c05019a commit f27ec2e

File tree

8 files changed

+133
-45
lines changed

8 files changed

+133
-45
lines changed

.travis.yml

+21-4
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,31 @@ language: ruby
1111
services:
1212
- docker
1313

14+
# Make sure the instances listed below match up with
15+
# the `platforms` defined in `kitchen.yml`
1416
env:
1517
matrix:
16-
- DISTRIB=debian:stretch/9
17-
- DISTRIB=ubuntu:xenial/16.04
18-
- DISTRIB=ubuntu:bionic/18.04
18+
- INSTANCE: default-debian-9-2019-2-py3
19+
- INSTANCE: default-ubuntu-1804-2019-2-py3
20+
- INSTANCE: default-centos-7-2019-2-py3
21+
- INSTANCE: default-fedora-29-2019-2-py3
22+
- INSTANCE: default-opensuse-leap-15-2019-2-py3
23+
# - INSTANCE: default-debian-9-2018-3-py2
24+
# - INSTANCE: default-ubuntu-1604-2018-3-py2
25+
# - INSTANCE: default-centos-7-2018-3-py2
26+
# - INSTANCE: default-fedora-29-2018-3-py2
27+
# TODO: Use this when fixed instead of `opensuse-leap-42`
28+
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
29+
# - INSTANCE: default-opensuse-leap-15-2018-3-py2
30+
# - INSTANCE: default-opensuse-leap-42-2018-3-py2
31+
# - INSTANCE: default-debian-8-2017-7-py2
32+
# - INSTANCE: default-ubuntu-1604-2017-7-py2
33+
# - INSTANCE: default-centos-6-2017-7-py2
34+
# - INSTANCE: default-fedora-28-2017-7-py2
35+
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
1936

2037
script:
21-
- bundle exec kitchen test
38+
- bundle exec kitchen verify ${INSTANCE}
2239

2340
jobs:
2441
include:

kitchen.yml

+94-29
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,103 @@
1-
<%
2-
distrib, infos = ENV.fetch('DISTRIB', 'debian:stretch/9').split(':')
3-
codename, version = infos.split('/')
4-
%>
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
53
---
4+
# For help on this file's format, see https://kitchen.ci/
65
driver:
76
name: docker
87
use_sudo: false
98
privileged: true
9+
run_command: /lib/systemd/systemd
1010

11-
provisioner:
12-
name: salt_solo
13-
formula: ufw
11+
# Make sure the platforms listed below match up with
12+
# the `env.matrix` instances defined in `.travis.yml`
13+
platforms:
14+
## SALT 2019.2
15+
- name: debian-9-2019-2-py3
16+
driver:
17+
image: netmanagers/salt-2019.2-py3:debian-9
18+
provision_command:
19+
- apt-get update && apt-get install -y locales
20+
- echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
21+
- locale-gen en_US.UTF-8
22+
- name: ubuntu-1804-2019-2-py3
23+
driver:
24+
image: netmanagers/salt-2019.2-py3:ubuntu-18.04
25+
- name: centos-7-2019-2-py3
26+
driver:
27+
image: netmanagers/salt-2019.2-py3:centos-7
28+
- name: fedora-29-2019-2-py3
29+
driver:
30+
image: netmanagers/salt-2019.2-py3:fedora-29
31+
- name: opensuse-leap-15-2019-2-py3
32+
driver:
33+
image: netmanagers/salt-2019.2-py3:opensuse-leap-15
34+
run_command: /usr/lib/systemd/systemd
1435

15-
# Install Salt from official repositories
16-
salt_install: apt
17-
salt_version: latest
18-
salt_apt_repo: https://repo.saltstack.com/apt/<%= distrib %>/<%= version %>/amd64
19-
salt_apt_repo_key: https://repo.saltstack.com/apt/<%= distrib %>/<%= version %>/amd64/latest/SALTSTACK-GPG-KEY.pub
36+
## SALT 2018.3
37+
- name: debian-9-2018-3-py2
38+
driver:
39+
image: netmanagers/salt-2018.3-py2:debian-9
40+
provision_command:
41+
- apt-get update && apt-get install -y locales
42+
- echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
43+
- locale-gen en_US.UTF-8
44+
- name: ubuntu-1604-2018-3-py2
45+
driver:
46+
image: netmanagers/salt-2018.3-py2:ubuntu-16.04
47+
- name: centos-7-2018-3-py2
48+
driver:
49+
image: netmanagers/salt-2018.3-py2:centos-7
50+
- name: fedora-29-2018-3-py2
51+
driver:
52+
image: netmanagers/salt-2018.3-py2:fedora-29
53+
# TODO: Use this when fixed instead of `opensuse-leap-42`
54+
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
55+
# - name: opensuse-leap-15-2018-3-py2
56+
# driver:
57+
# image: netmanagers/salt-2018.3-py2:opensuse-leap-15
58+
# run_command: /usr/lib/systemd/systemd
59+
- name: opensuse-leap-42-2018-3-py2
60+
driver:
61+
image: netmanagers/salt-2018.3-py2:opensuse-leap-42
62+
run_command: /usr/lib/systemd/systemd
2063

21-
# Don't install Chef
22-
require_chef: false
64+
## SALT 2017.7
65+
- name: debian-8-2017-7-py2
66+
driver:
67+
image: netmanagers/salt-2017.7-py2:debian-8
68+
provision_command:
69+
- apt-get update && apt-get install -y locales
70+
- echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
71+
- locale-gen en_US.UTF-8
72+
- name: ubuntu-1604-2017-7-py2
73+
driver:
74+
image: netmanagers/salt-2017.7-py2:ubuntu-16.04
75+
- name: centos-6-2017-7-py2
76+
driver:
77+
image: netmanagers/salt-2017.7-py2:centos-6
78+
run_command: /sbin/init
79+
run_options: -v /lib/modules:/lib/modules:ro
80+
- name: fedora-28-2017-7-py2
81+
driver:
82+
image: netmanagers/salt-2017.7-py2:fedora-28
83+
- name: opensuse-leap-42-2017-7-py2
84+
driver:
85+
image: netmanagers/salt-2017.7-py2:opensuse-leap-42
86+
run_command: /usr/lib/systemd/systemd
2387

24-
# Configure Salt
88+
provisioner:
89+
name: salt_solo
90+
log_level: info
91+
salt_install: none
92+
require_chef: false
93+
formula: ufw
94+
salt_copy_filter:
95+
- .kitchen
96+
- .git
2597
state_top:
2698
base:
2799
'*':
28100
- ufw
29-
30101
pillars:
31102
top.sls:
32103
base:
@@ -67,21 +138,15 @@ provisioner:
67138
protocol: tcp
68139
comment: Allow HTTPS
69140

70-
platforms:
71-
- name: <%= distrib %>-<%= codename %>
72-
driver_config:
73-
image: "<%= distrib %>:<%= codename %>"
74-
platform: <%= distrib %>
75-
provision_command:
76-
- apt-get update && apt-get install -y locales
77-
- echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
78-
- locale-gen en_US.UTF-8
79-
run_command: /lib/systemd/systemd
80-
81141
verifier:
142+
# https://www.inspec.io/
82143
name: inspec
144+
sudo: true
145+
# cli, documentation, html, progress, json, json-min, json-rspec, junit
83146
reporter:
84-
- progress
147+
- cli
148+
inspec_tests:
149+
- path: test/integration/default
85150

86151
suites:
87-
- name: ufw
152+
- name: default

test/integration/default/inspec.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: ufw
2+
title: UFW Formula
3+
maintainer: Alexandre Anriot
4+
license: Apache-2.0
5+
summary: Verify that the ufw formula is setup and configured correctly
6+
supports:
7+
- os-name: debian
8+
- os-name: ubuntu
9+
- os-name: centos
10+
- os-name: fedora
11+
- os-name: opensuse
12+
- os-name: suse

test/integration/ufw/inspec.yml

-10
This file was deleted.

ufw/config/applications.sls

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ ufw-app-{{method}}-{{app_name}}:
3939
{%- if to_addr is not none %}
4040
- to_addr: {{to_addr}}
4141
{%- endif %}
42-
{%- if comment is not none %}
42+
# Debian Jessie doesn't implement the **comment** directive
43+
# CentOS-6 throws an UTF-8 error
44+
{%- if comment is not none and salt['grains.get']('osfinger') != 'Debian-8' and salt['grains.get']('osfinger') != 'CentOS-6' %}
4345
- comment: '"{{comment}}"'
4446
{%- endif %}
4547
- listen_in:

ufw/config/services.sls

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ ufw-svc-{{method}}-{{service_name}}-{{from_addr}}:
4343
{%- if to_addr is not none %}
4444
- to_addr: {{to_addr}}
4545
{%- endif %}
46-
{%- if comment is not none %}
46+
# Debian Jessie doesn't implement the **comment** directive
47+
# CentOS-6 throws an UTF-8 error
48+
{%- if comment is not none and salt['grains.get']('osfinger') != 'Debian-8' and salt['grains.get']('osfinger') != 'CentOS-6' %}
4749
- comment: '"{{comment}}"'
4850
{%- endif %}
4951
- to_port: "{{to_port}}"

0 commit comments

Comments
 (0)