|
1 | 1 | # 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. |
0 commit comments