Skip to content

Commit a705d31

Browse files
authored
Merge pull request #133 from myii/ci/standardise-structure
chore: use `semantic-release` cross-formula standard structure
2 parents e6656f8 + 89b54c6 commit a705d31

File tree

7 files changed

+124
-29
lines changed

7 files changed

+124
-29
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: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ stages:
77
sudo: required
88
cache: bundler
99
language: ruby
10+
dist: xenial
1011

1112
services:
1213
- docker
@@ -29,19 +30,15 @@ env:
2930
# - INSTANCE: default-ubuntu-1604-2018-3-py2
3031
# - INSTANCE: default-centos-7-2018-3-py2
3132
# - INSTANCE: default-fedora-29-2018-3-py2
32-
# TODO: Use this when fixed instead of `opensuse-leap-42`
33-
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
34-
# - INSTANCE: default-opensuse-leap-15-2018-3-py2
3533
- INSTANCE: default-opensuse-leap-42-2018-3-py2
3634
# - INSTANCE: default-debian-8-2017-7-py2
3735
# - INSTANCE: default-ubuntu-1604-2017-7-py2
38-
# TODO: Enable after improving the formula to work with other than `systemd`
3936
- INSTANCE: default-centos-6-2017-7-py2
4037
# - INSTANCE: default-fedora-28-2017-7-py2
4138
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
4239

4340
script:
44-
- bundle exec kitchen verify ${INSTANCE}
41+
- bin/kitchen verify ${INSTANCE}
4542

4643
jobs:
4744
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+

bin/kitchen

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'kitchen' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("test-kitchen", "kitchen")

kitchen.yml

Lines changed: 19 additions & 24 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,18 +108,6 @@ provisioner:
115108
salt_copy_filter:
116109
- .kitchen
117110
- .git
118-
state_top:
119-
base:
120-
'*':
121-
- bind
122-
- bind.config
123-
pillars:
124-
top.sls:
125-
base:
126-
'*':
127-
- bind
128-
pillars_from_files:
129-
bind.sls: test/salt/pillar/default.sls
130111

131112
verifier:
132113
# https://www.inspec.io/
@@ -135,8 +116,22 @@ verifier:
135116
# cli, documentation, html, progress, json, json-min, json-rspec, junit
136117
reporter:
137118
- cli
138-
inspec_tests:
139-
- path: test/integration/default
140119

141120
suites:
142121
- name: default
122+
provisioner:
123+
state_top:
124+
base:
125+
'*':
126+
- bind
127+
- bind.config
128+
pillars:
129+
top.sls:
130+
base:
131+
'*':
132+
- bind
133+
pillars_from_files:
134+
bind.sls: test/salt/pillar/default.sls
135+
verifier:
136+
inspec_tests:
137+
- path: test/integration/default

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).
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: default
2+
title: bind formula
3+
maintainer: SaltStack Formulas
4+
license: Apache-2.0
5+
summary: Verify that the bind formula is setup and configured correctly
6+
supports:
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)