Skip to content
layers

GitHub Action

actionshub-test-kitchen

2.1.0 Latest version

actionshub-test-kitchen

layers

actionshub-test-kitchen

Used to run Test Kitchen commands in your build pipeline

Installation

Copy and paste the following snippet into your .yml file.

              

- name: actionshub-test-kitchen

uses: actionshub/test-kitchen@2.1.0

Learn more about this action in actionshub/test-kitchen

Choose a version

test-kitchen

License

A Github Action to run Test Kitchen on your cookbooks

Note you will need to accept the Chef license, you can find more information at https://docs.chef.io/chef_license.html

Usage

This example shows how to use dokken with this action to test linux servers

name: kitchen

on: [pull_request]

jobs:
  dokken:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os:
          - centos-7
          - centos-8
        suite: ['default']
      fail-fast: false
    steps:
    - name: Check out code
      uses: actions/checkout@main
    - name: Install Chef
      uses: actionshub/chef-install@main
    - name: Test-Kitchen
      uses: actionshub/test-kitchen@main
      with:
        suite: ${{ matrix.suite }}
        os: ${{ matrix.os }}
      env:
        CHEF_LICENSE: accept-no-persist
        KITCHEN_LOCAL_YAML: kitchen.dokken.yml

This example shows you how to use Macos with this action This example uses seperate converge and verify actions

name: kitchen
on: [pull_request]
jobs:
  macos:
    needs: [mdl, yamllint, delivery]
    runs-on: macos-latest
    steps:
      - name: Check out code
        uses: actions/checkout@main
      - name: Install Chef
        uses: actionshub/chef-install@main
      - name: Kitchen Converge
        uses: actionshub/test-kitchen@main
        env:
          CHEF_LICENSE: accept-no-persist
          KITCHEN_LOCAL_YAML: kitchen.macos.yml
          TERM: xterm-256color
        with:
          suite: adoptopenjdk-14
          os: macos
          action: converge
      - name: Source Profile for JAVA_HOME
        run: |
          source /etc/profile
          echo "sourced profile for JAVA_HOME"
          echo "New JAVA home after Chef run is: ${JAVA_HOME}"
      - name: Kitchen Verify
        uses: actionshub/test-kitchen@master
        env:
          CHEF_LICENSE: accept-no-persist
          KITCHEN_LOCAL_YAML: kitchen.macos.yml
          TERM: xterm-256color
        with:
          suite: adoptopenjdk-14
          os: macos
          action: verify

Input

We support the following Input Variables

name default description
suite the name of the suite to run
os Which os to run on

Environment Variables

We recommend the following environment variables

name default description
CHEF_LICENSE Set to accept-no-persist to accept the chef licensing rules
KITCHEN_LOCAL_YAML Can be used to megre in another yaml file for test-kitchen, eg kitchen.dokken.yml