Skip to content

Commit

Permalink
Refactor cookbook
Browse files Browse the repository at this point in the history
  • Loading branch information
infertux committed May 30, 2024
1 parent abcb7d7 commit 5f35124
Show file tree
Hide file tree
Showing 20 changed files with 868 additions and 380 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
kitchen:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform: [ "default-debian-11", "default-debian-12", "default-ubuntu-2204", "default-ubuntu-2404" ]
recipe: [ "binary", "source" ]
variant: [ "core" ]
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby # latest stable release
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run Test Kitchen platform ${{ matrix.platform }}
run: env KITCHEN_RECIPE=${{ matrix.recipe }} KITCHEN_VARIANT=${{ matrix.variant }} bundle exec rake kitchen:${{ matrix.platform }}
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ruby # latest stable release
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run style checks
run: bundle exec rake style:ruby
57 changes: 48 additions & 9 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,60 @@
---
driver:
name: docker
name: dokken
privileged: true # allows systemd services to start
chef_image: cincproject/cinc
chef_version: <%= ENV.fetch('CHEF_VERSION', 18) %>

provisioner:
name: chef_zero
product_name: chef
product_version: <%= ENV["CHEF_VERSION"] || '14' %>
name: dokken
product_name: cinc
chef_binary: /opt/cinc/bin/cinc-client
deprecations_as_errors: true
enforce_idempotency: true
multiple_converge: 2

transport:
name: dokken

verifier:
name: inspec

platforms:
- name: <%= ENV["KITCHEN_PLATFORM"] %>
driver_config:
use_sudo: false
# @see https://github.com/chef-cookbooks/testing_examples/blob/main/kitchen.dokken.yml
# @see https://hub.docker.com/u/dokken
- name: debian-11
driver:
image: dokken/debian-11
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get upgrade -y
- name: debian-12
driver:
image: dokken/debian-12
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get upgrade -y
- name: ubuntu-2204
driver:
image: dokken/ubuntu-22.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get upgrade -y
- name: ubuntu-2404
driver:
image: dokken/ubuntu-24.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get upgrade -y

suites:
- name: default
run_list:
- recipe[bitcoin::<%= ENV["KITCHEN_RECIPE"] %>]
- recipe[bitcoin::<%= ENV.fetch('KITCHEN_RECIPE', 'binary') %>]
attributes:
bitcoin:
variant: <%= ENV["KITCHEN_VARIANT"] %>
variant: <%= ENV.fetch('KITCHEN_VARIANT', 'core') %>
34 changes: 0 additions & 34 deletions .travis.yml

This file was deleted.

17 changes: 6 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
source 'https://rubygems.org'

group :development do
gem 'berkshelf'
gem 'chef', '~> 14'
gem 'rake'
end

group :style do
gem 'cookstyle'
gem 'foodcritic'
end
gem 'rake'

group :test do
gem 'kitchen-docker'
gem 'berkshelf' # needed by test-kitchen
gem 'chef', '~> 18'
gem 'cookstyle'
gem 'kitchen-dokken'
gem 'kitchen-inspec'
gem 'test-kitchen'
end
Loading

0 comments on commit 5f35124

Please sign in to comment.