Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more OS platforms for wazuh-chef Kitchen tests #456

Merged
merged 30 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1e4ddd4
Re-structre kitchen/wazuh-chef test folders/files
rshad Feb 3, 2020
92a3b18
Adapt run.sh to 1-suite model
rshad Feb 3, 2020
a62335d
Adapt aux. loading attributes cookbook name
rshad Feb 4, 2020
1f831ce
Remove Gemfile; Not needed
rshad Feb 4, 2020
b53e437
Rename recipe
rshad Feb 4, 2020
9ab0a87
Parameterize Berksfile + specify it for each suite
rshad Feb 4, 2020
a223367
Remove clean.sh; Not needed
rshad Feb 4, 2020
72c966a
Remove development.json; Replaced by the template
rshad Feb 4, 2020
66bb96a
Parameterize run.sh
rshad Feb 4, 2020
3207122
Parameterize kitchen.yml; Parameterize cookbooks path
rshad Feb 4, 2020
1304462
Run /sbin/init to start sytemd
rshad Feb 4, 2020
db3eb1a
Improve tests for manager and agent
rshad Feb 4, 2020
a8ba797
Add provisioning command to install apt-transport-https gnupg2
rshad Feb 4, 2020
6a10369
Remove filebeat installation from basic test suite
rshad Feb 4, 2020
9ae8475
Remove provisioning commands from run.sh
rshad Feb 4, 2020
c3e42c2
Add provision. cmds to kitchen.yml + auto run cmds dep. on OS
rshad Feb 4, 2020
a703978
Auto remove docker images created by Kitchen
rshad Feb 5, 2020
900a613
Change tests folder name from tests to test
rshad Feb 5, 2020
e5ba47a
Remove filebeat attributes from testing environment files
rshad Feb 5, 2020
8436fc0
Adapt Dockerfile to use our fork for kitchen-docker
rshad Feb 5, 2020
688788b
Add support to Ubuntu 14. Avoid running some tests in such case
rshad Feb 6, 2020
c7fad6c
Add support for Ubuntu 14.04
rshad Feb 6, 2020
0c7a414
Parameterize run_command and use 1 entry platform
rshad Feb 7, 2020
c75c191
Replace hostname attribute in case of AmazonLinux2
rshad Feb 7, 2020
df31315
Fix ktichen-docker repo link
rshad Feb 7, 2020
98dd94c
Disable cache for Docker
rshad Feb 10, 2020
34ae967
Add kitchen-docker gem with fixes
rshad Feb 10, 2020
4702b74
Add Gemfile
rshad Feb 10, 2020
d3e7c15
Adapt Dockerfile to the new Gemfile path
rshad Feb 10, 2020
0f0dc3c
Remove redundat command and clean APT list
rshad Feb 10, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions kitchen/kitchen-docker/.kitchen.windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<% # Make sure the local copy of the driver is loaded %>
<% lib = File.expand_path('../lib', __FILE__) %>
<% $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) %>
---
driver:
name: docker
provision_command:
- powershell -ExecutionPolicy Bypass -NoLogo -Command . { iwr -useb https://omnitruck.chef.io/install.ps1 } ^| iex; install
- powershell -Command $path=$env:Path + ';c:\opscode\chef\embedded\bin'; Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\' -Name Path -Value $path

transport:
name: docker
socket: tcp://localhost:2375

provisioner:
name: dummy

platforms:
- name: windows
driver_config:
image: mcr.microsoft.com/windows/servercore:1803
platform: windows

suites:
- name: default
- name: context
driver:
build_context: false
- name: inspec
driver:
provision_command: echo 1
verifier:
name: inspec
68 changes: 68 additions & 0 deletions kitchen/kitchen-docker/.kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<% # Make sure the local copy of the driver is loaded %>
<% lib = File.expand_path('../lib', __FILE__) %>
<% $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) %>
---
driver:
name: docker
provision_command: curl -L https://www.chef.io/chef/install.sh | bash

transport:
name: docker

provisioner:
name: dummy

platforms:
- name: amazonlinux-2
- name: ubuntu-16.04
- name: ubuntu-18.04
- name: fedora-latest
driver:
provision_command:
- yum install libxcrypt-compat.x86_64 -y
- curl -L https://www.chef.io/chef/install.sh | bash
- name: centos-6
- name: centos-7
- name: oraclelinux-6
- name: oraclelinux-7
- name: debian-8
- name: debian-9
- name: opensuse-42.3
driver:
image: opensuse/leap:42.3
- name: opensuse/leap-42
# - name: arch
# driver:
# image: base/archlinux
# provision_command: true
- name: unknown
driver:
image: ubuntu:16.04
platform: ubuntu
- name: dockerfile
driver:
username: dockerfile
password: dockerfile
dockerfile: test/Dockerfile
run_command: /sbin/init

