Skip to content

Commit

Permalink
ci: use default & repo InSpec suites
Browse files Browse the repository at this point in the history
* Automated using myii/ssf-formula#348
  • Loading branch information
myii committed Jul 20, 2021
1 parent 060c8df commit a6c8197
Show file tree
Hide file tree
Showing 6 changed files with 293 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/kitchen.vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ jobs:
matrix:
instance:
- default-freebsd-130-master-py3
# - freebsd-130-master-py3
- default-freebsd-122-master-py3
# - freebsd-122-master-py3
- default-freebsd-114-master-py3
# - freebsd-114-master-py3
# - default-freebsd-130-3002-6-py3
# - default-freebsd-122-3002-6-py3
# - default-freebsd-114-3002-6-py3
Expand Down
77 changes: 60 additions & 17 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ rubocop:
###############################################################################
# Define `test` template
###############################################################################
.test_instance:
.test_instance: &test_instance
stage: *stage_test
image: *image_dindruby
services: *services_docker_dind
Expand All @@ -117,6 +117,13 @@ rubocop:
# Alternative value to consider: `${CI_JOB_NAME}`
- 'bin/kitchen verify "${DOCKER_ENV_CI_JOB_NAME}"'

###############################################################################
# Define `test` template (`allow_failure: true`)
###############################################################################
.test_instance_failure_permitted:
<<: *test_instance
allow_failure: true

