You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: migrate to custom resources
Replace the legacy recipe and attribute model with custom resources for WMF, WinRM, DSC, and LCM management. Align CI and kitchen config with the current Sous-Chefs workflow shape, refresh documentation, and add focused resource/unit and integration coverage for the migrated surface.
* test: relax Windows path assertion
* ci: fix reusable workflow startup
* ci: use cinc in kitchen configs
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+23-24Lines changed: 23 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,19 @@
2
2
3
3
## Repository Overview
4
4
5
-
**Chef cookbook** for managing software installation and configuration. Part of the Sous Chefs cookbook ecosystem.
5
+
**Chef cookbook** for managing legacy Windows Management Framework installation and related
6
+
WinRM / DSC configuration through custom resources. Part of the Sous Chefs cookbook ecosystem.
6
7
7
-
**Key Facts:** Ruby-based, Chef >= 16 required, supports various OS platforms (check metadata.rb, kitchen.yml and .github/workflows/ci.yml for which platforms to specifically test)
8
+
**Key Facts:** Ruby-based, Chef >= 15.3 required, Windows-focused, with CI centered on
9
+
Windows Server 2019 (check `metadata.rb`, `kitchen.yml`, and `.github/workflows/ci.yml`).
8
10
9
11
## Project Structure
10
12
11
13
**Critical Paths:**
12
-
-`recipes/` - Chef recipes for cookbook functionality (if this is a recipe-driven cookbook)
13
-
-`resources/` - Custom Chef resources with properties and actions (if this is a resource-driven cookbook)
14
+
-`resources/` - Custom Chef resources with properties and actions
14
15
-`spec/` - ChefSpec unit tests
15
-
-`test/integration/` - InSpec integration tests (tests all platforms supported)
16
-
-`test/cookbooks/` or `test/fixtures/` - Example cookbooks used during testing that show good examples of custom resource usage
17
-
-`attributes/` - Configuration for recipe driven cookbooks (not applicable to resource cookbooks)
16
+
-`test/integration/` - InSpec integration tests
17
+
-`test/cookbooks/` - Example cookbook used during testing that shows custom resource usage
18
18
-`libraries/` - Library helpers to assist with the cookbook. May contain multiple files depending on complexity of the cookbook.
19
19
-`templates/` - ERB templates that may be used in the cookbook
20
20
-`files/` - files that may be used in the cookbook
@@ -32,25 +32,24 @@ cookstyle # Ruby/Chef linting
32
32
yamllint .# YAML linting
33
33
markdownlint-cli2 '**/*.md'# Markdown linting
34
34
chef exec rspec # Unit tests (ChefSpec)
35
-
#Integration tests will be done via the ci.yml action. Do not run these. Only check the action logs for issues after CI is done running.
35
+
#Local integration can be exercised with kitchen.yml when a Windows Vagrant environment is available.
36
36
```
37
37
38
38
### Critical Testing Details
39
-
-**Kitchen Matrix:**Multiple OS platforms × software versions (check kitchen.yml for specific combinations)
40
-
-**Docker Required:**Integration tests use Dokken driver
1. Edit resources/libraries/templates/files as needed
54
53
2. Update corresponding ChefSpec tests in `spec/`
55
54
3. Also update any InSpec tests under test/integration
56
55
4. Ensure cookstyle and rspec passes at least. You may run `cookstyle -a` to automatically fix issues if needed.
@@ -71,16 +70,16 @@ chef exec rspec # Unit tests (ChefSpec)
71
70
- Include comprehensive ChefSpec tests for all actions
72
71
- Follow Chef resource DSL patterns
73
72
74
-
### Recipe Conventions
75
-
-Use `include_recipe`for modularity
76
-
- Handle platforms with `platform_family?` conditionals
77
-
-Use encrypted data bags for secrets (passwords, SSL certs)
78
-
-Leverage attributes for configuration with defaults
73
+
### Resource Conventions
74
+
-Prefer custom resources over recipes for cookbook behavior
75
+
- Handle Windows platform/version branching inside the resource actions or helpers
76
+
-Keep reusable installer and OS-matrix logic in `libraries/`
77
+
-Document each public resource under `documentation/`
79
78
80
79
### Testing Approach
81
-
-**ChefSpec (Unit):** Mock dependencies, test recipe logic in `spec/`
82
-
-**InSpec (Integration):** Verify actual system state in `test/integration/inspec/` - InSpec files should contain proper inspec.yml and controls directories so that it could be used by other suites more easily.
83
-
-One test file per recipe, use standard Chef testing patterns
80
+
-**ChefSpec (Unit):** Mock dependencies and step into custom resources in `spec/unit/`
81
+
-**InSpec (Integration):** Verify actual system state in `test/integration/default/`
82
+
-Keep the test cookbook focused on exercising the public resources
84
83
85
84
## Trust These Instructions
86
85
@@ -89,7 +88,7 @@ These instructions are validated for Sous Chefs cookbooks. **Do not search for b
89
88
**Error Resolution Checklist:**
90
89
1. Verify Chef Workstation installation
91
90
2. Confirm `berks install` completed successfully
92
-
3. Ensure Docker is running for integration tests
91
+
3. Ensure the local Windows Vagrant provider can boot and expose WinRM before blaming cookbook code
93
92
4. Check for missing test data dependencies
94
93
95
94
The CI system uses these exact commands - following them matches CI behavior precisely.
- Not applicable. This cookbook manages Microsoft Windows Management Framework installers on Windows only.
8
+
9
+
### DNF/YUM (RHEL family)
10
+
11
+
- Not applicable. This cookbook manages Microsoft Windows Management Framework installers on Windows only.
12
+
13
+
### Windows
14
+
15
+
- Windows PowerShell 2.0 is enabled through built-in Windows features on Windows Server 2008 R2 / Windows 7 and Windows Server 2012 / Windows 8.
16
+
- Windows Management Framework 3.0 packages are published for Windows 7 SP1 and Windows Server 2008 R2 SP1 only.
17
+
- Windows Management Framework 4.0 packages are published for Windows 7 SP1, Windows Server 2008 R2 SP1, and Windows Server 2012.
18
+
- Windows Management Framework 5.1 packages are published for Windows 7 SP1 / Windows Server 2008 R2 SP1, Windows Server 2012, and Windows Server 2012 R2 / Windows 8.1.
19
+
- Windows Server 2016 and newer ship with Windows PowerShell 5.1, so the cookbook treats WMF 5.1 as built in on those releases.
20
+
21
+
## Architecture Limitations
22
+
23
+
- WMF 3.0 and WMF 4.0 provide both `x86` and `x64` packages for Windows 7 SP1 / Windows Server 2008 R2 SP1.
24
+
- WMF 4.0 on Windows Server 2012 is `x64` only.
25
+
- WMF 5.1 on Windows Server 2012 is `x64` only.
26
+
- WMF 5.1 on Windows 8.1 / Windows Server 2012 R2 is available for `x86` and `x64`.
27
+
28
+
## Source/Compiled Installation
29
+
30
+
- Not applicable. Microsoft distributes WMF through signed Windows features, `.msu`, and `.zip` archives.
31
+
- WMF 3.0 requires .NET Framework 4.0.
32
+
- WMF 4.0 and WMF 5.1 require .NET Framework 4.5 or newer.
33
+
34
+
## Known Issues
35
+
36
+
- WMF 2.0, 3.0, and 4.0 are tied to operating systems that are beyond mainstream support; keep them for legacy compatibility only.
37
+
- Windows Server 2012 and Windows Server 2012 R2 are past extended support and only available under Microsoft ESU.
38
+
- The active test surface in this cookbook is limited to Windows Server 2019 because it has a stable local Vagrant box and a matching CI exec target.
Installs and configures PowerShell 2.0, 3.0, 4.0 or 5.0.
6
+
This cookbook provides custom resources for managing legacy Windows Management Framework
7
+
(WMF) installers and the supporting WinRM / DSC configuration required by older Windows
8
+
platforms.
10
9
11
10
## Maintainers
12
11
13
-
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).
12
+
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef
13
+
cookbook maintainers working together to maintain important cookbooks. If you would like to
Not every version of Windows supports every version of Powershell. The following table illustrates Powershell support across the Windows family. **Included** means that the base installation of the operating system includes the indicated version of Powershell.
20
-
21
-
Windows Version | PowerShell 2.0 | PowerShell 3.0 | PowerShell 4.0 | PowerShell 5.0
Windows Server 2008 R2 | Included | Supported | Supported | Supported
24
-
Windows Server 2012 / Windows 8 | Included | Included | Supported | Supported
25
-
Windows Server 2012R2 / Windows 8.1 | Included | Not Available | Included | Supported
26
-
27
-
### Chef
28
-
29
-
- Chef 13+
30
-
31
-
### Cookbooks
32
-
33
-
- windows 3.0+
34
-
35
-
PowerShell also requires the appropriate version of the Microsoft .NET Framework to be installed, if the operating system does not ship with that version. The following community cookbooks are used to install the correct version of the .NET Framework:
36
-
37
-
- ms_dotnet
18
+
- Chef Infra Client `>= 15.3`
19
+
- Windows
20
+
-`ms_dotnet``>= 3.2.1`
38
21
39
22
## Resources
40
23
41
-
### `powershell_module`
42
-
43
-
#### Deprecated
24
+
-`powershell_wmf`
25
+
-`powershell_winrm`
26
+
-`powershell_dsc`
27
+
-`powershell_lcm`
44
28
45
-
The `powershell_module` has been removed from this cookbook as it was non-functional for most needs and has been replaced with built in resources in chef:
See [`LIMITATIONS.md`](LIMITATIONS.md) for the supported Microsoft download matrix and
30
+
lifecycle notes.
49
31
50
32
## Usage
51
33
52
-
**Note**: The installation may require a restart of the node being configured before PowerShell can be used.
53
-
54
-
### default
55
-
56
-
The default recipe contains no resources and will do nothing if included on a run_list.
57
-
58
-
### powershell2
59
-
60
-
Include the `powershell2` recipe in a run list, to ensure PowerShell 2.0 is installed. If the platform is not supported, a warning will be logged.
61
-
62
-
### powershell3
63
-
64
-
Include the `powershell3` recipe in a run list, to install PowerShell 3.0 is installed on applicable platforms. If the platform is not supported, a warning will be logged.
65
-
66
-
### powershell4
67
-
68
-
Include the `powershell4` recipe in a run list, to install PowerShell 4.0 is installed on applicable platforms. If the platform is not supported, a warning will be logged.
69
-
70
-
### powershell5
71
-
72
-
Include the `powershell5` recipe in a run list, to install PowerShell 5.0 is installed on applicable platforms. If the platform is not supported, a warning will be logged.
73
-
74
-
## References
34
+
Install WMF 5.1 when the target platform needs it:
0 commit comments