Skip to content

Commit 1e2c3e4

Browse files
committed
feat: add project docs and default product_name to cinc
- Rewrite README.md with full usage and configuration docs - Add CHANGELOG.md scaffold for 0.1.0 - Add CODEOWNERS pointing to @cinc-project/maintainers - Add CONTRIBUTING.md with release process - Default product_name to 'cinc' in CincBase (uses modern install path) - Update specs to match new product_name default Signed-off-by: Lance Albertson <lance@osuosl.org>
1 parent a6c3387 commit 1e2c3e4

6 files changed

Lines changed: 287 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Kitchen-cinc Change Log
2+
3+
## 0.1.0 (Unreleased)
4+
5+
- Initial release of kitchen-cinc gem
6+
- Cinc Infra provisioner (`cinc_infra`) using cinc-client in local mode
7+
- Cinc Solo provisioner (`cinc_solo`)
8+
- Cinc Apply provisioner (`cinc_apply`)
9+
- Cinc Target provisioner (`cinc_target`) for remote execution (Cinc 19.0.0+)
10+
- Cinc Zero provisioner (`cinc_zero`) as deprecated alias for `cinc_infra`
11+
- Policyfile support with auto-detection
12+
- Berkshelf fallback support
13+
- Omnitruck-based package installation via `omnitruck.cinc.sh`

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@cinc-project/maintainers

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Release Process
2+
3+
This release process applies to all Cinc Project Test Kitchen plugins, but each project may have additional requirements.
4+
5+
1. Perform a diff between main and the last released version. Determine whether included MRs justify a patch, minor or major version release.
6+
2. Check out the main branch of the project being prepared for release.
7+
3. Branch into a release-branch of the form `150_release_prep`.
8+
4. Modify the `cinc_version.rb` file to specify the version for releasing.
9+
5. Run `rake changelog` to regenerate the changelog.
10+
6. `git commit` the `cinc_version.rb` and `CHANGELOG.md` changes to the branch and setup an MR for them. Allow the MR to run any automated tests and review the CHANGELOG for accuracy.
11+
7. Merge the MR to main after review.
12+
8. Switch your local copy to the main branch and `git pull` to pull in the release preparation changes.
13+
9. Run `rake release` on the main branch.
14+
10. Modify the `cinc_version.rb` file and bump the patch or minor version, and commit/push.

README.md

