Skip to content

Commit

Permalink
ci(arch/suse): get travis ci passing
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Oct 18, 2020
1 parent b282180 commit 415a8b7
Show file tree
Hide file tree
Showing 8 changed files with 467 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
# - env: INSTANCE=default-amazonlinux-2-2019-2-py3
# - env: INSTANCE=default-centos-6-2019-2-py2
# - env: INSTANCE=default-amazonlinux-1-2019-2-py2
- env: INSTANCE=default-arch-base-latest-2019-2-py2
- env: INSTANCE=arch-arch-base-latest-2019-2-py2

## Define the release stage that runs `semantic-release`
- stage: 'release'
Expand Down
17 changes: 17 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,20 @@ suites:
verifier:
inspec_tests:
- path: test/integration/redhat
- name: arch
provisioner:
state_top:
base:
'*':
# kubernetes.clean
- kubernetes
pillars:
top.sls:
base:
'*':
- kubernetes
pillars_from_files:
kubernetes.sls: test/salt/pillar/default.sls
verifier:
inspec_tests:
- path: test/integration/arch
35 changes: 21 additions & 14 deletions kubernetes/devlibs/archive/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import data as d with context %}
{%- set formula = d.formula %}
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
{%- if 'wanted' in d.devlibs and d.devlibs.wanted %}
{%- for tool in d.devlibs.wanted|unique %}
{%- if 'pkg' in d.devlibs and tool in d.devlibs['pkg'] and d.devlibs['pkg'][tool] %}
{%- set p = d.devlibs.pkg[tool] %}
{%- if p['use_upstream'] == 'archive' and 'archive' in p %}
{%- if 'wanted' in d.devlibs and d.devlibs.wanted %}
{%- if grains.os != 'Windows' %}
{{ formula }}-devlibs-pkg-deps-install:
pkg.installed:
- names: {{ d.pkg.deps|json }}
{%- endif %}
{%- for tool in d.devlibs.wanted|unique %}
{%- if 'pkg' in d.devlibs and tool in d.devlibs['pkg'] and d.devlibs['pkg'][tool] %}
{%- set p = d.devlibs.pkg[tool] %}
{%- if p['use_upstream'] == 'archive' and 'archive' in p %}
{{ formula }}-devlibs-archive-{{ tool }}-install:
file.directory:
Expand All @@ -20,30 +26,31 @@
- makedirs: True
- require_in:
- archive: {{ formula }}-devlibs-archive-{{ tool }}-install
{%- if grains.os != 'Windows' %}
{%- if grains.os != 'Windows' %}
- require:
- pkg: {{ formula }}-devlibs-pkg-deps-install
- mode: 755
- user: {{ d.identity.rootuser }}
- group: {{ d.identity.rootgroup }}
- recurse:
- user
- group
- mode
{%- endif %}
{%- endif %}
archive.extracted:
{{- format_kwargs(p['archive']) }}
- retry: {{ d.retry_option }}
- enforce_toplevel: false
- trim_output: true
{%- if grains.os != 'Windows' %}
{%- if grains.os != 'Windows' %}
- user: {{ d.identity.rootuser }}
- group: {{ d.identity.rootgroup }}
- recurse:
- user
- group
- mode
{%- endif %}
{%- endif %}
{% endif %}
{% endif %}
{% endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}
{%- endif %}
45 changes: 26 additions & 19 deletions kubernetes/devtools/archive/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import data as d with context %}
{%- set formula = d.formula %}
{%- from tplroot ~ "/files/macros.jinja" import format_kwargs with context %}
{%- if 'wanted' in d.devtools and d.devtools.wanted %}
{%- for tool in d.devtools.wanted|unique %}
{%- if 'pkg' in d.devtools and tool in d.devtools['pkg'] and d.devtools['pkg'][tool] %}
{%- set p = d.devtools.pkg[tool] %}
{%- if p['use_upstream'] == 'archive' and 'archive' in p %}
{%- if 'wanted' in d.devtools and d.devtools.wanted %}
{%- if grains.os != 'Windows' %}
{{ formula }}-devtools-pkg-deps-install:
pkg.installed:
- names: {{ d.pkg.deps|json }}
{%- endif %}
{%- for tool in d.devtools.wanted|unique %}
{%- if 'pkg' in d.devtools and tool in d.devtools['pkg'] and d.devtools['pkg'][tool] %}
{%- set p = d.devtools.pkg[tool] %}
{%- if p['use_upstream'] == 'archive' and 'archive' in p %}
{{ formula }}-devtools-archive-{{ tool }}-install:
file.directory:
Expand All @@ -20,29 +26,31 @@
- makedirs: True
- require_in:
- archive: {{ formula }}-devtools-archive-{{ tool }}-install
{%- if grains.os != 'Windows' %}
{%- if grains.os != 'Windows' %}
- require:
- pkg: {{ formula }}-devtools-pkg-deps-install
- mode: 755
- user: {{ d.identity.rootuser }}
- group: {{ d.identity.rootgroup }}
- recurse:
- user
- group
- mode
{%- endif %}
{%- endif %}
archive.extracted:
{{- format_kwargs(d.devtools['pkg'][tool]['archive']) }}
- retry: {{ d.retry_option }}
- enforce_toplevel: false
- trim_output: true
{%- if grains.os != 'Windows' %}
{%- if grains.os != 'Windows' %}
- user: {{ d.identity.rootuser }}
- group: {{ d.identity.rootgroup }}
- recurse:
- user
- group
{%- endif %}
{%- if (d.linux.altpriority|int == 0 and grains.os != 'Windows') or grains.os_family in ('Arch', 'MacOS') %}
{%- for cmd in d.devtools['pkg'][tool]['commands']|unique %}
{%- endif %}
{%- if (d.linux.altpriority|int == 0 and grains.os != 'Windows') or grains.os_family in ('Arch', 'MacOS') %}
{%- for cmd in d.devtools['pkg'][tool]['commands']|unique %}
{{ formula }}-devtools-archive-{{ tool }}-install-symlink-{{ cmd }}:
file.symlink:
Expand All @@ -54,10 +62,9 @@
- require:
- archive: {{ formula }}-devtools-archive-{{ tool }}-install
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{%- endfor %}
{%- endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{%- endfor %}
{%- endif %}
50 changes: 50 additions & 0 deletions test/integration/arch/README.md
Original file line number Diff line number Diff line change
@@ -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).
Loading

0 comments on commit 415a8b7

Please sign in to comment.