From 9fe259093b1cb7ab9fe2c2c5657cd4a85d5af3c9 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 1 Jul 2026 23:04:32 +0100 Subject: [PATCH 1/3] chore: migrate to Policyfile # Conflicts: # .github/workflows/ci.yml # .github/workflows/conventional-commits.yml # .github/workflows/copilot-setup-steps.yml # .github/workflows/prevent-file-change.yml # .github/workflows/release.yml --- .github/copilot-instructions.md | 10 +++++----- Berksfile | 7 ------- Policyfile.rb | 16 ++++++++++++++++ chefignore | 7 ++----- spec/spec_helper.rb | 2 +- 5 files changed, 24 insertions(+), 18 deletions(-) delete mode 100644 Berksfile create mode 100644 Policyfile.rb diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index e1084932..5aedf97c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -18,16 +18,16 @@ - `libraries/` - Library helpers to assist with the cookbook. May contain multiple files depending on complexity of the cookbook. - `templates/` - ERB templates that may be used in the cookbook - `files/` - files that may be used in the cookbook -- `metadata.rb`, `Berksfile` - Cookbook metadata and dependencies +- `metadata.rb`, `Policyfile.rb` - Cookbook metadata and dependencies ## Build and Test System ### Environment Setup -**MANDATORY:** Install Chef Workstation first - provides chef, berks, cookstyle, kitchen tools. +**MANDATORY:** Install Chef Workstation first - provides chef, cookstyle, kitchen tools. ### Essential Commands (strict order) ```bash -berks install # Install dependencies (always first) +chef install Policyfile.rb # Install dependencies (always first) cookstyle # Ruby/Chef linting yamllint . # YAML linting markdownlint-cli2 '**/*.md' # Markdown linting @@ -42,7 +42,7 @@ chef exec rspec # Unit tests (ChefSpec) - **Full CI Runtime:** 30+ minutes for complete matrix ### Common Issues and Solutions -- **Always run `berks install` first** - most failures are dependency-related +- **Always run `chef install Policyfile.rb` first** - most failures are dependency-related - **Docker must be running** for kitchen tests - **Chef Workstation required** - no workarounds, no alternatives - **Test data bags needed** (optional for some cookbooks) in `test/integration/data_bags/` for convergence @@ -88,7 +88,7 @@ These instructions are validated for Sous Chefs cookbooks. **Do not search for b **Error Resolution Checklist:** 1. Verify Chef Workstation installation -2. Confirm `berks install` completed successfully +2. Confirm `chef install Policyfile.rb` completed successfully 3. Ensure Docker is running for integration tests 4. Check for missing test data dependencies diff --git a/Berksfile b/Berksfile deleted file mode 100644 index 5a7274b5..00000000 --- a/Berksfile +++ /dev/null @@ -1,7 +0,0 @@ -source 'https://supermarket.chef.io' - -metadata - -group :integration do - cookbook 'test', path: 'test/cookbooks/test' -end diff --git a/Policyfile.rb b/Policyfile.rb new file mode 100644 index 00000000..ca59e290 --- /dev/null +++ b/Policyfile.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +name 'git' + +default_source :supermarket + +run_list 'test::default' + +cookbook 'git', path: '.' +cookbook 'test', path: './test/cookbooks/test' + +Dir.children('./test/cookbooks/test/recipes').grep(/\.rb\z/).sort.each do |recipe| + recipe_name = File.basename(recipe, '.rb') + + named_run_list recipe_name.to_sym, "test::#{recipe_name}" +end diff --git a/chefignore b/chefignore index a27b0b25..e824a7fe 100644 --- a/chefignore +++ b/chefignore @@ -83,10 +83,8 @@ test/* */.hg/* */.svn/* -# Berkshelf # -############# -Berksfile -Berksfile.lock +# Dependency cache # +#################### cookbooks/* tmp @@ -98,7 +96,6 @@ Gemfile.lock # Policyfile # ############## -Policyfile.rb Policyfile.lock.json # Documentation # diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ee3a7ca3..09d57921 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'chefspec' -require 'chefspec/berkshelf' +require 'chefspec/policyfile' RSpec.configure do |config| config.formatter = :documentation From 6e3dc13042615074c7a81eaf017d5e6c977537bc Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 1 Jul 2026 23:32:54 +0100 Subject: [PATCH 2/3] ci: use Policyfile for Copilot setup --- .github/workflows/copilot-setup-steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 279e63ce..57ea9138 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -21,4 +21,4 @@ jobs: - name: Install Chef uses: sous-chefs/.github/.github/actions/install-workstation@8.0.2 - name: Install cookbooks - run: berks install + run: chef install Policyfile.rb From f10175ac655cdf184e7aa92fed7f94bf126b3179 Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Wed, 1 Jul 2026 23:44:14 +0100 Subject: [PATCH 3/3] fix: map Kitchen suites to Policyfile run lists --- kitchen.yml | 2 ++ test/cookbooks/test/recipes/source.rb | 3 +++ 2 files changed, 5 insertions(+) diff --git a/kitchen.yml b/kitchen.yml index 7ed143cf..3588793f 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -49,8 +49,10 @@ x-verifiers: suites: - name: default + named_run_list: default run_list: *default_run_list verifier: *default_verifier - name: source + named_run_list: source run_list: *source_run_list verifier: *source_verifier diff --git a/test/cookbooks/test/recipes/source.rb b/test/cookbooks/test/recipes/source.rb index 997532ba..0bc61506 100644 --- a/test/cookbooks/test/recipes/source.rb +++ b/test/cookbooks/test/recipes/source.rb @@ -2,6 +2,9 @@ apt_update 'update apt cache' if platform_family?('debian') +package 'ca-certificates' + git_client 'source' do + source_url 'http://mirrors.edge.kernel.org/pub/software/scm/git/git-2.54.0.tar.gz' action :install_from_source end