Lines changed: 249 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,250 @@
11
# kitchen-cinc
2-
A Test Kitchen provisioner for omnibus Cinc Clinet
2+
3+
A Test Kitchen provisioner for [Cinc Client](https://cinc.sh/) (the community distribution of Chef Infra Client) that downloads and installs omnibus packages via the [Cinc omnitruck API](https://omnitruck.cinc.sh/).
4+
5+
## Overview
6+
7+
This Test Kitchen plugin provides provisioners that automatically download and install the desired version of Cinc Client on your test instances. This allows you to test your cookbooks against different Cinc versions without pre-installing Cinc on your images.
8+
9+
## Installation
10+
11+
**Note:** This gem will ship as part of Cinc Workstation. If you're using Cinc Workstation, no additional installation is necessary.
12+
13+
For standalone installation, add this line to your Gemfile:
14+
15+
```ruby
16+
gem "kitchen-cinc"
17+
```
18+
19+
Then execute:
20+
21+
```shell
22+
bundle install
23+
```
24+
25+
Or install it directly:
26+
27+
```shell
28+
gem install kitchen-cinc
29+
```
30+
31+
## Usage
32+
33+
### Available Provisioners
34+
35+
This gem provides five provisioners:
36+
37+
- **`cinc_infra`** — Modern Cinc Client provisioner using local mode (recommended)
38+
- **`cinc_zero`** — Deprecated alias for `cinc_infra` (maintained for backward compatibility)
39+
- **`cinc_solo`** — Cinc Solo provisioner (note: does not support parallel converge)
40+
- **`cinc_apply`** — Cinc Apply provisioner for running individual recipes
41+
- **`cinc_target`** — Cinc Target Mode provisioner (requires Cinc 19.0.0+, Train-based transport)
42+
43+
### Basic Configuration
44+
45+
To use the Cinc Infra provisioner in your `kitchen.yml`:
46+
47+
```yaml
48+
provisioner:
49+
name: cinc_infra
50+
```
51+
52+
### Complete Example
53+
54+
```yaml
55+
---
56+
driver:
57+
name: vagrant
58+
59+
provisioner:
60+
name: cinc_infra
61+
product_name: cinc
62+
install_strategy: always
63+
channel: stable
64+
65+
platforms:
66+
- name: ubuntu-24.04
67+
- name: almalinux-9
68+
69+
suites:
70+
- name: default
71+
run_list:
72+
- recipe[my_cookbook::default]
73+
```
74+
75+
### Docker (Dokken) Example
76+
77+
```yaml
78+
---
79+
driver:
80+
name: dokken
81+
privileged: true
82+
chef_image: cincproject/cinc
83+
chef_version: latest
84+
85+
provisioner:
86+
name: cinc_infra
87+
product_name: cinc
88+
89+
transport:
90+
name: dokken
91+
92+
platforms:
93+
- name: ubuntu-24.04
94+
driver:
95+
image: dokken/ubuntu-24.04
96+
pid_one_command: /bin/systemd
97+
98+
- name: almalinux-9
99+
driver:
100+
image: dokken/almalinux-9
101+
pid_one_command: /usr/lib/systemd/systemd
102+
```
103+
104+
### Configuration Options
105+
106+
#### `product_name`
107+
108+
- **Type:** String
109+
- **Default:** `cinc`
110+
- **Description:** The product to install. Set to `cinc` for Cinc Client or `cinc-workstation` for Cinc Workstation.
111+
112+
#### `product_version`
113+
114+
- **Type:** String
115+
- **Default:** `latest`
116+
- **Description:** The version of Cinc Client to install. Can be a specific version (e.g., `19.2.12`) or `latest`.
117+
118+
#### `channel`
119+
120+
- **Type:** String/Symbol
121+
- **Default:** `stable`
122+
- **Options:** `stable`, `current`
123+
- **Description:** The release channel to install from.
124+
125+
#### `install_strategy`
126+
127+
- **Type:** String
128+
- **Default:** `once`
129+
- **Options:** `once`, `always`
130+
- **Description:** When to install Cinc. `once` only installs if not present, `always` reinstalls on every converge.
131+
132+
#### `download_url`
133+
134+
- **Type:** String
135+
- **Default:** none
136+
- **Description:** Override the download URL for custom package locations or air-gapped environments.
137+
138+
#### `checksum`
139+
140+
- **Type:** String
141+
- **Default:** none
142+
- **Description:** SHA256 checksum to verify the downloaded package. Used with `download_url`.
143+
144+
#### `platform`, `platform_version`, `architecture`
145+
146+
- **Type:** String
147+
- **Default:** Auto-detected
148+
- **Description:** Explicitly specify platform details for package selection.
149+
150+
#### `run_list`
151+
152+
- **Type:** Array
153+
- **Default:** `[]`
154+
- **Description:** The Cinc run list to execute.
155+
156+
#### `attributes`
157+
158+
- **Type:** Hash
159+
- **Default:** `{}`
160+
- **Description:** Node attributes to set during the converge.
161+
162+
#### `log_level`
163+
164+
- **Type:** String
165+
- **Default:** `auto`
166+
- **Description:** Cinc log level. Set to `debug` for verbose output, or `auto` to let Cinc decide.
167+
168+
#### `log_file`
169+
170+
- **Type:** String
171+
- **Default:** none
172+
- **Description:** Path to write the Cinc log file on the test instance.
173+
174+
#### `multiple_converge`
175+
176+
- **Type:** Integer
177+
- **Default:** `1`
178+
- **Description:** Number of times to run converge. Useful with `enforce_idempotency`.
179+
180+
#### `enforce_idempotency`
181+
182+
- **Type:** Boolean
183+
- **Default:** `false`
184+
- **Description:** When `true`, fails the run if the second converge makes changes. Requires `multiple_converge` >= 2.
185+
186+
#### `deprecations_as_errors`
187+
188+
- **Type:** Boolean
189+
- **Default:** `false`
190+
- **Description:** Treat Cinc deprecation warnings as errors.
191+
192+
### Policyfile Support
193+
194+
kitchen-cinc auto-detects `Policyfile.rb` in your cookbook directory and uses it for dependency resolution. You can also configure it explicitly:
195+
196+
```yaml
197+
provisioner:
198+
name: cinc_infra
199+
policyfile_path: path/to/Policyfile.rb
200+
policy_group: local
201+
always_update_cookbooks: true
202+
```
203+
204+
### Berkshelf Support
205+
206+
If no Policyfile is found, kitchen-cinc will fall back to Berkshelf if a `Berksfile` is present:
207+
208+
```yaml
209+
provisioner:
210+
name: cinc_infra
211+
berksfile_path: path/to/Berksfile
212+
always_update_cookbooks: true
213+
```
214+
215+
### Path Configuration
216+
217+
All paths are auto-calculated if not specified:
218+
219+
- `data_path` — Path to data directory
220+
- `data_bags_path` — Path to data bags
221+
- `environments_path` — Path to environments
222+
- `nodes_path` — Path to node definitions
223+
- `roles_path` — Path to roles
224+
- `clients_path` — Path to clients
225+
- `encrypted_data_bag_secret_key_path` — Path to encryption key
226+
227+
## Development
228+
229+
### Running Tests
230+
231+
```shell
232+
bundle install
233+
bundle exec rake # Run all tests and linting
234+
bundle exec rake spec # Run unit tests only
235+
bundle exec rake lint # Run Cookstyle linting only
236+
```
237+
238+
### Integration Tests
239+
240+
```shell
241+
# Vagrant
242+
KITCHEN_YAML=kitchen.yml bundle exec kitchen test
243+
244+
# Docker (Dokken)
245+
KITCHEN_YAML=kitchen.dokken.yml bundle exec kitchen test
246+
```
247+
248+
## License
249+
250+
Apache-2.0 — see [LICENSE](LICENSE) for details.

lib/kitchen/provisioner/cinc_base.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ class CincBase < Base
115115
# Modern configuration options (RFC 091 equivalent for Cinc)
116116
#
117117

118-
# Setting product_name to nil. It is currently the pivot point
119-
# between the two install paths (Mixlib::Install::ScriptGenerator and Mixlib::Install)
120-
default_config :product_name
118+
# Default product_name to "cinc" so that the modern Mixlib::Install
119+
# code path is used automatically.
120+
default_config :product_name, "cinc"
121121

122122
default_config :product_version, :latest
123123

spec/kitchen/provisioner/cinc_base_spec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ def calculate_path(path, _opts = {})
134134
_(provisioner[:encrypted_data_bag_secret_key_path]).must_equal os_safe_root_path("/rooty/<calculated>/encrypted_data_bag_secret_key")
135135
end
136136

137-
it ":product_name default to nil" do
138-
_(provisioner[:product_name]).must_be_nil
137+
it ":product_name defaults to cinc" do
138+
_(provisioner[:product_name]).must_equal "cinc"
139139
end
140140

141141
it ":product_version defaults to :latest" do
@@ -188,8 +188,9 @@ def calculate_path(path, _opts = {})
188188
}
189189
end
190190