###############################################################################
# `test` stage: each instance below uses the `test` template above
###############################################################################
Expand All @@ -135,26 +142,62 @@ rubocop:
# default-oraclelinux-7-tiamat-py3: {extends: '.test_instance'}
# default-almalinux-8-tiamat-py3: {extends: '.test_instance'}
# default-rockylinux-8-tiamat-py3: {extends: '.test_instance'}
default-debian-11-master-py3: {extends: '.test_instance'}
default-debian-10-master-py3: {extends: '.test_instance'}
default-debian-9-master-py3: {extends: '.test_instance'}
default-ubuntu-2004-master-py3: {extends: '.test_instance'}
default-ubuntu-1804-master-py3: {extends: '.test_instance'}
default-centos-8-master-py3: {extends: '.test_instance'}
default-centos-7-master-py3: {extends: '.test_instance'}
default-fedora-34-master-py3: {extends: '.test_instance'}
default-fedora-33-master-py3: {extends: '.test_instance'}
default-opensuse-leap-153-master-py3: {extends: '.test_instance'}
default-opensuse-leap-152-master-py3: {extends: '.test_instance'}
# default-debian-11-master-py3: {extends: '.test_instance'}
# repo-debian-11-master-py3: {extends: '.test_instance'}
debian-11-master-py3: {extends: '.test_instance'}
# default-debian-10-master-py3: {extends: '.test_instance'}
# repo-debian-10-master-py3: {extends: '.test_instance'}
debian-10-master-py3: {extends: '.test_instance'}
# default-debian-9-master-py3: {extends: '.test_instance'}
# repo-debian-9-master-py3: {extends: '.test_instance'}
debian-9-master-py3: {extends: '.test_instance'}
# default-ubuntu-2004-master-py3: {extends: '.test_instance'}
# repo-ubuntu-2004-master-py3: {extends: '.test_instance'}
ubuntu-2004-master-py3: {extends: '.test_instance'}
# default-ubuntu-1804-master-py3: {extends: '.test_instance'}
# repo-ubuntu-1804-master-py3: {extends: '.test_instance'}
ubuntu-1804-master-py3: {extends: '.test_instance'}
# default-centos-8-master-py3: {extends: '.test_instance'}
# repo-centos-8-master-py3: {extends: '.test_instance'}
centos-8-master-py3: {extends: '.test_instance'}
# default-centos-7-master-py3: {extends: '.test_instance'}
# repo-centos-7-master-py3: {extends: '.test_instance'}
centos-7-master-py3: {extends: '.test_instance'}
# default-fedora-34-master-py3: {extends: '.test_instance'}
# repo-fedora-34-master-py3: {extends: '.test_instance'}
fedora-34-master-py3: {extends: '.test_instance'}
# default-fedora-33-master-py3: {extends: '.test_instance'}
# repo-fedora-33-master-py3: {extends: '.test_instance'}
fedora-33-master-py3: {extends: '.test_instance'}
# default-opensuse-leap-153-master-py3: {extends: '.test_instance'}
# repo-opensuse-leap-153-master-py3: {extends: '.test_instance'}
opensuse-leap-153-master-py3: {extends: '.test_instance'}
# default-opensuse-leap-152-master-py3: {extends: '.test_instance'}
# repo-opensuse-leap-152-master-py3: {extends: '.test_instance_failure_permitted'}
opensuse-leap-152-master-py3: {extends: '.test_instance_failure_permitted'}
default-opensuse-tmbl-latest-master-py3: {extends: '.test_instance'}
default-amazonlinux-2-master-py3: {extends: '.test_instance'}
default-oraclelinux-8-master-py3: {extends: '.test_instance'}
default-oraclelinux-7-master-py3: {extends: '.test_instance'}
# opensuse-tmbl-latest-master-py3: {extends: '.test_instance'}
# default-amazonlinux-2-master-py3: {extends: '.test_instance'}
# repo-amazonlinux-2-master-py3: {extends: '.test_instance'}
amazonlinux-2-master-py3: {extends: '.test_instance'}
# default-oraclelinux-8-master-py3: {extends: '.test_instance'}
# repo-oraclelinux-8-master-py3: {extends: '.test_instance'}
oraclelinux-8-master-py3: {extends: '.test_instance'}
# default-oraclelinux-7-master-py3: {extends: '.test_instance'}
# repo-oraclelinux-7-master-py3: {extends: '.test_instance'}
oraclelinux-7-master-py3: {extends: '.test_instance'}
default-arch-base-latest-master-py3: {extends: '.test_instance'}
# arch-base-latest-master-py3: {extends: '.test_instance'}
# default-gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
# gentoo-stage3-latest-master-py3: {extends: '.test_instance'}
# default-gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
default-almalinux-8-master-py3: {extends: '.test_instance'}
default-rockylinux-8-master-py3: {extends: '.test_instance'}
# gentoo-stage3-systemd-master-py3: {extends: '.test_instance'}
# default-almalinux-8-master-py3: {extends: '.test_instance'}
# repo-almalinux-8-master-py3: {extends: '.test_instance'}
almalinux-8-master-py3: {extends: '.test_instance'}
# default-rockylinux-8-master-py3: {extends: '.test_instance'}
# repo-rockylinux-8-master-py3: {extends: '.test_instance'}
rockylinux-8-master-py3: {extends: '.test_instance'}
# default-debian-11-3003-1-py3: {extends: '.test_instance'}
# default-debian-10-3003-1-py3: {extends: '.test_instance'}
# default-debian-9-3003-1-py3: {extends: '.test_instance'}
Expand Down
68 changes: 52 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,62 @@ jobs:
# - env: INSTANCE=default-oraclelinux-7-tiamat-py3
# - env: INSTANCE=default-almalinux-8-tiamat-py3
# - env: INSTANCE=default-rockylinux-8-tiamat-py3
- env: INSTANCE=default-debian-11-master-py3
- env: INSTANCE=default-debian-10-master-py3
- env: INSTANCE=default-debian-9-master-py3
- env: INSTANCE=default-ubuntu-2004-master-py3
- env: INSTANCE=default-ubuntu-1804-master-py3
- env: INSTANCE=default-centos-8-master-py3
- env: INSTANCE=default-centos-7-master-py3
- env: INSTANCE=default-fedora-34-master-py3
- env: INSTANCE=default-fedora-33-master-py3
- env: INSTANCE=default-opensuse-leap-153-master-py3
- env: INSTANCE=default-opensuse-leap-152-master-py3
# - env: INSTANCE=default-debian-11-master-py3
# - env: INSTANCE=repo-debian-11-master-py3
- env: INSTANCE=debian-11-master-py3
# - env: INSTANCE=default-debian-10-master-py3
# - env: INSTANCE=repo-debian-10-master-py3
- env: INSTANCE=debian-10-master-py3
# - env: INSTANCE=default-debian-9-master-py3
# - env: INSTANCE=repo-debian-9-master-py3
- env: INSTANCE=debian-9-master-py3
# - env: INSTANCE=default-ubuntu-2004-master-py3
# - env: INSTANCE=repo-ubuntu-2004-master-py3
- env: INSTANCE=ubuntu-2004-master-py3
# - env: INSTANCE=default-ubuntu-1804-master-py3
# - env: INSTANCE=repo-ubuntu-1804-master-py3
- env: INSTANCE=ubuntu-1804-master-py3
# - env: INSTANCE=default-centos-8-master-py3
# - env: INSTANCE=repo-centos-8-master-py3
- env: INSTANCE=centos-8-master-py3
# - env: INSTANCE=default-centos-7-master-py3
# - env: INSTANCE=repo-centos-7-master-py3
- env: INSTANCE=centos-7-master-py3
# - env: INSTANCE=default-fedora-34-master-py3
# - env: INSTANCE=repo-fedora-34-master-py3
- env: INSTANCE=fedora-34-master-py3
# - env: INSTANCE=default-fedora-33-master-py3
# - env: INSTANCE=repo-fedora-33-master-py3
- env: INSTANCE=fedora-33-master-py3
# - env: INSTANCE=default-opensuse-leap-153-master-py3
# - env: INSTANCE=repo-opensuse-leap-153-master-py3
- env: INSTANCE=opensuse-leap-153-master-py3
# - env: INSTANCE=default-opensuse-leap-152-master-py3
# - env: INSTANCE=repo-opensuse-leap-152-master-py3
- env: INSTANCE=opensuse-leap-152-master-py3
- env: INSTANCE=default-opensuse-tmbl-latest-master-py3
- env: INSTANCE=default-amazonlinux-2-master-py3
- env: INSTANCE=default-oraclelinux-8-master-py3
- env: INSTANCE=default-oraclelinux-7-master-py3
# - env: INSTANCE=opensuse-tmbl-latest-master-py3
# - env: INSTANCE=default-amazonlinux-2-master-py3
# - env: INSTANCE=repo-amazonlinux-2-master-py3
- env: INSTANCE=amazonlinux-2-master-py3
# - env: INSTANCE=default-oraclelinux-8-master-py3
# - env: INSTANCE=repo-oraclelinux-8-master-py3
- env: INSTANCE=oraclelinux-8-master-py3
# - env: INSTANCE=default-oraclelinux-7-master-py3
# - env: INSTANCE=repo-oraclelinux-7-master-py3
- env: INSTANCE=oraclelinux-7-master-py3
- env: INSTANCE=default-arch-base-latest-master-py3
# - env: INSTANCE=arch-base-latest-master-py3
# - env: INSTANCE=default-gentoo-stage3-latest-master-py3
# - env: INSTANCE=gentoo-stage3-latest-master-py3
# - env: INSTANCE=default-gentoo-stage3-systemd-master-py3
- env: INSTANCE=default-almalinux-8-master-py3
- env: INSTANCE=default-rockylinux-8-master-py3
# - env: INSTANCE=gentoo-stage3-systemd-master-py3
# - env: INSTANCE=default-almalinux-8-master-py3
# - env: INSTANCE=repo-almalinux-8-master-py3
- env: INSTANCE=almalinux-8-master-py3
# - env: INSTANCE=default-rockylinux-8-master-py3
# - env: INSTANCE=repo-rockylinux-8-master-py3
- env: INSTANCE=rockylinux-8-master-py3
# - env: INSTANCE=default-debian-11-3003-1-py3
# - env: INSTANCE=default-debian-10-3003-1-py3
# - env: INSTANCE=default-debian-9-3003-1-py3
Expand Down
100 changes: 100 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,103 @@ suites:
verifier:
inspec_tests:
- path: test/integration/default
- name: repo
includes:
- debian-11-tiamat-py3
- debian-10-tiamat-py3
- debian-9-tiamat-py3
- ubuntu-2004-tiamat-py3
- ubuntu-1804-tiamat-py3
- centos-8-tiamat-py3
- centos-7-tiamat-py3
- amazonlinux-2-tiamat-py3
- oraclelinux-8-tiamat-py3
- oraclelinux-7-tiamat-py3
- almalinux-8-tiamat-py3
- rockylinux-8-tiamat-py3
- debian-11-master-py3
- debian-10-master-py3
- debian-9-master-py3
- ubuntu-2004-master-py3
- ubuntu-1804-master-py3
- centos-8-master-py3
- centos-7-master-py3
- fedora-34-master-py3
- fedora-33-master-py3
- opensuse-leap-153-master-py3
- opensuse-leap-152-master-py3
- amazonlinux-2-master-py3
- oraclelinux-8-master-py3
- oraclelinux-7-master-py3
- almalinux-8-master-py3
- rockylinux-8-master-py3
- debian-11-3003-1-py3
- debian-10-3003-1-py3
- debian-9-3003-1-py3
- ubuntu-2004-3003-1-py3
- ubuntu-1804-3003-1-py3
- centos-8-3003-1-py3
- centos-7-3003-1-py3
- fedora-34-3003-1-py3
- fedora-33-3003-1-py3
- opensuse-leap-153-3003-1-py3
- opensuse-leap-152-3003-1-py3
- amazonlinux-2-3003-1-py3
- oraclelinux-8-3003-1-py3
- oraclelinux-7-3003-1-py3
- debian-11-3002-6-py3
- debian-10-3002-6-py3
- debian-9-3002-6-py3
- ubuntu-2004-3002-6-py3
- ubuntu-1804-3002-6-py3
- centos-8-3002-6-py3
- centos-7-3002-6-py3
- fedora-34-3002-6-py3
- fedora-33-3002-6-py3
- amazonlinux-2-3002-6-py3
- oraclelinux-8-3002-6-py3
- oraclelinux-7-3002-6-py3
- opensuse-leap-153-3002-2-py3
- opensuse-leap-152-3002-2-py3
- debian-10-3001-7-py3
- debian-9-3001-7-py3
- ubuntu-2004-3001-7-py3
- ubuntu-1804-3001-7-py3
- centos-8-3001-7-py3
- centos-7-3001-7-py3
- fedora-34-3001-7-py3
- fedora-33-3001-7-py3
- opensuse-leap-153-3001-7-py3
- opensuse-leap-152-3001-7-py3
- amazonlinux-2-3001-7-py3
- oraclelinux-8-3001-7-py3
- oraclelinux-7-3001-7-py3
- debian-10-3000-9-py3
- debian-9-3000-9-py3
- ubuntu-1804-3000-9-py3
- centos-8-3000-9-py3
- centos-7-3000-9-py3
- opensuse-leap-153-3000-9-py3
- opensuse-leap-152-3000-9-py3
- amazonlinux-2-3000-9-py3
- oraclelinux-8-3000-9-py3
- oraclelinux-7-3000-9-py3
- ubuntu-1804-3000-9-py2
provisioner:
state_top:
base:
'*':
- postgres._mapdata
- postgres
pillars:
top.sls:
base:
'*':
- postgres
- repo
pillars_from_files:
postgres.sls: test/salt/pillar/postgres.sls
repo.sls: test/salt/pillar/repo.sls
verifier:
inspec_tests:
- path: test/integration/repo
50 changes: 50 additions & 0 deletions test/integration/repo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# InSpec Profile: `repo`

This shows the implementation of the `repo` 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 repo
Summary
-------
Location: repo
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 repo
..

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 repo --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).
28 changes: 28 additions & 0 deletions test/integration/repo/inspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
name: repo
title: postgres formula
maintainer: SaltStack Formulas
license: Apache-2.0
# yamllint disable-line rule:line-length
summary: Verify that the postgres formula is setup and configured correctly (when installing from the upstream repo)
depends:
- name: share
path: test/integration/share
supports:
- platform-name: debian
- platform-name: ubuntu
- platform-name: centos
- platform-name: fedora
- platform-name: opensuse
- platform-name: suse
- platform-name: freebsd
- platform-name: openbsd
- platform-name: amazon
- platform-name: oracle
- platform-name: arch
- platform-name: gentoo
- platform-name: almalinux
- platform-name: rocky
- platform: windows

0 comments on commit a6c8197

Please sign in to comment.