1
0
Fork 0
mirror of synced 2024-11-22 00:35:36 -05:00

Merge pull request #55 from myii/ci/standardise-structure

chore: use `semantic-release` cross-formula standard structure
This commit is contained in:
Niels Abspoel 2019-07-21 15:33:33 +02:00 committed by GitHub
commit 9bfca090ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 97 additions and 51 deletions

9
.gitignore vendored
View file

@ -48,6 +48,7 @@ coverage.xml
.kitchen .kitchen
.kitchen.local.yml .kitchen.local.yml
kitchen.local.yml kitchen.local.yml
junit-*.xml
# Translations # Translations
*.mo *.mo
@ -111,3 +112,11 @@ docs/*.md
# Vim # Vim
*.sw? *.sw?
## Collected when centralising formulas (check and sort)
# `collectd-formula`
.pytest_cache/
/.idea/
Dockerfile.*_*
ignore/
tmp/

View file

@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
stages: stages:
- test - test
- commitlint - commitlint
@ -7,23 +10,13 @@ stages:
sudo: required sudo: required
cache: bundler cache: bundler
language: ruby language: ruby
dist: xenial
services: services:
- docker - docker
# Make sure the instances listed below match up with # Make sure the instances listed below match up with
# the `platforms` defined in `kitchen.yml` # the `platforms` defined in `kitchen.yml`
# NOTE: Please try to select up to six instances that add some meaningful
# testing of the formula's behaviour. If possible, try to refrain from
# the classical "chosing all the instances because I want to test on
# another/all distro/s" trap: it will just add time to the testing (see
# the discussion on #121). As an example, the set chosen below covers
# the most used distros families, systemd and non-systemd and the latest
# three supported Saltstack versions with python2 and 3."
# As for `kitchen.yml`, that should still contain all of the platforms,
# to allow for comprehensive local testing
# Ref: https://github.com/saltstack-formulas/template-formula/issues/118
# Ref: https://github.com/saltstack-formulas/template-formula/issues/121
env: env:
matrix: matrix:
- INSTANCE: default-debian-9-develop-py3 - INSTANCE: default-debian-9-develop-py3
@ -40,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:

View file

@ -156,3 +156,4 @@ An example of that:
BREAKING CHANGE: With the removal of all of the `.sls` files under BREAKING CHANGE: With the removal of all of the `.sls` files under
`template package`, this formula no longer supports the installation of `template package`, this formula no longer supports the installation of
packages. packages.

View file

@ -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,20 +108,6 @@ provisioner:
salt_copy_filter: salt_copy_filter:
- .kitchen - .kitchen
- .git - .git
state_top:
base:
'*':
- sudoers
- sudoers.included
pillars:
top.sls:
base:
'*':
- kitchen
- sudoers
pillars_from_files:
kitchen.sls: test/salt/pillar/kitchen.sls
sudoers.sls: test/salt/pillar/default.sls
verifier: verifier:
# https://www.inspec.io/ # https://www.inspec.io/
@ -137,8 +116,24 @@ verifier:
# cli, documentation, html, progress, json, json-min, json-rspec, junit # cli, documentation, html, progress, json, json-min, json-rspec, junit
reporter: reporter:
- cli - cli
inspec_tests:
- path: test/integration/default
suites: suites:
- name: default - name: default
provisioner:
state_top:
base:
'*':
- sudoers
- sudoers.included
pillars:
top.sls:
base:
'*':
- kitchen
- sudoers
pillars_from_files:
kitchen.sls: test/salt/pillar/kitchen.sls
sudoers.sls: test/salt/pillar/default.sls
verifier:
inspec_tests:
- path: test/integration/default

View 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).

View file

@ -1,12 +1,14 @@
name: sudoers name: default
title: Sudoers Formula title: sudoers formula
maintainer: Saltstack-formulas maintainer: SaltStack Formulas
license: Apache-2.0 license: Apache-2.0
summary: Verify that the sudoers formula is setup and configured correctly summary: Verify that the sudoers 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
- os-name: suse - platform-name: suse
- platform-name: freebsd
- platform-name: amazon