Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions Berksfile

This file was deleted.

16 changes: 16 additions & 0 deletions Policyfile.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 2 additions & 5 deletions chefignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ test/*
*/.hg/*
*/.svn/*

# Berkshelf #
#############
Berksfile
Berksfile.lock
# Dependency cache #
####################
cookbooks/*
tmp

Expand All @@ -98,7 +96,6 @@ Gemfile.lock

# Policyfile #
##############
Policyfile.rb
Policyfile.lock.json

# Documentation #
Expand Down
2 changes: 2 additions & 0 deletions kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require 'chefspec'
require 'chefspec/berkshelf'
require 'chefspec/policyfile'

RSpec.configure do |config|
config.formatter = :documentation
Expand Down
3 changes: 3 additions & 0 deletions test/cookbooks/test/recipes/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading