Merge pull request #244 from myii/ci/standardise-structure
chore: use `semantic-release` cross-formula standard structure
This commit is contained in:
commit
e80e0806bb
17
.gitignore
vendored
17
.gitignore
vendored
@ -47,6 +47,8 @@ coverage.xml
|
|||||||
.hypothesis/
|
.hypothesis/
|
||||||
.kitchen
|
.kitchen
|
||||||
.kitchen.local.yml
|
.kitchen.local.yml
|
||||||
|
kitchen.local.yml
|
||||||
|
junit-*.xml
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
@ -102,8 +104,19 @@ ENV/
|
|||||||
# mypy
|
# mypy
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
|
|
||||||
|
# Bundler
|
||||||
|
Gemfile.lock
|
||||||
|
|
||||||
# copied `.md` files used for conversion to `.rst` using `m2r`
|
# copied `.md` files used for conversion to `.rst` using `m2r`
|
||||||
docs/*.md
|
docs/*.md
|
||||||
|
|
||||||
# Ruby
|
# Vim
|
||||||
Gemfile.lock
|
*.sw?
|
||||||
|
|
||||||
|
## Collected when centralising formulas (check and sort)
|
||||||
|
# `collectd-formula`
|
||||||
|
.pytest_cache/
|
||||||
|
/.idea/
|
||||||
|
Dockerfile.*_*
|
||||||
|
ignore/
|
||||||
|
tmp/
|
||||||
|
10
.travis.yml
10
.travis.yml
@ -1,3 +1,6 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vim: ft=yaml
|
||||||
|
---
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- commitlint
|
- commitlint
|
||||||
@ -7,6 +10,7 @@ stages:
|
|||||||
sudo: required
|
sudo: required
|
||||||
cache: bundler
|
cache: bundler
|
||||||
language: ruby
|
language: ruby
|
||||||
|
dist: xenial
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
@ -29,19 +33,15 @@ env:
|
|||||||
# - INSTANCE: default-ubuntu-1604-2018-3-py2
|
# - INSTANCE: default-ubuntu-1604-2018-3-py2
|
||||||
# - INSTANCE: default-centos-7-2018-3-py2
|
# - INSTANCE: default-centos-7-2018-3-py2
|
||||||
- INSTANCE: default-fedora-29-2018-3-py2
|
- INSTANCE: default-fedora-29-2018-3-py2
|
||||||
# TODO: Use this when fixed instead of `opensuse-leap-42`
|
|
||||||
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
|
|
||||||
# - INSTANCE: default-opensuse-leap-15-2018-3-py2
|
|
||||||
- INSTANCE: default-opensuse-leap-42-2018-3-py2
|
- INSTANCE: default-opensuse-leap-42-2018-3-py2
|
||||||
# - INSTANCE: default-debian-8-2017-7-py2
|
# - INSTANCE: default-debian-8-2017-7-py2
|
||||||
# - INSTANCE: default-ubuntu-1604-2017-7-py2
|
# - INSTANCE: default-ubuntu-1604-2017-7-py2
|
||||||
# TODO: Enable after improving the formula to work with other than `systemd`
|
|
||||||
- INSTANCE: default-centos-6-2017-7-py2
|
- INSTANCE: default-centos-6-2017-7-py2
|
||||||
# - INSTANCE: default-fedora-28-2017-7-py2
|
# - INSTANCE: default-fedora-28-2017-7-py2
|
||||||
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
|
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- bundle exec kitchen verify ${INSTANCE}
|
- bin/kitchen verify ${INSTANCE}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
|
29
bin/kitchen
Executable file
29
bin/kitchen
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'kitchen' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require "pathname"
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||||
|
|
||||||
|
if File.file?(bundle_binstub)
|
||||||
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
||||||
|
load(bundle_binstub)
|
||||||
|
else
|
||||||
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||||
|
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
load Gem.bin_path("test-kitchen", "kitchen")
|
@ -157,4 +157,3 @@ An example of that:
|
|||||||
`template package`, this formula no longer supports the installation of
|
`template package`, this formula no longer supports the installation of
|
||||||
packages.
|
packages.
|
||||||
|
|
||||||
|
|
||||||
|
35
kitchen.yml
35
kitchen.yml
@ -44,7 +44,7 @@ platforms:
|
|||||||
- sh bootstrap-salt.sh -XdPbfrq -x python3 git develop
|
- sh bootstrap-salt.sh -XdPbfrq -x python3 git develop
|
||||||
run_command: /usr/lib/systemd/systemd
|
run_command: /usr/lib/systemd/systemd
|
||||||
|
|
||||||
## SALT 2019.2
|
## SALT `2019.2`
|
||||||
- name: debian-9-2019-2-py3
|
- name: debian-9-2019-2-py3
|
||||||
driver:
|
driver:
|
||||||
image: netmanagers/salt-2019.2-py3:debian-9
|
image: netmanagers/salt-2019.2-py3:debian-9
|
||||||
@ -62,7 +62,7 @@ platforms:
|
|||||||
image: netmanagers/salt-2019.2-py3:opensuse-leap-15
|
image: netmanagers/salt-2019.2-py3:opensuse-leap-15
|
||||||
run_command: /usr/lib/systemd/systemd
|
run_command: /usr/lib/systemd/systemd
|
||||||
|
|
||||||
## SALT 2018.3
|
## SALT `2018.3`
|
||||||
- name: debian-9-2018-3-py2
|
- name: debian-9-2018-3-py2
|
||||||
driver:
|
driver:
|
||||||
image: netmanagers/salt-2018.3-py2:debian-9
|
image: netmanagers/salt-2018.3-py2:debian-9
|
||||||
@ -75,25 +75,18 @@ platforms:
|
|||||||
- name: fedora-29-2018-3-py2
|
- name: fedora-29-2018-3-py2
|
||||||
driver:
|
driver:
|
||||||
image: netmanagers/salt-2018.3-py2:fedora-29
|
image: netmanagers/salt-2018.3-py2:fedora-29
|
||||||
# TODO: Use this when fixed instead of `opensuse-leap-42`
|
|
||||||
# Ref: https://github.com/netmanagers/salt-image-builder/issues/2
|
|
||||||
# - name: opensuse-leap-15-2018-3-py2
|
|
||||||
# driver:
|
|
||||||
# image: netmanagers/salt-2018.3-py2:opensuse-leap-15
|
|
||||||
# run_command: /usr/lib/systemd/systemd
|
|
||||||
- name: opensuse-leap-42-2018-3-py2
|
- name: opensuse-leap-42-2018-3-py2
|
||||||
driver:
|
driver:
|
||||||
image: netmanagers/salt-2018.3-py2:opensuse-leap-42
|
image: netmanagers/salt-2018.3-py2:opensuse-leap-42
|
||||||
run_command: /usr/lib/systemd/systemd
|
run_command: /usr/lib/systemd/systemd
|
||||||
|
|
||||||
## SALT 2017.7
|
## SALT `2017.7`
|
||||||
- name: debian-8-2017-7-py2
|
- name: debian-8-2017-7-py2
|
||||||
driver:
|
driver:
|
||||||
image: netmanagers/salt-2017.7-py2:debian-8
|
image: netmanagers/salt-2017.7-py2:debian-8
|
||||||
- name: ubuntu-1604-2017-7-py2
|
- name: ubuntu-1604-2017-7-py2
|
||||||
driver:
|
driver:
|
||||||
image: netmanagers/salt-2017.7-py2:ubuntu-16.04
|
image: netmanagers/salt-2017.7-py2:ubuntu-16.04
|
||||||
# TODO: Modify the formula to work for non-`systemd` platforms
|
|
||||||
- name: centos-6-2017-7-py2
|
- name: centos-6-2017-7-py2
|
||||||
driver:
|
driver:
|
||||||
image: netmanagers/salt-2017.7-py2:centos-6
|
image: netmanagers/salt-2017.7-py2:centos-6
|
||||||
@ -115,6 +108,18 @@ provisioner:
|
|||||||
salt_copy_filter:
|
salt_copy_filter:
|
||||||
- .kitchen
|
- .kitchen
|
||||||
- .git
|
- .git
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
# https://www.inspec.io/
|
||||||
|
name: inspec
|
||||||
|
sudo: true
|
||||||
|
# cli, documentation, html, progress, json, json-min, json-rspec, junit
|
||||||
|
reporter:
|
||||||
|
- cli
|
||||||
|
|
||||||
|
suites:
|
||||||
|
- name: default
|
||||||
|
provisioner:
|
||||||
state_top:
|
state_top:
|
||||||
base:
|
base:
|
||||||
'*':
|
'*':
|
||||||
@ -126,16 +131,6 @@ provisioner:
|
|||||||
- nginx
|
- nginx
|
||||||
pillars_from_files:
|
pillars_from_files:
|
||||||
nginx.sls: test/salt/default/pillar/nginx.sls
|
nginx.sls: test/salt/default/pillar/nginx.sls
|
||||||
|
|
||||||
verifier:
|
verifier:
|
||||||
# https://www.inspec.io/
|
|
||||||
name: inspec
|
|
||||||
sudo: true
|
|
||||||
# cli, documentation, html, progress, json, json-min, json-rspec, junit
|
|
||||||
reporter:
|
|
||||||
- cli
|
|
||||||
inspec_tests:
|
inspec_tests:
|
||||||
- path: test/integration/default
|
- path: test/integration/default
|
||||||
|
|
||||||
suites:
|
|
||||||
- name: default
|
|
||||||
|
50
test/integration/default/README.md
Normal file
50
test/integration/default/README.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# InSpec Profile: `default`
|
||||||
|
|
||||||
|
This shows the implementation of the `default` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md).
|
||||||
|
|
||||||
|
## Verify a profile
|
||||||
|
|
||||||
|
InSpec ships with built-in features to verify a profile structure.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ inspec check default
|
||||||
|
Summary
|
||||||
|
-------
|
||||||
|
Location: default
|
||||||
|
Profile: profile
|
||||||
|
Controls: 4
|
||||||
|
Timestamp: 2019-06-24T23:09:01+00:00
|
||||||
|
Valid: true
|
||||||
|
|
||||||
|
Errors
|
||||||
|
------
|
||||||
|
|
||||||
|
Warnings
|
||||||
|
--------
|
||||||
|
```
|
||||||
|
|
||||||
|
## Execute a profile
|
||||||
|
|
||||||
|
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ inspec exec default
|
||||||
|
..
|
||||||
|
|
||||||
|
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
||||||
|
8 examples, 0 failures
|
||||||
|
```
|
||||||
|
|
||||||
|
## Execute a specific control from a profile
|
||||||
|
|
||||||
|
To run one control from the profile use `inspec exec /path/to/profile --controls name`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ inspec exec default --controls package
|
||||||
|
.
|
||||||
|
|
||||||
|
Finished in 0.0025 seconds (files took 0.12449 seconds to load)
|
||||||
|
1 examples, 0 failures
|
||||||
|
```
|
||||||
|
|
||||||
|
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb).
|
@ -1,11 +1,14 @@
|
|||||||
name: nginx
|
name: default
|
||||||
title: Nginx Formula
|
title: nginx formula
|
||||||
maintainer: Saltstack-formulas
|
maintainer: SaltStack Formulas
|
||||||
license: Apache-2.0
|
license: Apache-2.0
|
||||||
summary: Verify that the nginx formula is setup and configured correctly
|
summary: Verify that the nginx formula is setup and configured correctly
|
||||||
supports:
|
supports:
|
||||||
- os-name: debian
|
- platform-name: debian
|
||||||
- os-name: ubuntu
|
- platform-name: ubuntu
|
||||||
- os-name: centos
|
- platform-name: centos
|
||||||
- os-name: fedora
|
- platform-name: fedora
|
||||||
- os-name: opensuse
|
- platform-name: opensuse
|
||||||
|
- platform-name: suse
|
||||||
|
- platform-name: freebsd
|
||||||
|
- platform-name: amazon
|
||||||
|
Loading…
Reference in New Issue
Block a user