-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ng): improve ng.clean state and ci
- Loading branch information
1 parent
4a9579f
commit 7517599
Showing
14 changed files
with
378 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
|
||
include: | ||
# .containers.clean | ||
- .compose.clean | ||
# .compose.clean | ||
- .software.clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,26 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=sls | ||
{%- set tplroot = tpldir.split('/')[0] %} | ||
{%- from tplroot ~ "/map.jinja" import data as d with context %} | ||
{%- set sls_docker_software_clean = tplroot ~ '.software.clean' %} | ||
{%- set sls_compose_software_clean = tplroot ~ '.compose.software.clean' %} | ||
include: | ||
- .software.clean | ||
- {{ sls_compose_software_clean }} | ||
{%- for name, container in d.compose.ng.items() %} | ||
docker-compose-ng-{{ container.container_name|d(name) }}-stopped: | ||
docker_container.stopped: | ||
- name: {{ container.container_name|d(name) }} | ||
- onlyif: docker container inspect {{ container.container_name|d(name) }} | ||
- require_in: | ||
- sls: {{ sls_compose_software_clean }} | ||
docker-compose-ng-{{ container.image }}-{{ range(1,100) |random }}-absent: | ||
docker_image.absent: | ||
- name: {{ container.image }} | ||
- require_in: | ||
- sls: {{ sls_compose_software_clean }} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# InSpec Profile: `dockeronly` | ||
|
||
This shows the implementation of the `dockeronly` 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 dockeronly | ||
Summary | ||
------- | ||
Location: dockeronly | ||
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 dockeronly | ||
.. | ||
|
||
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 dockeronly --controls dockeronly | ||
. | ||
|
||
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# frozen_string_literal: true | ||
|
||
title 'docker archives profile' | ||
|
||
control 'docker archive' do | ||
impact 1.0 | ||
title 'should be installed' | ||
|
||
describe file('/usr/local/docker-19.03.9/bin') do | ||
it { should exist } | ||
it { should be_directory } | ||
its('type') { should eq :directory } | ||
end | ||
describe file('/usr/local/docker-19.03.9/bin/docker') do | ||
it { should exist } | ||
its('mode') { should cmp '0755' } | ||
end | ||
describe file('/usr/local/docker-19.03.9/bin/runc') do | ||
it { should exist } | ||
its('mode') { should cmp '0755' } | ||
end | ||
describe file('/usr/local/docker-19.03.9/bin/docker-proxy') do | ||
it { should exist } | ||
its('mode') { should cmp '0755' } | ||
end | ||
describe file('/usr/local/docker-19.03.9/bin/containerd') do | ||
it { should exist } | ||
its('mode') { should cmp '0755' } | ||
end | ||
describe file('/usr/local/docker-19.03.9/bin/ctr') do | ||
it { should exist } | ||
its('mode') { should cmp '0755' } | ||
end | ||
describe file('/usr/local/docker-19.03.9/bin/dockerd') do | ||
it { should exist } | ||
its('mode') { should cmp '0755' } | ||
end | ||
describe file('/usr/local/docker-19.03.9/bin/containerd-shim') do | ||
it { should exist } | ||
its('mode') { should cmp '0755' } | ||
end | ||
describe file('/usr/local/bin/docker') do | ||
it { should be_symlink } | ||
it { should be_file } | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/bin/runc') do | ||
it { should be_symlink } | ||
it { should be_file } | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/bin/docker-proxy') do | ||
it { should be_symlink } | ||
it { should be_file } | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/bin/containerd') do | ||
it { should be_symlink } | ||
it { should be_file } | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/bin/ctr') do | ||
it { should be_symlink } | ||
it { should be_file } | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/bin/dockerd') do | ||
it { should be_symlink } | ||
it { should be_file } | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/bin/containerd-shim') do | ||
it { should be_symlink } | ||
it { should be_file } | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/docker-compose-latest/bin') do | ||
it { should_not be_directory } | ||
end | ||
describe file('/usr/local/docker-compose-latest/bin/docker-compose') do | ||
it { should_not be_file } | ||
end | ||
describe file('/usr/local/bin/docker-compose') do | ||
it { should_not be_file } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'Docker configuration' do | ||
title 'should match desired lines' | ||
|
||
describe file('/etc/default/docker') do | ||
it { should be_file } | ||
its('owner') { should eq 'root' } | ||
its('group') { should eq 'root' } | ||
its('mode') { should cmp '0640' } | ||
its('content') { should include 'DOCKER_OPTS="-s btrfs --dns 8.8.8.8"' } | ||
its('content') { should include 'export http_proxy="http://172.17.42.1:3128"' } | ||
end | ||
describe file('/etc/docker/daemon.json') do | ||
it { should be_file } | ||
its('owner') { should eq 'root' } | ||
its('group') { should eq 'root' } | ||
its('mode') { should cmp '0640' } | ||
its('content') { should include '"insecure-registries": []' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'Docker service' do | ||
title 'should be running and enabled' | ||
|
||
describe service('docker') do | ||
it { should be_installed } | ||
it { should be_enabled } | ||
it { should be_running } unless %w[fedora suse].include? platform[:family] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
name: dockeronly | ||
title: docker formula | ||
maintainer: SaltStack Formulas | ||
license: Apache-2.0 | ||
summary: Verify that the docker formula is setup and configured correctly | ||
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 |
Oops, something went wrong.