Skip to content

Commit

Permalink
Move install script here
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Webb <[email protected]>
  • Loading branch information
damacus committed Jan 21, 2025
1 parent 5706dcd commit 949f572
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 16 deletions.
46 changes: 46 additions & 0 deletions .github/actions/chef-install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Install Chef'
description: 'Installs Chef products on Windows or Linux/macOS'

inputs:
channel:
description: 'Chef download channel'
required: false
default: 'stable'
project:
description: 'Chef project to download'
required: false
default: 'chef-workstation'
version:
description: 'Version of Chef product'
required: false
license-id:
description: 'Chef license ID'
required: true
windows-path:
description: 'Windows installation path'
required: false
default: 'C:\opscode'

runs:
using: "composite"
steps:
- name: Install Chef on Linux/macOS
if: runner.os != 'Windows'
shell: bash
run: |
curl -L https://chefdownload-commercial.chef.io/install.sh?license_id=${{ inputs.license-id }} -o chefDownload.sh
sudo chmod +x chefDownload.sh
sudo ./chefDownload.sh -c ${{ inputs.channel }} -P ${{ inputs.project }} ${{ inputs.version && format('-v {0}', inputs.version) }}
rm -f chefDownload.sh
- name: Install Chef on Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
. { iwr -useb https://chefdownload-commercial.chef.io/install.ps1?license_id=${{ inputs.license-id }} } | iex;
install -channel ${{ inputs.channel }} -project ${{ inputs.project }} ${{ inputs.version && format('-version {0}', inputs.version) }}
- name: Add Windows Chef Path
if: runner.os == 'Windows'
shell: pwsh
run: echo "${{ inputs.windows-path }}\bin" >> $env:GITHUB_PATH
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,43 @@ inputs:
chef-version:
description: 'Chef version to use'
required: false
default: 'latest'
chef-license:
description: 'Chef license acceptance'
required: false
default: 'accept-no-persist'
default: 'current'
license-id:
description: 'Chef license ID'
required: true
kitchen-command:
description: 'Kitchen command to run (test, verify, etc)'
required: false
default: 'test'
channel:
description: 'Chef download channel'
required: false
default: 'stable'
project:
description: 'Chef project to download'
required: false
default: 'chef-workstation'
version:
description: 'Version of Chef product'
required: false
windows-path:
description: 'Windows installation path'
required: false
default: 'C:\opscode'

runs:
using: "composite"
steps:
- name: Install Chef
uses: actionshub/chef-install@3.0.1
uses: ./.github/actions/chef-install
with:
version: ${{ inputs.chef-version }}
license-id: ${{ inputs.license-id }}

- name: Run Test Kitchen
shell: bash
run:
kitchen ${{ inputs.kitchen-command }} ${{ inputs.suite }}-${{ inputs.os }}
run: kitchen ${{ inputs.kitchen-command }} ${{ inputs.suite }}-${{ inputs.os }}
env:
CHEF_LICENSE: ${{ inputs.chef-license }}
CHEF_LICENSE: ${{ inputs.license-id }}
KITCHEN_LOCAL_YAML: ${{ inputs.kitchen-yaml }}
KITCHEN_YAML: ${{ inputs.kitchen-yaml }}
File renamed without changes.
16 changes: 9 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
kitchen-yaml: kitchen.dokken.yml
chef-version: latest
chef-license: accept-no-persist
license-id: ${{ secrets.CHEF_LICENSE_KEY }}

integration-swarm:
needs: lint-unit
Expand All @@ -63,20 +64,21 @@ jobs:
os: ["ubuntu-2204"]
suite: ["swarm"]
fail-fast: false

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup VirtualBox & Vagrant
uses: ./.github/actions/virtualbox-setup

- name: Run Kitchen Tests
uses: ./.github/actions/test-kitchen
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
kitchen-yaml: kitchen.yml
chef-version: latest
chef-license: accept-no-persist
license-id: ${{ secrets.CHEF_LICENSE_KEY }}

integration-smoke:
needs: lint-unit
Expand All @@ -99,15 +101,15 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup VirtualBox & Vagrant
uses: ./.github/workflows/virtualbox-setup.yml
- name: Install Chef
uses: actionshub/[email protected]
uses: ./.github/actions/virtualbox-setup

- name: Test Kitchen
uses: ./.github/actions/test-kitchen
with:
suite: ${{ matrix.suite }}
os: ${{ matrix.os }}
kitchen-yaml: kitchen.yml
chef-version: latest
chef-license: accept-no-persist
license-id: ${{ secrets.CHEF_LICENSE_KEY }}

0 comments on commit 949f572

Please sign in to comment.