191-
it "returns nil if :require_chef_omnibus is falsey" do
191+
it "returns nil if :require_chef_omnibus is falsey and product_name is nil" do
192192
config[:require_chef_omnibus] = false
193+
config[:product_name] = nil
193194

194195
installer.expects(:root).never
195196
installer.expects(:install_command).never
@@ -198,6 +199,7 @@ def calculate_path(path, _opts = {})
198199

199200
describe "common behaviour" do
200201
before do
202+
config[:product_name] = nil
201203
installer.expects(:root).at_least_once.returns("/opt/cinc")
202204
installer.expects(:install_command)
203205
end
@@ -554,6 +556,7 @@ def calculate_path(path, _opts = {})
554556

555557
describe "for bourne shells" do
556558
before do
559+
config[:product_name] = nil
557560
installer.expects(:root).at_least_once.returns("/opt/cinc")
558561
installer.expects(:install_command).returns("my_install_command")
559562
end
@@ -591,6 +594,7 @@ def calculate_path(path, _opts = {})
591594

592595
describe "for powershell shells on windows os types" do
593596
before do
597+
config[:product_name] = nil
594598
installer.expects(:root).at_least_once.returns("/opt/cinc")
595599
installer.expects(:install_command)
596600
platform.stubs(:shell_type).returns("powershell")

0 commit comments

Comments
 (0)