chef-cli 4.0.1 → 5.0.1
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/Gemfile +0 -11
- data/chef-cli.gemspec +1 -1
- data/lib/chef-cli/command/generator_commands/cookbook.rb +1 -1
- data/lib/chef-cli/skeletons/code_generator/recipes/cookbook.rb +14 -1
- data/lib/chef-cli/skeletons/code_generator/templates/default/delivery-project.toml.erb +1 -1
- data/lib/chef-cli/version.rb +1 -1
- data/spec/unit/command/generator_commands/cookbook_spec.rb +38 -78
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08825f8c8c80fbf8119e1108de938d1dbe3c108309dfefb4f3454ac9fee3397d'
|
4
|
+
data.tar.gz: b3327078e2ee12265d9aabbeab42c9b510adfb1dad6a17cef3b9b8951239030f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b579beed9b27e92883fd1990a8de48c36a04d947ff6eed0a01df1bd49c38b3d325cad36dcf1eb8801e6107f6fd3dbaa8b2d8afb29bd51618a9dab5861883d58
|
7
|
+
data.tar.gz: 14a6e42f8b8b24d731639ba48eb16b3dae8de21d35adce5f9bda99d59b1ad47accdd4686c883183328573ee04e14fddf114960705f930d110e490beaa017080a
|
data/Gemfile
CHANGED
@@ -10,17 +10,6 @@ group :test do
|
|
10
10
|
gem "cookstyle", "=7.7.2" # this forces dependabot PRs to open which triggers cookstyle CI on the chef generate command
|
11
11
|
gem "chefstyle", "=1.6.2"
|
12
12
|
gem "test-kitchen", ">= 2.11.1"
|
13
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6")
|
14
|
-
gem "chef-zero", "~> 14"
|
15
|
-
gem "chef", "~> 15"
|
16
|
-
gem "chef-utils", "=16.6.14"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
group :development do
|
21
|
-
gem "pry"
|
22
|
-
gem "pry-byebug"
|
23
|
-
gem "rb-readline"
|
24
13
|
end
|
25
14
|
|
26
15
|
group :profile do
|
data/chef-cli.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.license = "Apache-2.0"
|
30
30
|
gem.homepage = "https://www.chef.io/"
|
31
31
|
|
32
|
-
gem.required_ruby_version = ">= 2.
|
32
|
+
gem.required_ruby_version = ">= 2.6"
|
33
33
|
|
34
34
|
gem.files = %w{Rakefile LICENSE} +
|
35
35
|
Dir.glob("Gemfile*") + # Includes Gemfile and locks
|
@@ -65,7 +65,7 @@ module ChefCLI
|
|
65
65
|
option :workflow,
|
66
66
|
short: "-w",
|
67
67
|
long: "--workflow",
|
68
|
-
description: "Generate a cookbook with a full #{ChefCLI::Dist::WORKFLOW} build cookbook.",
|
68
|
+
description: "DEPRECATED: Generate a cookbook with a full #{ChefCLI::Dist::WORKFLOW} build cookbook.",
|
69
69
|
boolean: true,
|
70
70
|
default: false
|
71
71
|
|
@@ -182,4 +182,17 @@ if context.vscode_dir
|
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
185
|
-
|
185
|
+
if context.enable_workflow
|
186
|
+
warn "\n---------WARNING---------\nThe --workflow flag is deprecated as #{ChefCLI::Dist::WORKFLOW} is EOL as of December 2020.\n\nThis flag will be ignored and will be removed in a future release.\n-------------------------\n\n"
|
187
|
+
directory "#{cookbook_dir}/.delivery"
|
188
|
+
|
189
|
+
template "#{cookbook_dir}/.delivery/project.toml" do
|
190
|
+
variables(
|
191
|
+
specs: context.specs
|
192
|
+
)
|
193
|
+
source 'delivery-project.toml.erb'
|
194
|
+
helpers(ChefCLI::Generator::TemplateHelper)
|
195
|
+
action :create_if_missing
|
196
|
+
end
|
197
|
+
|
198
|
+
end
|
data/lib/chef-cli/version.rb
CHANGED
@@ -204,7 +204,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
describe ".delivery/project.toml" do
|
207
|
+
describe "when passed without --specs subcommand .delivery/project.toml" do
|
208
208
|
|
209
209
|
let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "project.toml") }
|
210
210
|
|
@@ -221,7 +221,7 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
221
221
|
#
|
222
222
|
|
223
223
|
[local_phases]
|
224
|
-
unit = "
|
224
|
+
unit = "echo skipping unit phase."
|
225
225
|
lint = "chef exec cookstyle"
|
226
226
|
# foodcritic has been deprecated in favor of cookstyle so we skip the syntax
|
227
227
|
# phase now.
|
@@ -251,85 +251,55 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
251
251
|
|
252
252
|
end
|
253
253
|
|
254
|
-
describe ".delivery/
|
255
|
-
|
256
|
-
let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "config.json") }
|
257
|
-
|
258
|
-
let(:expected_content) do
|
259
|
-
<<~CONFIG_DOT_JSON
|
260
|
-
{
|
261
|
-
"version": "2",
|
262
|
-
"build_cookbook": {
|
263
|
-
"name": "build_cookbook",
|
264
|
-
"path": ".delivery/build_cookbook"
|
265
|
-
},
|
266
|
-
"delivery-truck": {
|
267
|
-
"lint": {
|
268
|
-
"enable_cookstyle": true
|
269
|
-
}
|
270
|
-
},
|
271
|
-
"skip_phases": [],
|
272
|
-
"job_dispatch": {
|
273
|
-
"version": "v2"
|
274
|
-
},
|
275
|
-
"dependencies": []
|
276
|
-
}
|
277
|
-
CONFIG_DOT_JSON
|
278
|
-
end
|
279
|
-
|
280
|
-
it "configures delivery to use a local build cookbook" do
|
281
|
-
expect(IO.read(file)).to eq(expected_content)
|
282
|
-
end
|
283
|
-
|
284
|
-
end
|
254
|
+
describe "when passed with --specs subcommand .delivery/project.toml" do
|
285
255
|
|
286
|
-
|
256
|
+
let(:argv) { %w{new_cookbook --workflow --specs} }
|
287
257
|
|
288
|
-
let(:file)
|
289
|
-
File.join(dot_delivery, "build_cookbook", "recipes", "publish.rb")
|
290
|
-
end
|
258
|
+
let(:file) { File.join(tempdir, "new_cookbook", ".delivery", "project.toml") }
|
291
259
|
|
292
260
|
let(:expected_content) do
|
293
|
-
<<~
|
261
|
+
<<~PROJECT_DOT_TOML
|
262
|
+
# Delivery for Local Phases Execution
|
294
263
|
#
|
295
|
-
#
|
296
|
-
#
|
264
|
+
# This file allows you to execute test phases locally on a workstation or
|
265
|
+
# in a CI pipeline. The delivery-cli will read this file and execute the
|
266
|
+
# command(s) that are configured for each phase. You can customize them
|
267
|
+
# by just modifying the phase key on this file.
|
268
|
+
#
|
269
|
+
# By default these phases are configured for Cookbook Workflow only
|
297
270
|
#
|
298
|
-
# Copyright:: #{DateTime.now.year}, The Authors, All Rights Reserved.
|
299
|
-
|
300
|
-
include_recipe 'delivery-truck::publish'
|
301
|
-
CONFIG_DOT_JSON
|
302
|
-
end
|
303
|
-
|
304
|
-
it "delegates functionality to delivery-truck" do
|
305
|
-
expect(IO.read(file)).to include(expected_content)
|
306
|
-
end
|
307
|
-
|
308
|
-
end
|
309
|
-
|
310
|
-
describe "build cookbook Berksfile" do
|
311
|
-
|
312
|
-
let(:file) do
|
313
|
-
File.join(dot_delivery, "build_cookbook", "Berksfile")
|
314
|
-
end
|
315
|
-
|
316
|
-
let(:expected_content) do
|
317
|
-
<<~CONFIG_DOT_JSON
|
318
|
-
source 'https://supermarket.chef.io'
|
319
271
|
|
320
|
-
|
272
|
+
[local_phases]
|
273
|
+
unit = "chef exec rspec spec/"
|
274
|
+
lint = "chef exec cookstyle"
|
275
|
+
# foodcritic has been deprecated in favor of cookstyle so we skip the syntax
|
276
|
+
# phase now.
|
277
|
+
syntax = "echo skipping syntax phase. Use lint phase instead."
|
278
|
+
provision = "chef exec kitchen create"
|
279
|
+
deploy = "chef exec kitchen converge"
|
280
|
+
smoke = "chef exec kitchen verify"
|
281
|
+
# The functional phase is optional, you can define it by uncommenting
|
282
|
+
# the line below and running the command: `delivery local functional`
|
283
|
+
# functional = ""
|
284
|
+
cleanup = "chef exec kitchen destroy"
|
321
285
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
286
|
+
# Remote project.toml file
|
287
|
+
#
|
288
|
+
# Instead of the local phases above, you may specify a remote URI location for
|
289
|
+
# the `project.toml` file. This is useful for teams that wish to centrally
|
290
|
+
# manage the behavior of the `delivery local` command across many different
|
291
|
+
# projects.
|
292
|
+
#
|
293
|
+
# remote_file = "https://url/project.toml"
|
294
|
+
PROJECT_DOT_TOML
|
326
295
|
end
|
327
296
|
|
328
|
-
it "
|
329
|
-
expect(IO.read(file)).to
|
297
|
+
it "exists with default config for Cookbook Workflow" do
|
298
|
+
expect(IO.read(file)).to eq(expected_content)
|
330
299
|
end
|
331
300
|
|
332
301
|
end
|
302
|
+
|
333
303
|
end
|
334
304
|
|
335
305
|
context "when no delivery CLI configuration is present" do
|
@@ -352,11 +322,6 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
352
322
|
Generating cookbook new_cookbook
|
353
323
|
- Ensuring correct cookbook content
|
354
324
|
- Committing cookbook files to git
|
355
|
-
- Ensuring delivery CLI configuration
|
356
|
-
- Ensuring correct Workflow (Delivery) build cookbook content
|
357
|
-
- Adding delivery configuration to feature branch
|
358
|
-
- Adding build cookbook to feature branch
|
359
|
-
- Merging delivery content feature branch to master
|
360
325
|
|
361
326
|
#{non_delivery_breadcrumb}
|
362
327
|
OUTPUT
|
@@ -406,11 +371,6 @@ describe ChefCLI::Command::GeneratorCommands::Cookbook do
|
|
406
371
|
Generating cookbook new_cookbook
|
407
372
|
- Ensuring correct cookbook content
|
408
373
|
- Committing cookbook files to git
|
409
|
-
- Ensuring delivery CLI configuration
|
410
|
-
- Ensuring correct Workflow (Delivery) build cookbook content
|
411
|
-
- Adding delivery configuration to feature branch
|
412
|
-
- Adding build cookbook to feature branch
|
413
|
-
- Merging delivery content feature branch to master
|
414
374
|
|
415
375
|
Your cookbook is ready. To setup the pipeline, type `cd new_cookbook`, then run `delivery init`
|
416
376
|
OUTPUT
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-cli
|
@@ -596,7 +596,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
596
596
|
requirements:
|
597
597
|
- - ">="
|
598
598
|
- !ruby/object:Gem::Version
|
599
|
-
version: '2.
|
599
|
+
version: '2.6'
|
600
600
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
601
601
|
requirements:
|
602
602
|
- - ">="
|