suites:
- name: default
excludes: [arch]
- name: context
excludes: [arch]
driver:
build_context: false
- name: capabilities
includes: [debian-8,debian-9,ubuntu-16.04,ubuntu-18.04]
driver:
provision_command:
- curl -L https://www.chef.io/chef/install.sh | bash
- apt-get install -y net-tools
cap_drop:
- NET_ADMIN
- name: inspec
driver:
provision_command: true
verifier:
name: inspec
4 changes: 4 additions & 0 deletions kitchen/kitchen-docker/.tailor
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Tailor.config do |config|
config.formatters "text"
config.file_set 'lib/**/*.rb'
end
52 changes: 52 additions & 0 deletions kitchen/kitchen-docker/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
matrix:
include:
- os: linux
rvm: 2.4.5
dist: xenial
language: ruby
cache: bundler
script:
- bundle exec docker version
- bundle exec kitchen --version
- bundle exec rake spec
- bundle exec kitchen test -d always
- os: linux
rvm: 2.5.4
dist: xenial
language: ruby
cache: bundler
script:
- bundle exec docker version
- bundle exec kitchen --version
- bundle exec rake spec
- bundle exec kitchen test -d always
- os: linux
rvm: 2.6.2
dist: xenial
language: ruby
cache: bundler
script:
- bundle exec docker version
- bundle exec kitchen --version
- bundle exec rake spec
- bundle exec kitchen test -d always
- os: windows
language: bash
install:
- choco install mingw
- choco install msys2
- ridk.cmd exec pacman -S --noconfirm --needed base-devel mingw-w64-x86_64-toolchain
script:
- taskkill -IM "gpg-agent.exe" -F
- powershell -ExecutionPolicy Bypass -NoLogo -File docker.ps1
- export KITCHEN_YAML=.kitchen.windows.yml
- ruby -v
- gem install bundler
- bundle install
- bundle exec docker version
- bundle exec kitchen --version
- bundle exec rake spec
- bundle exec kitchen test -d always

services:
- docker
104 changes: 104 additions & 0 deletions kitchen/kitchen-docker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Kitchen-Docker Changelog

## 2.9.0 - Mar 15, 2019

* Add automatic OS detection for amazonlinux, opensuse/leap, and opensuse/tumbleweed
* On Fedora containers uses dnf to setup the OS not yum

## 2.8.0 - Jan 18, 2019

* Add new config option `use_internal_docker_network`, which allows running Docker within Docker. See readme for usage details.
* Resolve errors while loading libraries on archlinux
* Fix failures on Ubuntu 18.04
* Check if image exists before attempting to remove it so we don't fail
* Add oraclelinux platform support
* Prevent `uninitialized constant Kitchen::Driver::Docker::Base64` error by requiring `base64`

## 2.7.0

* Support for SUSE-based container images.
* Improved support for build context shipping.
* Changed `use_sudo` to default to `false` in keeping with modern Docker usage.

## 2.6.0

* Set container name with information from the run so you can identify them
later on.
* Upgrade to new driver base class structure.

## 2.5.0

* [#209](https://github.com/portertech/kitchen-docker/pulls/209) Fix usage with Kitchen rake tasks.
* Add `run_options` and `build_options` configuration.
* [#195](https://github.com/portertech/kitchen-docker/pulls/195) Fix Arch Linux support.
* Fix shell escaping for build paths and SSH keys.

## 2.4.0

* [#148](https://github.com/portertech/kitchen-docker/issues/148) Restored support for older versions of Ruby.
* [#149](https://github.com/portertech/kitchen-docker/pulls/149) Handle connecting to a container directly as root.
* [#154](https://github.com/portertech/kitchen-docker/pulls/154) Improve container caching by reordering the build steps.
* [#176](https://github.com/portertech/kitchen-docker/pulls/176) Expose proxy environment variables to the container automatically.
* [#192](https://github.com/portertech/kitchen-docker/pulls/192) Set `$container=docker` for CentOS images.
* [#196](https://github.com/portertech/kitchen-docker/pulls/196) Mutex SSH key generation for use with `kitchen -c`.
* [#192](https://github.com/portertech/kitchen-docker/pulls/192) Don't wait when stopping a container.

## 2.3.0

* `build_context` option (boolean) to enable/disable sending the build
context to Docker.

## 2.2.0

* Use a temporary file for each suite instance Docker container
Dockerfile, instead of passing their contents via STDIN. This allows for
the use of commands like ADD and COPY. **Users must now use Docker >= 1.5.0**

* Passwordless suite instance Docker container login (SSH), using a
generated key pair.

* Support for sharing a host device with suite instance Docker containers.

* README YAML highlighting.

## 2.1.0

* Use `NUL` instead of `/dev/null` on Windows for output redirection

## 2.0.0

* Use Docker `top` and `port` instead of `inspect`

* Don't create the kitchen user if it already exists

* Docker container capabilities options: cap_add, cap_drop

* Docker security profile option (SELinux/AppArmor): security_opt

* wait_for_sshd option (boolean)

* Create `/etc/sudoers.d` if missing

* Fixed option deprecation warnings, require Docker >= 1.2

## 1.7.0

* Ensure a container id is set before attempting to inspect a container

## 1.6.0

* `publish_all` option to publish all ports to the host interface

* `instance_name` option to name the Docker container

* `links` option to link suite instance Docker containers

* `socket` option will now default to ENV `DOCKER_HOST` if set

* Fixed verify dependencies output redirection

* Added `fedora` to platform names

* Support for `gentoo` and `gentoo-paludis` platforms

* Adding sudo rule to `/etc/sudoers.d/#{username}` in addition to `/etc/sudoers`
3 changes: 3 additions & 0 deletions kitchen/kitchen-docker/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gemspec
Loading