Skip to content

Commit cda07b5

Browse files
authored
Merge pull request #39 from myii/ci/standardise-structure
chore: use `semantic-release` cross-formula standard structure
2 parents f44baa7 + d76cee3 commit cda07b5

File tree

9 files changed

+175
-51
lines changed

9 files changed

+175
-51
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ coverage.xml
4848
.kitchen
4949
.kitchen.local.yml
5050
kitchen.local.yml
51+
junit-*.xml
5152

5253
# Translations
5354
*.mo
@@ -111,3 +112,11 @@ docs/*.md
111112

112113
# Vim
113114
*.sw?
115+
116+
## Collected when centralising formulas (check and sort)
117+
# `collectd-formula`
118+
.pytest_cache/
119+
/.idea/
120+
Dockerfile.*_*
121+
ignore/
122+
tmp/

.travis.yml

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
14
stages:
25
- test
36
- commitlint
@@ -7,52 +10,58 @@ stages:
710
sudo: required
811
cache: bundler
912
language: ruby
13+
dist: xenial
1014

1115
services:
1216
- docker
1317

1418
# Make sure the instances listed below match up with
1519
# the `platforms` defined in `kitchen.yml`
16-
# NOTE: Please try to select up to six instances that add some meaningful
17-
# testing of the formula's behaviour. If possible, try to refrain from
18-
# the classical "chosing all the instances because I want to test on
19-
# another/all distro/s" trap: it will just add time to the testing (see
20-
# the discussion on #121). As an example, the set chosen below covers
21-
# the most used distros families, systemd and non-systemd and the latest
22-
# three supported Saltstack versions with python2 and 3."
23-
# As for `kitchen.yml`, that should still contain all of the platforms,
24-
# to allow for comprehensive local testing
25-
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
26-
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
2720
env:
2821
matrix:
2922
- INSTANCE: default-debian-9-develop-py3
23+
# - INSTANCE: tables-debian-9-develop-py3
3024
# - INSTANCE: default-ubuntu-1804-develop-py3
25+
# - INSTANCE: tables-ubuntu-1804-develop-py3
3126
# - INSTANCE: default-centos-7-develop-py3
27+
# - INSTANCE: tables-centos-7-develop-py3
3228
# - INSTANCE: default-fedora-29-develop-py3
29+
# - INSTANCE: tables-fedora-29-develop-py3
3330
# - INSTANCE: default-opensuse-leap-15-develop-py3
31+
# - INSTANCE: tables-opensuse-leap-15-develop-py3
3432
# - INSTANCE: default-debian-9-2019-2-py3
33+
# - INSTANCE: tables-debian-9-2019-2-py3
3534
- INSTANCE: default-ubuntu-1804-2019-2-py3
35+
# - INSTANCE: tables-ubuntu-1804-2019-2-py3
3636
- INSTANCE: default-centos-7-2019-2-py3
37+
# - INSTANCE: tables-centos-7-2019-2-py3
3738
# - INSTANCE: default-fedora-29-2019-2-py3
39+
# - INSTANCE: tables-fedora-29-2019-2-py3
3840
# - INSTANCE: default-opensuse-leap-15-2019-2-py3
41+
# - INSTANCE: tables-opensuse-leap-15-2019-2-py3
3942
# - INSTANCE: default-debian-9-2018-3-py2
43+
# - INSTANCE: tables-debian-9-2018-3-py2
4044
# - INSTANCE: default-ubuntu-1604-2018-3-py2
45+
# - INSTANCE: tables-ubuntu-1604-2018-3-py2
4146
# - INSTANCE: default-centos-7-2018-3-py2
47+
# - INSTANCE: tables-centos-7-2018-3-py2
4248
- INSTANCE: default-fedora-29-2018-3-py2
43-
# TODO: Use this when fixed instead of `opensuse-leap-42`
44-
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
45-
# - INSTANCE: default-opensuse-leap-15-2018-3-py2
49+
# - INSTANCE: tables-fedora-29-2018-3-py2
4650
- INSTANCE: default-opensuse-leap-42-2018-3-py2
51+
# - INSTANCE: tables-opensuse-leap-42-2018-3-py2
4752
# - INSTANCE: default-debian-8-2017-7-py2
53+
# - INSTANCE: tables-debian-8-2017-7-py2
54+
# - INSTANCE: default-ubuntu-1604-2017-7-py2
4855
# - INSTANCE: tables-ubuntu-1604-2017-7-py2
49-
# TODO: Enable after improving the formula to work with other than `systemd`
5056
# - INSTANCE: default-centos-6-2017-7-py2
57+
# - INSTANCE: tables-centos-6-2017-7-py2
5158
# - INSTANCE: default-fedora-28-2017-7-py2
59+
# - INSTANCE: tables-fedora-28-2017-7-py2
60+
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
5261
- INSTANCE: tables-opensuse-leap-42-2017-7-py2
5362

5463
script:
55-
- bundle exec kitchen verify ${INSTANCE}
64+
- bin/kitchen verify ${INSTANCE}
5665

5766
jobs:
5867
include:

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ source "https://rubygems.org"
33
gem 'kitchen-docker', '>= 2.9'
44
gem 'kitchen-salt', '>= 0.6.0'
55
gem 'kitchen-inspec', '>= 1.1'
6+

docs/CONTRIBUTING.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,4 @@ An example of that:
156156
BREAKING CHANGE: With the removal of all of the `.sls` files under
157157
`template package`, this formula no longer supports the installation of
158158
packages.
159+

kitchen.yml

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ platforms:
4444
- sh bootstrap-salt.sh -XdPbfrq -x python3 git develop
4545
run_command: /usr/lib/systemd/systemd
4646

47-
## SALT 2019.2
47+
## SALT `2019.2`
4848
- name: debian-9-2019-2-py3
4949
driver:
5050
image: netmanagers/salt-2019.2-py3:debian-9
@@ -62,7 +62,7 @@ platforms:
6262
image: netmanagers/salt-2019.2-py3:opensuse-leap-15
6363
run_command: /usr/lib/systemd/systemd
6464

65-
## SALT 2018.3
65+
## SALT `2018.3`
6666
- name: debian-9-2018-3-py2
6767
driver:
6868
image: netmanagers/salt-2018.3-py2:debian-9
@@ -75,25 +75,18 @@ platforms:
7575
- name: fedora-29-2018-3-py2
7676
driver:
7777
image: netmanagers/salt-2018.3-py2:fedora-29
78-
# TODO: Use this when fixed instead of `opensuse-leap-42`
79-
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
80-
# - name: opensuse-leap-15-2018-3-py2
81-
# driver:
82-
# image: netmanagers/salt-2018.3-py2:opensuse-leap-15
83-
# run_command: /usr/lib/systemd/systemd
8478
- name: opensuse-leap-42-2018-3-py2
8579
driver:
8680
image: netmanagers/salt-2018.3-py2:opensuse-leap-42
8781
run_command: /usr/lib/systemd/systemd
8882

89-
## SALT 2017.7
83+
## SALT `2017.7`
9084
- name: debian-8-2017-7-py2
9185
driver:
9286
image: netmanagers/salt-2017.7-py2:debian-8
9387
- name: ubuntu-1604-2017-7-py2
9488
driver:
9589
image: netmanagers/salt-2017.7-py2:ubuntu-16.04
96-
# TODO: Modify the formula to work for non-`systemd` platforms
9790
- name: centos-6-2017-7-py2
9891
driver:
9992
image: netmanagers/salt-2017.7-py2:centos-6
@@ -115,15 +108,6 @@ provisioner:
115108
salt_copy_filter:
116109
- .kitchen
117110
- .git
118-
state_top:
119-
base:
120-
'*':
121-
- iptables
122-
pillars:
123-
top.sls:
124-
base:
125-
'*':
126-
- iptables
127111

128112
verifier:
129113
# https://www.inspec.io/
@@ -136,20 +120,34 @@ verifier:
136120
suites:
137121
- name: default
138122
provisioner:
123+
state_top:
124+
base:
125+
'*':
126+
- iptables
127+
pillars:
128+
top.sls:
129+
base:
130+
'*':
131+
- iptables
139132
pillars_from_files:
140133
iptables.sls: test/salt/pillar/default.pillar.sls
141134
verifier:
142135
inspec_tests:
143136
- path: test/integration/default
144137
- name: tables
145138
provisioner:
146-
pillars_from_files:
147-
iptables.sls: test/salt/pillar/tables.pillar.sls
148139
state_top:
149140
base:
150141
'*':
151142
- iptables
152143
- iptables.tables
144+
pillars:
145+
top.sls:
146+
base:
147+
'*':
148+
- iptables
149+
pillars_from_files:
150+
iptables.sls: test/salt/pillar/tables.pillar.sls
153151
verifier:
154152
inspec_tests:
155153
- path: test/integration/tables

test/integration/default/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# InSpec Profile: `default`
2+
3+
This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
4+
5+
## Verify a profile
6+
7+
InSpec ships with built-in features to verify a profile structure.
8+
9+
```bash
10+
$ inspec check default
11+
Summary
12+
-------
13+
Location: default
14+
Profile: profile
15+
Controls: 4
16+
Timestamp: 2019-06-24T23:09:01+00:00
17+
Valid: true
18+
19+
Errors
20+
------
21+
22+
Warnings
23+
--------
24+
```
25+
26+
## Execute a profile
27+
28+
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
29+
30+
```bash
31+
$ inspec exec default
32+
..
33+
34+
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
35+
8 examples, 0 failures
36+
```
37+
38+
## Execute a specific control from a profile
39+
40+
To run one control from the profile use `inspec exec /path/to/profile --controls name`.
41+
42+
```bash
43+
$ inspec exec default --controls package
44+
.
45+
46+
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
47+
1 examples, 0 failures
48+
```
49+
50+
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb).

test/integration/default/inspec.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: default
2-
title: Iptables Formula
3-
maintainer: Saltstack-formulas org
2+
title: iptables formula
3+
maintainer: SaltStack Formulas
44
license: Apache-2.0
55
summary: Verify that iptables is installed and configured correctly
66
supports:
7-
- os-name: debian
8-
- os-name: ubuntu
9-
- os-name: centos
10-
- os-name: fedora
11-
- os-name: opensuse
7+
- platform-name: debian
8+
- platform-name: ubuntu
9+
- platform-name: centos
10+
- platform-name: fedora
11+
- platform-name: opensuse
12+
- platform-name: suse
13+
- platform-name: freebsd
14+
- platform-name: amazon

test/integration/tables/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# InSpec Profile: `tables`
2+
3+
This shows the implementation of the `tables` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
4+
5+
## Verify a profile
6+
7+
InSpec ships with built-in features to verify a profile structure.
8+
9+
```bash
10+
$ inspec check tables
11+
Summary
12+
-------
13+
Location: tables
14+
Profile: profile
15+
Controls: 4
16+
Timestamp: 2019-06-24T23:09:01+00:00
17+
Valid: true
18+
19+
Errors
20+
------
21+
22+
Warnings
23+
--------
24+
```
25+
26+
## Execute a profile
27+
28+
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
29+
30+
```bash
31+
$ inspec exec tables
32+
..
33+
34+
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
35+
8 examples, 0 failures
36+
```
37+
38+
## Execute a specific control from a profile
39+
40+
To run one control from the profile use `inspec exec /path/to/profile --controls name`.
41+
42+
```bash
43+
$ inspec exec tables --controls package
44+
.
45+
46+
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
47+
1 examples, 0 failures
48+
```
49+
50+
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb).

test/integration/tables/inspec.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: tables
2-
title: Iptables Formula
3-
maintainer: Saltstack-formulas org
2+
title: iptables formula
3+
maintainer: SaltStack Formulas
44
license: Apache-2.0
55
summary: Verify that iptables is installed and configured using tables defined in pillars
66
supports:
7-
- os-name: debian
8-
- os-name: ubuntu
9-
- os-name: centos
10-
- os-name: fedora
11-
- os-name: opensuse
7+
- platform-name: debian
8+
- platform-name: ubuntu
9+
- platform-name: centos
10+
- platform-name: fedora
11+
- platform-name: opensuse
12+
- platform-name: suse
13+
- platform-name: freebsd
14+
- platform-name: amazon

0 commit comments

Comments
 (0)