kitchen-dsc 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/publish.yaml +2 -2
- data/.gitignore +3 -0
- data/.release-please-manifest.json +1 -1
- data/.rspec +2 -0
- data/.rubocop.yml +1 -4
- data/.yamllint +6 -0
- data/.yardopts +11 -0
- data/CHANGELOG.md +7 -0
- data/CONTRIBUTING.md +121 -0
- data/Gemfile +7 -9
- data/README.md +230 -79
- data/Rakefile +40 -5
- data/kitchen-dsc.gemspec +3 -3
- data/lib/kitchen/provisioner/dsc.rb +241 -2
- data/lib/kitchen-dsc/version.rb +19 -1
- data/spec/kitchen/provisioner/dsc_spec.rb +590 -0
- data/spec/kitchen_dsc/version_spec.rb +21 -0
- data/spec/spec_helper.rb +70 -16
- data/spec/support/kitchen_helpers.rb +159 -0
- metadata +12 -9
- data/lib/kitchen/provisioner/dsc_lcm/lcm_base.rb +0 -86
- data/lib/kitchen/provisioner/dsc_lcm/lcm_v4.rb +0 -52
- data/lib/kitchen/provisioner/dsc_lcm/lcm_v5.rb +0 -53
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66d661763e4f52b0b1f10b042d72566f4946f68475d7378955b6c0d59dba180c
|
|
4
|
+
data.tar.gz: 1e743c929da152aa6987b239dbba9f62e5bef78e528b0d4451a955b5f41066a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5a266a4a08fca4e824f1f242422c8f9da50c4f5f7319153f33439f070284b8d0af95289d54048a862075c3ed32d8e38339dadcc7a5a72bffd1d102daa2438df
|
|
7
|
+
data.tar.gz: 876e6da17a115df998356967c013061ab1b0d8ff5494053c6d7786c71670dfb2d38f6c443450c74308a7e9f25878e47e9db0324ac2911cce065e4722d370151e
|
|
@@ -9,13 +9,13 @@ jobs:
|
|
|
9
9
|
release-please:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
- uses: googleapis/release-please-action@
|
|
12
|
+
- uses: googleapis/release-please-action@v5
|
|
13
13
|
id: release
|
|
14
14
|
with:
|
|
15
15
|
token: ${{ secrets.PORTER_GITHUB_TOKEN }}
|
|
16
16
|
|
|
17
17
|
- name: Checkout
|
|
18
|
-
uses: actions/checkout@
|
|
18
|
+
uses: actions/checkout@v7
|
|
19
19
|
if: ${{ steps.release.outputs.release_created }}
|
|
20
20
|
|
|
21
21
|
- name: Build and publish to GitHub Package
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.rubocop.yml
CHANGED
data/.yamllint
ADDED
data/.yardopts
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## [0.13.0](https://github.com/test-kitchen/kitchen-dsc/compare/v0.12.1...v0.13.0) (2026-08-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* rewrite unit tests, add YARD docs and rake tasks ([#107](https://github.com/test-kitchen/kitchen-dsc/issues/107)) ([16cb07e](https://github.com/test-kitchen/kitchen-dsc/commit/16cb07ea3cbc6ed7395ccf57512d1a4cbef911a4))
|
|
9
|
+
|
|
3
10
|
## [0.12.1](https://github.com/test-kitchen/kitchen-dsc/compare/v0.12.0...v0.12.1) (2024-07-01)
|
|
4
11
|
|
|
5
12
|
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Contributing to kitchen-dsc
|
|
2
|
+
|
|
3
|
+
> **This project is no longer under active development** and has no active
|
|
4
|
+
> maintainers. Issues filed on GitHub will most likely not be triaged. Pull
|
|
5
|
+
> requests are still welcome. If you are interested in maintaining the project,
|
|
6
|
+
> come and talk to us in `#test-kitchen` on
|
|
7
|
+
> [Chef Community Slack](https://community-slack.chef.io/).
|
|
8
|
+
|
|
9
|
+
## Reporting issues
|
|
10
|
+
|
|
11
|
+
Report bugs and request features on the [issue tracker](https://github.com/test-kitchen/kitchen-dsc/issues), keeping the note above in mind. For bugs, please include:
|
|
12
|
+
|
|
13
|
+
- the version of kitchen-dsc and Test Kitchen you are using
|
|
14
|
+
- the WMF version on the test instance
|
|
15
|
+
- your `kitchen.yml` and the DSC configuration script
|
|
16
|
+
- the output of the failing command, ideally with `-l debug`
|
|
17
|
+
|
|
18
|
+
## Development setup
|
|
19
|
+
|
|
20
|
+
Clone the repository and install the dependencies:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
git clone https://github.com/test-kitchen/kitchen-dsc.git
|
|
24
|
+
cd kitchen-dsc
|
|
25
|
+
bundle install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Tests and linting
|
|
29
|
+
|
|
30
|
+
Run everything the way CI does:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
bundle exec rake # linter + unit tests
|
|
34
|
+
bundle exec rake test # unit tests only (this is what CI runs)
|
|
35
|
+
bundle exec rake style # Cookstyle only
|
|
36
|
+
bundle exec cookstyle -a # autocorrect what can be corrected
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The unit tests live in `spec/` and use RSpec. They build a real
|
|
40
|
+
`Kitchen::Instance` around the provisioner — with the stock dummy driver,
|
|
41
|
+
transport and verifier — rather than mocking it, so `default_config` blocks and
|
|
42
|
+
`finalize_config!` run exactly as they do in a real converge. See
|
|
43
|
+
`spec/support/kitchen_helpers.rb`.
|
|
44
|
+
|
|
45
|
+
Two conventions are worth knowing before you add specs:
|
|
46
|
+
|
|
47
|
+
- **Drive the public API.** Most of `Kitchen::Provisioner::Dsc` is private, but
|
|
48
|
+
every private method is reachable through `install_command`, `init_command`,
|
|
49
|
+
`create_sandbox`, `prepare_command`, `run_command` or `finalize_config!`.
|
|
50
|
+
Assert on the PowerShell those produce instead of calling private methods
|
|
51
|
+
with `send`.
|
|
52
|
+
- **Match on fragments, not whole commands.** Test Kitchen wraps every command
|
|
53
|
+
with environment setup that differs between a laptop and CI (`$env:CI` is
|
|
54
|
+
only injected when `ENV["CI"]` is set), so `include` and `match` are stable
|
|
55
|
+
where `eq` is not.
|
|
56
|
+
|
|
57
|
+
Useful environment variables:
|
|
58
|
+
|
|
59
|
+
| Variable | Effect |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `SEED=12345` | reproduce a specific random ordering |
|
|
62
|
+
| `VERBOSE=1` | print full backtraces on failure |
|
|
63
|
+
| `ONLY_FAILURES=1` | rerun only what failed last time |
|
|
64
|
+
| `COVERAGE=false` | skip SimpleCov |
|
|
65
|
+
| `RSPEC_WARNINGS=true` | enable Ruby warnings |
|
|
66
|
+
|
|
67
|
+
Coverage is reported to `coverage/` after each run as a diagnostic. **It is not
|
|
68
|
+
a gate** — no build fails because a percentage moved, and neither the coverage
|
|
69
|
+
report nor the documentation build runs in CI.
|
|
70
|
+
|
|
71
|
+
## Documentation
|
|
72
|
+
|
|
73
|
+
The public API is documented with [YARD](https://yardoc.org/):
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
bundle exec rake yard # build HTML docs into doc/
|
|
77
|
+
bundle exec rake yard:stats # list any undocumented objects
|
|
78
|
+
bundle exec rake yard:server # browse at http://localhost:8808
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
New methods should carry a YARD comment with `@param` and `@return` tags;
|
|
82
|
+
private helpers should also be tagged `@api private`. This is a convention, not
|
|
83
|
+
a CI check.
|
|
84
|
+
|
|
85
|
+
## Manual testing
|
|
86
|
+
|
|
87
|
+
The unit tests cover the PowerShell this gem generates and the files it stages,
|
|
88
|
+
but they cannot tell you whether DSC accepts that PowerShell. Any change to the
|
|
89
|
+
generated scripts should also be exercised against a real Windows instance
|
|
90
|
+
running WMF 4 or newer. You will need a driver that can supply
|
|
91
|
+
one, such as kitchen-vagrant, kitchen-hyperv, or kitchen-ec2.
|
|
92
|
+
|
|
93
|
+
Both project layouts are worth exercising, since they take different paths
|
|
94
|
+
through the provisioner:
|
|
95
|
+
|
|
96
|
+
- **module style**, using `configuration_script_folder` and `configuration_script`
|
|
97
|
+
- **repository style**, using `modules_path` to upload DSC resources
|
|
98
|
+
|
|
99
|
+
If your change touches gallery installation, test it on a WMF 5 instance, which
|
|
100
|
+
is required for `modules_from_gallery`.
|
|
101
|
+
|
|
102
|
+
## Submitting changes
|
|
103
|
+
|
|
104
|
+
1. Fork the repository.
|
|
105
|
+
2. Create a feature branch off `main`.
|
|
106
|
+
3. Make your change.
|
|
107
|
+
4. Add or update specs, and run `bundle exec rake`.
|
|
108
|
+
5. Push the branch to your fork and open a pull request.
|
|
109
|
+
|
|
110
|
+
Please keep pull requests focused on a single change — it makes review much
|
|
111
|
+
faster. Update the documentation in `README.md` when you add or change a
|
|
112
|
+
configuration option.
|
|
113
|
+
|
|
114
|
+
## Release process
|
|
115
|
+
|
|
116
|
+
Releases are handled by the maintainers.
|
|
117
|
+
|
|
118
|
+
1. Update `lib/kitchen-dsc/version.rb` with the new version.
|
|
119
|
+
2. Update `CHANGELOG.md`.
|
|
120
|
+
3. Merge to `main`; the [publish workflow](.github/workflows/publish.yaml) builds
|
|
121
|
+
the gem and pushes it to RubyGems.
|
data/Gemfile
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
gemspec
|
|
4
|
-
|
|
3
|
+
gemspec development_group: :test
|
|
5
4
|
group :development do
|
|
6
|
-
gem "countloc", "~> 0.4"
|
|
7
5
|
gem "yard", "~> 0.9", ">= 0.9.20"
|
|
6
|
+
# markdown provider for YARD
|
|
7
|
+
gem "kramdown"
|
|
8
8
|
gem "pry"
|
|
9
9
|
gem "pry-stack_explorer"
|
|
10
10
|
gem "pry-byebug"
|
|
11
11
|
gem "rb-readline"
|
|
12
|
-
gem "cane", "3.0.0"
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
group :test do
|
|
16
15
|
gem "rake"
|
|
17
|
-
gem "rspec", "~> 3.
|
|
18
|
-
gem "simplecov", "~> 0.
|
|
19
|
-
gem "minitest", "~> 5.3"
|
|
16
|
+
gem "rspec", "~> 3.13"
|
|
17
|
+
gem "simplecov", "~> 0.22"
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
group :
|
|
23
|
-
gem "
|
|
20
|
+
group :cookstyle do
|
|
21
|
+
gem "cookstyle"
|
|
24
22
|
end
|
data/README.md
CHANGED
|
@@ -2,113 +2,201 @@
|
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/kitchen-dsc)
|
|
4
4
|
|
|
5
|
-
A Test Kitchen
|
|
5
|
+
A [Test Kitchen](https://kitchen.ci/) provisioner that applies [PowerShell Desired State Configuration](https://learn.microsoft.com/en-us/powershell/dsc/overview) configurations to test instances, so you can test DSC configurations and resources the same way you would test a cookbook.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> **This project is no longer under active development.** It has no active
|
|
8
|
+
> maintainers. The provisioner may continue to work for some or all use cases,
|
|
9
|
+
> but issues filed on GitHub will most likely not be triaged. If you are
|
|
10
|
+
> interested in maintaining it, come and talk to us in `#test-kitchen` on
|
|
11
|
+
> [Chef Community Slack](https://community-slack.chef.io/).
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
<!-- -->
|
|
14
|
+
|
|
15
|
+
> This documentation uses [Cinc Workstation](https://cinc.sh/) and the `cinc` commands throughout. Everything here works identically with Chef Workstation — see [Using with Chef](#using-with-chef).
|
|
10
16
|
|
|
11
17
|
## Requirements
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
- **Windows test instances only.** The instance must be running WMF 4 or newer.
|
|
20
|
+
- A Test Kitchen driver that can provide Windows instances, such as
|
|
21
|
+
[kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant),
|
|
22
|
+
[kitchen-hyperv](https://github.com/test-kitchen/kitchen-hyperv), or
|
|
23
|
+
[kitchen-ec2](https://github.com/test-kitchen/kitchen-ec2)
|
|
24
|
+
- WMF 5 if you want to install modules from a PowerShell gallery
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Add the provisioner to your `Gemfile` alongside Test Kitchen and a driver:
|
|
29
|
+
|
|
30
|
+
```ruby
|
|
31
|
+
gem "test-kitchen"
|
|
32
|
+
gem "kitchen-dsc"
|
|
33
|
+
gem "kitchen-vagrant"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
bundle install
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Or install it directly:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
gem install kitchen-dsc
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Two ways to lay out a project
|
|
49
|
+
|
|
50
|
+
How you configure this provisioner depends on what you are testing.
|
|
51
|
+
|
|
52
|
+
**Module style** keeps the DSC configuration next to the module it exercises.
|
|
53
|
+
Point `configuration_script_folder` and `configuration_script` at that file.
|
|
54
|
+
|
|
55
|
+
**Repository style** keeps a `modules` directory of DSC resources at the root of
|
|
56
|
+
the repository, which the provisioner uploads to the instance before applying
|
|
57
|
+
the configuration. `modules_path` controls where that directory is.
|
|
58
|
+
|
|
59
|
+
Worked examples of each:
|
|
60
|
+
|
|
61
|
+
- [Repository style testing](https://github.com/smurawski/dsc-kitchen-project)
|
|
62
|
+
- [Module style testing](https://github.com/powershellorg/cwebadministration/tree/smurawski/adding_tests)
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
Put a DSC configuration in `examples/dsc_configuration.ps1`, then:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
---
|
|
70
|
+
driver:
|
|
71
|
+
name: vagrant
|
|
72
|
+
|
|
73
|
+
provisioner:
|
|
74
|
+
name: dsc
|
|
75
|
+
dsc_local_configuration_manager_version: wmf5
|
|
76
|
+
|
|
77
|
+
platforms:
|
|
78
|
+
- name: windows-2022
|
|
79
|
+
|
|
80
|
+
suites:
|
|
81
|
+
- name: default
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Then run the full test cycle:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
cinc kitchen test
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Or step through it:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
cinc kitchen create # build the Windows instance
|
|
94
|
+
cinc kitchen converge # apply the DSC configuration
|
|
95
|
+
cinc kitchen verify # run your tests
|
|
96
|
+
cinc kitchen destroy # remove the instance
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
By default the provisioner looks for a configuration named after the suite, in
|
|
100
|
+
`examples/dsc_configuration.ps1`.
|
|
101
|
+
|
|
102
|
+
> **Note on output timing:** the verbose stream is returned after the DSC job
|
|
103
|
+
> completes rather than while it runs, because WMF versions differ in how they
|
|
104
|
+
> expose that stream. Expect a delay before you see run details.
|
|
14
105
|
|
|
15
|
-
##
|
|
106
|
+
## Configuration
|
|
16
107
|
|
|
17
|
-
|
|
108
|
+
All options below are set under the `provisioner:` key in `kitchen.yml`, or per suite under `suites[].provisioner:`.
|
|
18
109
|
|
|
19
|
-
###
|
|
110
|
+
### Configuration script
|
|
20
111
|
|
|
21
|
-
|
|
112
|
+
| Option | Default | Description |
|
|
113
|
+
| --- | --- | --- |
|
|
114
|
+
| `configuration_script_folder` | `"examples"` | Directory holding the PowerShell script(s) that define the DSC configuration. |
|
|
115
|
+
| `configuration_script` | `"dsc_configuration.ps1"` | Name of the PowerShell script containing the DSC configuration command, and possibly its configuration data. |
|
|
116
|
+
| `configuration_name` | the suite name | Name of the configuration command to run. |
|
|
22
117
|
|
|
23
|
-
|
|
118
|
+
### Configuration data
|
|
24
119
|
|
|
25
|
-
|
|
26
|
-
|
|
120
|
+
| Option | Default | Description |
|
|
121
|
+
| --- | --- | --- |
|
|
122
|
+
| `configuration_data` | *unset* | YAML representation of the data passed to the configuration. Overrides any configuration data assigned in the script itself. |
|
|
123
|
+
| `configuration_data_variable` | `"ConfigurationData"` | Name of the variable holding the ConfigurationData hashtable. Can be set here or defined in the configuration script. |
|
|
27
124
|
|
|
28
|
-
|
|
125
|
+
### Local Configuration Manager
|
|
29
126
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
127
|
+
| Option | Default | Description |
|
|
128
|
+
| --- | --- | --- |
|
|
129
|
+
| `dsc_local_configuration_manager_version` | `"wmf4"` | Which LCM is in place. Also accepts `wmf4_with_update` and `wmf5`. |
|
|
130
|
+
| `dsc_local_configuration_manager` | *see below* | Hash of LCM settings. |
|
|
33
131
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
132
|
+
`wmf4_with_update` means WMF 4 with KB3000850 applied, which adds support for
|
|
133
|
+
configurations generated by WMF 5 along with a number of fixes. Today the only
|
|
134
|
+
differences between `wmf4` and the other two values are the `action_after_reboot`
|
|
135
|
+
and `debug_mode` settings.
|
|
37
136
|
|
|
38
|
-
|
|
39
|
-
* Name of the configuration to run, defaults to the suite name.
|
|
137
|
+
The LCM settings and their defaults:
|
|
40
138
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
139
|
+
| Setting | Default | Notes |
|
|
140
|
+
| --- | --- | --- |
|
|
141
|
+
| `action_after_reboot` | `"StopConfiguration"` | `wmf4_with_update` and `wmf5` only. |
|
|
142
|
+
| `reboot_if_needed` | `false` | |
|
|
143
|
+
| `allow_module_overwrite` | `false` | |
|
|
144
|
+
| `certificate_id` | `nil` | |
|
|
145
|
+
| `configuration_mode` | `"ApplyAndAutoCorrect"` | |
|
|
146
|
+
| `configuration_mode_frequency_mins` | `30` | `15` on `wmf5`. |
|
|
147
|
+
| `debug_mode` | `"All"` | `wmf4_with_update` only. |
|
|
148
|
+
| `refresh_frequency_mins` | `15` | `30` on `wmf5`. |
|
|
149
|
+
| `refresh_mode` | `"PUSH"` | |
|
|
44
150
|
|
|
45
|
-
|
|
46
|
-
* Defaults to 'ConfigurationData'
|
|
47
|
-
* Name of the variable that contains the ConfigurationData hashtable
|
|
48
|
-
* Can be defined in the configuration script or via the `configuration_data` configuration setting.
|
|
151
|
+
### Modules from a gallery
|
|
49
152
|
|
|
50
|
-
|
|
51
|
-
* Defaults to 'wmf4'
|
|
52
|
-
* Identifies what version of the LCM is in place
|
|
53
|
-
* Other valid values are 'wmf4_with_update' and 'wmf5'
|
|
54
|
-
* Currently the only difference between wmf4 and wmf4_with_update/wmf5 is the action_after_reboot and the debug_mode settings. Eventually, I'd like to add support for partial configurations, pull servers, etc..
|
|
55
|
-
* In this context, wmf4_with_update refers to wmf4 with KB3000850 applied (to add support for WMF 5 generated configurations, plus some fixes).
|
|
153
|
+
Installing modules from a gallery requires WMF 5 on the instance.
|
|
56
154
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* certificate_id = nil
|
|
64
|
-
* configuration_mode = 'ApplyAndAutoCorrect'
|
|
65
|
-
* configuration_mode_frequency_mins = 30 # 15 on wmf5
|
|
66
|
-
* debug_mode = 'All' # wmf4_with_update
|
|
67
|
-
* refresh_frequency_mins = 15 # 30 on wmf5
|
|
68
|
-
* refresh_mode = 'PUSH'
|
|
155
|
+
| Option | Default | Description |
|
|
156
|
+
| --- | --- | --- |
|
|
157
|
+
| `modules_from_gallery` | *unset* | Modules to install from a gallery. A string for one module, an array for several, or a hash matching the parameters of `Install-Module`. `Name` is required; `Force` is always applied and need not be given. |
|
|
158
|
+
| `gallery_name` | *unset* | Name of a custom PowerShell gallery to install from. If no package source with this name is registered on the machine, `gallery_uri` must be set too. |
|
|
159
|
+
| `gallery_uri` | *unset* | URI of a custom PowerShell gallery feed. |
|
|
160
|
+
| `nuget_force_bootstrap` | `true` | Bootstrap the NuGet package provider for PowerShell PackageManagement before installing modules. |
|
|
69
161
|
|
|
70
|
-
|
|
71
|
-
* Requires WMF 5
|
|
72
|
-
* Takes a string (for one module) or an array (for multiple) to install from the gallery
|
|
73
|
-
* Or takes a hash with keys matching the parameters for install-module.
|
|
74
|
-
* Name is required.
|
|
75
|
-
* Force is automatically used and not required as part of the hash table.
|
|
76
|
-
* Repository defaults to either PSGallery or any custom feed defined, but can be overriden here.
|
|
162
|
+
### Repository style testing
|
|
77
163
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
164
|
+
| Option | Default | Description |
|
|
165
|
+
| --- | --- | --- |
|
|
166
|
+
| `modules_path` | `"modules"` | Directory of modules containing DSC resources to upload to the instance, relative to the root of the repository, next to `kitchen.yml`. |
|
|
81
167
|
|
|
82
|
-
|
|
83
|
-
* URI for a custom PowerShell gallery feed.
|
|
168
|
+
### Reboot handling
|
|
84
169
|
|
|
85
|
-
|
|
170
|
+
These are standard Test Kitchen provisioner options that this provisioner gives DSC-specific defaults.
|
|
86
171
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
172
|
+
| Option | Default | Description |
|
|
173
|
+
| --- | --- | --- |
|
|
174
|
+
| `retry_on_exit_code` | `[35]` | Exit codes that cause the converge to be retried. Exit code 35 is DSC signalling that a reboot is required. |
|
|
175
|
+
| `max_retries` | `3` | Number of times to retry the converge on one of those exit codes. |
|
|
176
|
+
| `root_path` | driver default | Directory on the instance where the configuration and modules are staged. |
|
|
91
177
|
|
|
92
|
-
##
|
|
178
|
+
## Examples
|
|
179
|
+
|
|
180
|
+
### Module style, with modules from a custom gallery
|
|
93
181
|
|
|
94
182
|
```yaml
|
|
95
183
|
provisioner:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
184
|
+
name: dsc
|
|
185
|
+
dsc_local_configuration_manager_version: wmf5
|
|
186
|
+
dsc_local_configuration_manager:
|
|
187
|
+
reboot_if_needed: true
|
|
188
|
+
debug_mode: none
|
|
189
|
+
configuration_script_folder: .
|
|
190
|
+
configuration_script: SampleConfig.ps1
|
|
191
|
+
gallery_uri: https://ci.appveyor.com/nuget/xWebAdministration
|
|
192
|
+
gallery_name: xWebDevFeed
|
|
193
|
+
modules_from_gallery:
|
|
194
|
+
- xWebAdministration
|
|
195
|
+
- name: xComputerManagement
|
|
196
|
+
requiredversion: 1.4.0.0
|
|
197
|
+
repository: PSGallery
|
|
198
|
+
|
|
199
|
+
suites:
|
|
112
200
|
- name: test
|
|
113
201
|
provisioner:
|
|
114
202
|
configuration_data:
|
|
@@ -116,3 +204,66 @@ suite:
|
|
|
116
204
|
- nodename: localhost
|
|
117
205
|
role: webserver
|
|
118
206
|
```
|
|
207
|
+
|
|
208
|
+
### Repository style
|
|
209
|
+
|
|
210
|
+
```yaml
|
|
211
|
+
provisioner:
|
|
212
|
+
name: dsc
|
|
213
|
+
dsc_local_configuration_manager_version: wmf5
|
|
214
|
+
modules_path: modules
|
|
215
|
+
configuration_script_folder: examples
|
|
216
|
+
configuration_script: webserver.ps1
|
|
217
|
+
configuration_name: WebServer
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Allowing reboots during a converge
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
provisioner:
|
|
224
|
+
name: dsc
|
|
225
|
+
dsc_local_configuration_manager_version: wmf5
|
|
226
|
+
dsc_local_configuration_manager:
|
|
227
|
+
reboot_if_needed: true
|
|
228
|
+
action_after_reboot: ContinueConfiguration
|
|
229
|
+
max_retries: 5
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Per-suite configuration data
|
|
233
|
+
|
|
234
|
+
```yaml
|
|
235
|
+
provisioner:
|
|
236
|
+
name: dsc
|
|
237
|
+
configuration_script_folder: examples
|
|
238
|
+
configuration_script: webserver.ps1
|
|
239
|
+
|
|
240
|
+
suites:
|
|
241
|
+
- name: default
|
|
242
|
+
provisioner:
|
|
243
|
+
configuration_data:
|
|
244
|
+
AllNodes:
|
|
245
|
+
- nodename: localhost
|
|
246
|
+
role: webserver
|
|
247
|
+
- name: minimal
|
|
248
|
+
provisioner:
|
|
249
|
+
configuration_data:
|
|
250
|
+
AllNodes:
|
|
251
|
+
- nodename: localhost
|
|
252
|
+
role: minimal
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Using with Chef
|
|
256
|
+
|
|
257
|
+
This provisioner is not tied to Cinc, and it does not require Cinc or Chef on the instance at all — it applies DSC configurations directly. The commands above use Cinc Workstation; with [Chef Workstation](https://www.chef.io/downloads/tools/workstation) run `kitchen` instead of `cinc kitchen`. No provisioner configuration changes are needed.
|
|
258
|
+
|
|
259
|
+
## Contributing
|
|
260
|
+
|
|
261
|
+
This project has no active maintainers, so please read the status note at the
|
|
262
|
+
top before opening an issue. Pull requests are still welcome on
|
|
263
|
+
[GitHub](https://github.com/test-kitchen/kitchen-dsc). See
|
|
264
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) for development setup and the state of the
|
|
265
|
+
test tooling.
|
|
266
|
+
|
|
267
|
+
## License
|
|
268
|
+
|
|
269
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
data/Rakefile
CHANGED
|
@@ -1,21 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "bundler/gem_tasks"
|
|
2
|
-
|
|
4
|
+
|
|
5
|
+
require "cookstyle/chefstyle"
|
|
3
6
|
require "rubocop/rake_task"
|
|
4
7
|
|
|
5
8
|
RuboCop::RakeTask.new(:style) do |task|
|
|
6
9
|
task.options += ["--display-cop-names", "--no-color"]
|
|
7
10
|
end
|
|
8
11
|
|
|
9
|
-
# Create the spec task.
|
|
10
12
|
require "rspec/core/rake_task"
|
|
13
|
+
|
|
14
|
+
# Named `test` because the shared test-kitchen CI workflow invokes
|
|
15
|
+
# `bundle exec rake test`. Renaming it would break CI.
|
|
11
16
|
RSpec::Core::RakeTask.new(:test, :tag) do |t, args|
|
|
12
17
|
t.rspec_opts = [].tap do |a|
|
|
13
|
-
a << "--color"
|
|
14
18
|
a << "--format #{ENV["CI"] ? "documentation" : "progress"}"
|
|
15
19
|
a << "--backtrace" if ENV["VERBOSE"] || ENV["DEBUG"]
|
|
16
20
|
a << "--seed #{ENV["SEED"]}" if ENV["SEED"]
|
|
17
21
|
a << "--tag #{args[:tag]}" if args[:tag]
|
|
18
|
-
a << "--
|
|
19
|
-
a << "-I test/spec"
|
|
22
|
+
a << "--only-failures" if ENV["ONLY_FAILURES"]
|
|
20
23
|
end.join(" ")
|
|
21
24
|
end
|
|
25
|
+
|
|
26
|
+
# YARD lives in the :development bundle group, which a test-only install may
|
|
27
|
+
# skip. Documentation tasks are optional, so degrade rather than break `rake`.
|
|
28
|
+
begin
|
|
29
|
+
require "yard"
|
|
30
|
+
|
|
31
|
+
YARD::Rake::YardocTask.new(:yard) do |t|
|
|
32
|
+
t.stats_options = ["--list-undoc"]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
namespace :yard do
|
|
36
|
+
desc "Report documentation coverage, listing undocumented objects"
|
|
37
|
+
task :stats do
|
|
38
|
+
sh "yard stats --list-undoc"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
desc "Serve the docs at http://localhost:8808, reloading on change"
|
|
42
|
+
task :server do
|
|
43
|
+
sh "yard server --reload"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
rescue LoadError
|
|
47
|
+
%w{yard yard:stats yard:server}.each do |name|
|
|
48
|
+
desc "(unavailable: install the :development bundle group)" if name == "yard"
|
|
49
|
+
task name do
|
|
50
|
+
abort "YARD is not available. Run `bundle install --with development`."
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
desc "Run the linter and the unit tests"
|
|
56
|
+
task default: %i{style test}
|