Skip to content

Commit 8106d0f

Browse files
authored
fix: migrate to Policyfile (#36)
* fix: migrate to Policyfile * fix: install rake for Windows specs * fix: use installed Chef on exec Kitchen * fix: skip Kitchen Chef install * fix: avoid ChefSpec server sync
1 parent abbde5e commit 8106d0f

9 files changed

Lines changed: 52 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
lint-unit:
1111
uses: sous-chefs/.github/.github/workflows/lint-unit.yml@9.0.0
1212
with:
13+
gems: rake
1314
platform: windows-latest
1415
permissions:
1516
actions: write
@@ -30,7 +31,7 @@ jobs:
3031
- name: Check out code
3132
uses: actions/checkout@v7
3233
- name: Install Chef
33-
uses: actionshub/chef-install@6.0.0
34+
uses: sous-chefs/.github/.github/actions/install-workstation@8.0.4
3435
- name: test-kitchen
3536
uses: actionshub/test-kitchen@3.0.0
3637
env:

.github/workflows/copilot-setup-steps.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- name: Check out code
2020
uses: actions/checkout@v7
21-
- name: Install Chef
22-
uses: actionshub/chef-install@main
21+
- name: Install Cinc Workstation
22+
uses: sous-chefs/.github/.github/actions/install-workstation@8.0.4
2323
- name: Install cookbooks
24-
run: berks install
24+
run: chef install Policyfile.rb

AGENTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# AGENTS.md
2+
3+
## Cookbook Scope
4+
5+
The `notepadpp` cookbook installs Notepad++ on Windows using `windows_package`.
6+
7+
## Policyfile Migration Notes
8+
9+
* Dependency resolution is Policyfile-first. Do not reintroduce `Berksfile` or `berks install`.
10+
* The integration suite uses `minitest-handler`; there are no InSpec profiles in this cookbook.
11+
* `kitchen.exec.yml` intentionally uses the `dummy` verifier so the Windows exec run does not
12+
inherit an InSpec verifier with no profile.
13+
* `windows` is resolved from the sous-chefs GitHub repository to avoid Supermarket dependency
14+
resolution during CI.

Berksfile

Lines changed: 0 additions & 4 deletions
This file was deleted.

Policyfile.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
name 'notepadpp'
4+
5+
run_list 'notepadpp::default', 'minitest-handler::default'
6+
7+
named_run_list :default, 'notepadpp::default', 'minitest-handler::default'
8+
9+
cookbook 'notepadpp', path: '.'
10+
cookbook 'minitest-handler',
11+
git: 'https://github.com/b-dean/minitest-handler-cookbook.git',
12+
branch: 'chef-13-fix'
13+
cookbook 'chef_handler',
14+
git: 'https://github.com/chef-boneyard/chef_handler.git',
15+
branch: 'master'
16+
cookbook 'windows',
17+
git: 'https://github.com/chef-boneyard/windows.git',
18+
branch: 'master'

kitchen.exec.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ driver:
55
transport:
66
name: exec
77

8+
provisioner:
9+
product_name: cinc
10+
install_strategy: skip
11+
12+
verifier:
13+
name: dummy
14+
815
platforms:
916
- name: windows-latest
1017
- name: macos-latest

kitchen.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ driver:
33
name: vagrant
44

55
provisioner:
6-
name: chef_zero
6+
name: policyfile_zero
7+
policyfile: Policyfile.rb
78

89
platforms:
910
- name: windows-2019
@@ -15,6 +16,8 @@ suites:
1516
run_list:
1617
- recipe[notepadpp]
1718
- recipe[minitest-handler]
19+
provisioner:
20+
named_run_list: default
1821

1922
verifier:
20-
name: inspec
23+
name: dummy

spec/default_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe 'notepadpp::default' do
44
describe '32-bit Windows' do
55
let(:chef_run) do
6-
ChefSpec::ServerRunner.new do |node|
6+
ChefSpec::SoloRunner.new do |node|
77
node.automatic['kernel']['machine'] = 'i386'
88
end.converge(described_recipe)
99
end
@@ -18,7 +18,7 @@
1818

1919
describe '64-bit Windows' do
2020
let(:chef_run) do
21-
ChefSpec::ServerRunner.new do |node|
21+
ChefSpec::SoloRunner.new do |node|
2222
node.automatic['kernel']['machine'] = 'x86_64'
2323
end.converge(described_recipe)
2424
end

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require 'chefspec'
2-
require 'chefspec/berkshelf'
2+
require 'chefspec/policyfile'
33
require 'rspec/expectations'
44

55
RSpec.configure do |config|

0 commit comments

Comments
 (0)