chef-tlc-workflow 0.2.0 → 0.3.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 +15 -0
- data/CHANGELOG.md +13 -0
- data/README.md +5 -38
- data/Rakefile +1 -1
- data/chef-tlc-workflow.gemspec +11 -9
- data/docs/TmpWorkflowTasks.md +3 -3
- data/lib/chef-tlc-workflow/helpers.rb +8 -64
- data/lib/{chef-workflow/tasks/tlc/deps.rb → chef-tlc-workflow/tasks.rb} +12 -22
- data/lib/chef-tlc-workflow/version.rb +1 -1
- data/test/sample-app/.gitignore +2 -0
- data/test/sample-app/Berksfile +3 -0
- data/test/sample-app/README.md +20 -20
- data/test/sample-app/Vagrantfile +49 -0
- data/test/vagrant-1.x-bootstrap/Gemfile +2 -2
- data/test/vagrant-1.x-bootstrap/Rakefile +1 -1
- data/test/vagrant-1.x-bootstrap/Vagrantfile +10 -7
- data/test/vagrant-1.x-bootstrap/ssh_key/chef-tlc-insecure-key +23 -0
- metadata +39 -58
- data/docs/TmpLibrarianHelpers.md +0 -21
- data/lib/chef-workflow/tasks/tlc.rb +0 -4
- data/lib/chef-workflow/tasks/tlc/test.rb +0 -15
- data/test/sample-app/Cheffile +0 -15
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Zjk4Zjk4YzRmNzRiM2M0YmM0OWI2OTZkNzRhNTY3NDg1NGVhNmJhYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDU4ZTkzYjJkZTdhNzgwM2Y3MzE4NGMwNDJkMmVkNTk1ZmJiNzgwYQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTk1MTVjYmFiZTYxOGJlZTdmM2U0MzczOTYzNDk1ZThlZTg0ZDgxMDcxMjM3
|
10
|
+
ZGI3YWViNGQ0ZTk0MjNmNjk2ZTVjZWUwNGQyYmU0YzgzODU1YmI1OWY2YmU4
|
11
|
+
NTg0OTE1YzAyNWJlZTZlMjI5OWVjNmU4MTBiMGZjOWYxNWNkMDk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDBlM2I2ZmU3N2JkMTcxYzAxMzA0YzNlYzI5YWI2ZTIxOTU2NjFlODhlODFi
|
14
|
+
ZjdhOTZhMzM5MzhkYTIyYzNiYmQ2YWQ1NzA4M2UzNDk1MDVkZmJhMjIxYTI4
|
15
|
+
Y2IwMTRiYmZkZGE2YjMzOWZhYWFhYTVkOTNjNTU3YzQyYThhNDk=
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
|
2
|
+
# [0.3.0] from 06/18/2013
|
3
|
+
|
4
|
+
* update to Chef 11 and yank chef-workflow-tasklib (GH-2)
|
5
|
+
* replace librarian-chef with [berkshelf](http://berkshelf.com/) (GH-3)
|
6
|
+
* update `test/sample-app`: add `Berksfile`, add `Vagrantfile` with [vagrant-berkshelf](https://github.com/riotgames/vagrant-berkshelf) plugin
|
7
|
+
* code cleanup, lots of code not needed anymore
|
8
|
+
|
9
|
+
# [0.2.0] from 06/11/2013
|
10
|
+
|
11
|
+
* update to Vagrant from 1.0 to 1.2 (GH-1)
|
12
|
+
* replace mccloud and knife-solo with [vagrant-aws](https://github.com/mitchellh/vagrant-aws) and [vagrant-managed-servers](https://github.com/tknerr/vagrant-managed-servers) providers
|
13
|
+
* update `Vagrantfile`s in `test/` directory for Vagrant 1.2
|
14
|
+
|
2
15
|
# [0.1.3] from 05/30/2013
|
3
16
|
|
4
17
|
* relax version constraint on vagrant gem so that both 1.0.5 and 1.0.5.1 ([windows fixes](https://github.com/mitchellh/vagrant/issues/247)) can be used
|
data/README.md
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
`chef-tlc-workflow` supports an opiniated workflow for working with Chef. It is based on the strict distinction of top-level vs. dependent cookbooks (see below) and it's currently focussed on chef-solo only.
|
4
4
|
|
5
|
-
|
5
|
+
It provides a [working sample](https://github.com/tknerr/chef-tlc-workflow/tree/master/test/vagrant-1.x-bootstrap) for deployment to esx, ec2 and local from within single `Vagrantfile`.
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
Finally, it ensures a consistent gem set by declaring all the gems we use in our workflow in its own gemspec, i.e. `chef-tlc-workflow` is the only gem you need to depend on - everything else (like vagrant, mcloud, etc..) comes in as transitive dependencies.
|
7
|
+
Also, it ensures a consistent gem set by declaring all the gems we use in our workflow in its own gemspec, i.e. `chef-tlc-workflow` is the only gem you need to depend on - everything else (like vagrant, mcloud, etc..) comes in as transitive dependencies.
|
10
8
|
|
11
9
|
|
12
10
|
## Terminology
|
@@ -63,10 +61,10 @@ Using multi_json (1.7.6)
|
|
63
61
|
Then you need to resolve the [sample-app](https://github.com/tknerr/chef-tlc-workflow/tree/master/test/sample-app) top-level cookbook along with all its dependencies into the `./cookbooks` directory:
|
64
62
|
```
|
65
63
|
$ rake resolve_sample_app
|
66
|
-
cd tmp/tlc/sample-app-0.1.0 &&
|
64
|
+
cd tmp/tlc/sample-app-0.1.0 && berks install --path D:/Repos/_github/chef-tlc-workflow/test/vagrant-1.x-bootstrap/cookbooks/sample-app-0.1.0
|
65
|
+
Using sample-app (0.1.0) at path: 'D:/Repos/_github/chef-tlc-workflow/test/sample-app'
|
67
66
|
Installing apache2 (1.5.0)
|
68
67
|
Installing apt (1.3.2)
|
69
|
-
Installing sample-app (0.1.0)
|
70
68
|
```
|
71
69
|
|
72
70
|
See, the dependencies are now resolved per top-level cookbook (i.e. `sample-app-0.1.0` in this case) separately:
|
@@ -97,37 +95,6 @@ vagrant up sample-app-esx --provider=managed
|
|
97
95
|
vagrant provision sample-app-esx
|
98
96
|
```
|
99
97
|
|
100
|
-
|
101
|
-
### Librarian Helper
|
102
|
-
|
103
|
-
**NOTE:** this is going to be replaced with Berkshelf soon
|
104
|
-
|
105
|
-
Since librarian does not support reading the cookbook dependencies from `metadata.rb`, the `ChefTLCWorkflow::Helpers` module adds this functionality.
|
106
|
-
|
107
|
-
In the trivial case you can use it in your cookbook project's `Cheffile` like so:
|
108
|
-
|
109
|
-
```ruby
|
110
|
-
require 'chef-tlc-workflow/helpers'
|
111
|
-
|
112
|
-
ChefTLCWorkflow::Helpers::from_metadata.each do |cb_name, cb_version|
|
113
|
-
cookbook cb_name, cb_version
|
114
|
-
end
|
115
|
-
```
|
116
|
-
|
117
|
-
If some of the cookbooks defined in metadata.rb are not available from the community site, you can define your overrides like so:
|
118
|
-
|
119
|
-
```ruby
|
120
|
-
...
|
121
|
-
@overrides = {
|
122
|
-
'tlc-base' => { :git => 'https://github.com/tknerr/cookbook-tlc-base.git', :ref => 'master' },
|
123
|
-
}
|
124
|
-
|
125
|
-
ChefTLCWorkflow::Helpers::from_metadata.each do |cb_name, cb_version|
|
126
|
-
cookbook cb_name, cb_version, @overrides[cb_name]
|
127
|
-
end
|
128
|
-
```
|
129
|
-
|
130
|
-
|
131
98
|
### Single Gemfile Dependency
|
132
99
|
|
133
100
|
It references all gems we need for our Chef workflow, this means that your `Gemfile` basically looks like this:
|
@@ -138,7 +105,7 @@ source :rubygems
|
|
138
105
|
gem "chef-tlc-workflow", "0.2.0"
|
139
106
|
```
|
140
107
|
|
141
|
-
This brings in all the transitive gem dependencies as defined in the `chef-tlc-workflow.gemspec`, e.g.
|
108
|
+
This brings in all the transitive gem dependencies as defined in the `chef-tlc-workflow.gemspec`, e.g. berkshelf, chef, foodcritic, etc...
|
142
109
|
|
143
110
|
While this is not ideal in terms of keeping the LOAD_PATH as small as possible, it's a tradeoff in favor of convenience and consistency.
|
144
111
|
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ task :test => [
|
|
11
11
|
# TODO:
|
12
12
|
# * rewrite as cucumber feature
|
13
13
|
# * check for apache default page
|
14
|
-
# * more realistic scenario: e.g. scaffold
|
14
|
+
# * more realistic scenario: e.g. scaffold infrastructure and app cookbook
|
15
15
|
#
|
16
16
|
desc "tests bootstrapping in an esx-like environment via vagrant-managed-servers provider"
|
17
17
|
task :test_vagrant_esx_bootstrap do
|
data/chef-tlc-workflow.gemspec
CHANGED
@@ -17,11 +17,14 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
# lock down dependencies
|
20
|
+
# lock down direct dependencies
|
21
21
|
#
|
22
|
-
gem.add_dependency 'chef
|
23
|
-
gem.add_dependency '
|
24
|
-
gem.add_dependency '
|
22
|
+
gem.add_dependency 'chef', '11.4.4'
|
23
|
+
gem.add_dependency 'berkshelf', '2.0.4'
|
24
|
+
gem.add_dependency 'rake'
|
25
|
+
|
26
|
+
# help bundler resolve the json conflict (see RiotGames/berkshelf#676)
|
27
|
+
gem.add_dependency 'json', '1.7.7'
|
25
28
|
|
26
29
|
#
|
27
30
|
# further dependencies that are not `require`d here but we pull in for convenience
|
@@ -29,13 +32,12 @@ Gem::Specification.new do |gem|
|
|
29
32
|
#
|
30
33
|
|
31
34
|
# testing related
|
32
|
-
gem.add_dependency 'foodcritic', '
|
33
|
-
gem.add_dependency 'chefspec', '
|
34
|
-
gem.add_dependency 'fauxhai', '
|
35
|
+
gem.add_dependency 'foodcritic', '2.0.1'
|
36
|
+
gem.add_dependency 'chefspec', '1.3.1'
|
37
|
+
gem.add_dependency 'fauxhai', '1.1.1'
|
35
38
|
|
36
39
|
# others
|
37
|
-
gem.add_dependency '
|
38
|
-
gem.add_dependency 'knife-solo_data_bag', '0.3.1'
|
40
|
+
gem.add_dependency 'knife-solo_data_bag', '0.4.0'
|
39
41
|
|
40
42
|
# need these on windows only
|
41
43
|
if RUBY_PLATFORM =~ /mswin|mingw/
|
data/docs/TmpWorkflowTasks.md
CHANGED
@@ -22,13 +22,13 @@ The `chef-tlc-workflow` makes our workflow for developing with Chef explict by a
|
|
22
22
|
* create
|
23
23
|
* release
|
24
24
|
* resolve_deps
|
25
|
-
* validate (
|
25
|
+
* validate (Berksfile in .gitignore)
|
26
26
|
* test (u.a. => test:converge, ggf. chef-workflow testlib?)
|
27
27
|
* app
|
28
28
|
* create
|
29
29
|
* release
|
30
30
|
* resolve_deps
|
31
|
-
* validate (=> u.a. deps:check,
|
31
|
+
* validate (=> u.a. deps:check, Berksfile nicht in .gitignore)
|
32
32
|
* test (was auch immer das heisst)
|
33
33
|
* infra
|
34
34
|
* create
|
@@ -71,7 +71,7 @@ Currently available are these tasks.
|
|
71
71
|
The `deps` namespace embodies the workflow concerning cookbook dependency management
|
72
72
|
|
73
73
|
* `tlc:deps:resolve` - resolve dependencies using [librarian](https://github.com/applicationsonline/librarian)
|
74
|
-
* `tlc:deps:check` - check if dependencies in `metadata.rb` and `
|
74
|
+
* `tlc:deps:check` - check if dependencies in `metadata.rb` and `Berksfile` are consistent
|
75
75
|
|
76
76
|
#### Cookbook Testing
|
77
77
|
|
@@ -16,59 +16,16 @@ module ChefTLCWorkflow
|
|
16
16
|
end
|
17
17
|
|
18
18
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
# { 'foo' => '1.0.0', 'bar' => '0.1.0' }
|
23
|
-
#
|
24
|
-
def self.read_cheffile_deps
|
25
|
-
require 'librarian/chef/environment'
|
26
|
-
env = ::Librarian::Chef::Environment.new
|
27
|
-
deps = env.spec.dependencies
|
28
|
-
Hash[deps.map { |dep| [dep.name, dep.requirement.to_s] }]
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# resolves the dependencies as specified in `Cheffile` and
|
33
|
-
# returns a map of dependency => version (including the
|
34
|
-
# transitive ones), e.g.:
|
19
|
+
# returns the resolved dependencies as specified in `Berksfile` as a
|
20
|
+
# map of dependency => version (including the transitive ones), e.g.:
|
35
21
|
#
|
36
22
|
# { 'foo' => '1.0.0', 'bar' => '0.1.0', 'baz_which_depends_on_bar' => '1.5.0' }
|
37
23
|
#
|
38
|
-
def self.
|
39
|
-
require '
|
40
|
-
|
41
|
-
deps
|
42
|
-
Hash[deps.map { |
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# returns the direct dependencies defined in `metadata.rb` as an
|
47
|
-
# array of triples:
|
48
|
-
#
|
49
|
-
# [[<cookbook_name>, <cookbook_version>, <location>], ...]
|
50
|
-
#
|
51
|
-
# where `<location>` is `nil`, unless the `locations_yml`
|
52
|
-
# parameter is given and the specified file contains a location
|
53
|
-
# mapping for `<cookbook_name>`
|
54
|
-
#
|
55
|
-
# Example usage in `Cheffile`:
|
56
|
-
#
|
57
|
-
# require 'chef-tlc-workflow/helpers'
|
58
|
-
#
|
59
|
-
# ChefTLCWorkflow::Helpers::from_metadata.each do |cb_name, cb_version, location|
|
60
|
-
# cookbook cb_name, cb_version, location
|
61
|
-
# end
|
62
|
-
#
|
63
|
-
def self.from_metadata(locations_yml = nil)
|
64
|
-
read_metadata_deps.to_a.map do |cb_name, cb_version|
|
65
|
-
if locations_yml
|
66
|
-
inferred_location = resolve_location_from_file(locations_yml, cb_name, cb_version)
|
67
|
-
else
|
68
|
-
inferred_location = nil
|
69
|
-
end
|
70
|
-
[cb_name, cb_version, inferred_location]
|
71
|
-
end
|
24
|
+
def self.read_berkshelf_deps
|
25
|
+
require 'json'
|
26
|
+
deps = JSON.parse(`berks list --format=json`)
|
27
|
+
fail "error resolving cookbooks: #{deps['errors']}" unless deps['errors'].empty?
|
28
|
+
Hash[deps['cookbooks'].map { |cb| [cb['name'], cb['version']] }]
|
72
29
|
end
|
73
30
|
|
74
31
|
#
|
@@ -90,6 +47,7 @@ module ChefTLCWorkflow
|
|
90
47
|
#
|
91
48
|
def self.read_app_cookbooks(yml_file, name = nil, version = nil)
|
92
49
|
# TODO: validate format
|
50
|
+
require 'yaml'
|
93
51
|
app_cookbooks = YAML.load_file yml_file
|
94
52
|
app_cookbooks.select! { |ac| ac['name'] == name } if name
|
95
53
|
app_cookbooks.select! { |ac| ac['version'] == version } if version
|
@@ -108,19 +66,5 @@ module ChefTLCWorkflow
|
|
108
66
|
end
|
109
67
|
end
|
110
68
|
|
111
|
-
private
|
112
|
-
|
113
|
-
def self.resolve_location_from_file(locations_yml, cb_name, cb_version)
|
114
|
-
cookbook_index = YAML.load_file(locations_yml)
|
115
|
-
if cookbook_index[cb_name]
|
116
|
-
default_opts = Hash.new
|
117
|
-
default_opts[:git] = cookbook_index[cb_name][:git] if cookbook_index[cb_name][:git]
|
118
|
-
default_opts[:ref] = cookbook_index[cb_name][:ref] if cookbook_index[cb_name][:ref]
|
119
|
-
version_specific_opts = cookbook_index[cb_name][cb_version] || {}
|
120
|
-
return default_opts.merge version_specific_opts
|
121
|
-
else
|
122
|
-
return nil
|
123
|
-
end
|
124
|
-
end
|
125
69
|
end
|
126
70
|
end
|
@@ -5,28 +5,25 @@ namespace :tlc do
|
|
5
5
|
require 'chef-tlc-workflow/helpers'
|
6
6
|
|
7
7
|
#
|
8
|
-
# resolve dependencies using
|
8
|
+
# resolve dependencies using berkshelf
|
9
9
|
#
|
10
10
|
task :resolve do
|
11
|
-
|
12
|
-
FileUtils.rm_rf('Cheffile.lock')
|
13
|
-
sh "librarian-chef clean"
|
14
|
-
sh "librarian-chef install"
|
11
|
+
sh "berks install"
|
15
12
|
end
|
16
13
|
|
17
14
|
#
|
18
|
-
# check if dependencies in metadata.rb and
|
15
|
+
# check if dependencies in metadata.rb and Berksfile are consistent
|
19
16
|
#
|
20
17
|
task :check do
|
21
18
|
errors = []
|
22
19
|
metadata_deps = ChefTLCWorkflow::Helpers::read_metadata_deps
|
23
|
-
|
24
|
-
|
20
|
+
resolved_deps = ChefTLCWorkflow::Helpers::read_berkshelf_deps
|
21
|
+
resolved_deps.each do | dep, version |
|
25
22
|
if metadata_deps.has_key?(dep)
|
26
23
|
metadata_ver = ::Gem::Requirement.new(metadata_deps[dep])
|
27
|
-
|
28
|
-
if metadata_ver !=
|
29
|
-
errors << "dependency version for '#{dep}' is inconsistent: '#{metadata_ver}' vs '#{
|
24
|
+
berkshelf_ver = ::Gem::Requirement.new(version)
|
25
|
+
if metadata_ver != berkshelf_ver
|
26
|
+
errors << "dependency version for '#{dep}' is inconsistent: '#{metadata_ver}' vs '#{berkshelf_ver}'!"
|
30
27
|
end
|
31
28
|
else
|
32
29
|
errors << "dependency '#{dep}' is missing in metadata.rb!"
|
@@ -48,11 +45,11 @@ namespace :tlc do
|
|
48
45
|
|
49
46
|
#
|
50
47
|
# resolve an application cookbook with all it's dependenices
|
51
|
-
# whilst honoring the application cookbook's
|
48
|
+
# whilst honoring the application cookbook's Berksfile:
|
52
49
|
#
|
53
50
|
# 1. clone (:git,:ref) or copy (:path) the app cookbook to './tmp'
|
54
51
|
# 2. resolve dependencies (inlcuding app cookbook itself) as defined in
|
55
|
-
# the app cookbook's
|
52
|
+
# the app cookbook's Berksfile to './cookbooks/<app-cookbook-name>-<version>'
|
56
53
|
#
|
57
54
|
#
|
58
55
|
def self.resolve_app_cookbook(app_cookbook)
|
@@ -80,17 +77,10 @@ namespace :tlc do
|
|
80
77
|
end
|
81
78
|
|
82
79
|
# resolve deps from tmp_dir into target_dir
|
83
|
-
fail "No
|
80
|
+
fail "No Berksfile found in '#{tmp_dir}'" unless File.exist? "#{tmp_dir}/Berksfile"
|
84
81
|
FileUtils.rm_rf target_dir
|
85
82
|
FileUtils.mkdir_p target_dir
|
86
|
-
sh "cd #{tmp_dir} &&
|
87
|
-
|
88
|
-
# copy application cookbook itself if it was not reference in Cheffile using `:path => '.'`
|
89
|
-
app_cookbook_in_targetdir = "#{target_dir}/#{name}"
|
90
|
-
unless File.exist? app_cookbook_in_targetdir
|
91
|
-
FileUtils.mkdir_p app_cookbook_in_targetdir
|
92
|
-
FileUtils.cp_r Dir.glob("#{tmp_dir}/*"), app_cookbook_in_targetdir
|
93
|
-
end
|
83
|
+
sh "cd #{tmp_dir} && berks install --path #{File.absolute_path(target_dir)}"
|
94
84
|
end
|
95
85
|
|
96
86
|
def self.cookbook_files_to_copy(path)
|
data/test/sample-app/README.md
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
Description
|
2
|
-
===========
|
3
|
-
|
4
|
-
A minimal sample
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
* strict dependency management - *all* dependency versions must be locked down in metadata.rb
|
9
|
-
*
|
10
|
-
|
11
|
-
|
12
|
-
Requirements
|
13
|
-
============
|
14
|
-
|
15
|
-
Attributes
|
16
|
-
==========
|
17
|
-
|
18
|
-
Usage
|
19
|
-
=====
|
20
|
-
|
1
|
+
Description
|
2
|
+
===========
|
3
|
+
|
4
|
+
A minimal sample top-level cookbook for testing.
|
5
|
+
|
6
|
+
Requirements of a top-level cookbook:
|
7
|
+
|
8
|
+
* strict dependency management - *all* dependency versions must be locked down in metadata.rb
|
9
|
+
* Berksfile must exist and is *not* in .gitignore - we need it when resolving its dependencies
|
10
|
+
|
11
|
+
|
12
|
+
Requirements
|
13
|
+
============
|
14
|
+
|
15
|
+
Attributes
|
16
|
+
==========
|
17
|
+
|
18
|
+
Usage
|
19
|
+
=====
|
20
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
# Vagrantfile for testing
|
3
|
+
#
|
4
|
+
# NOTE: you need the following plugins:
|
5
|
+
# - `vagrant plugin install vagrant-plugin-bundler --plugin-version 0.1.0`
|
6
|
+
#
|
7
|
+
Vagrant::configure("2") do |config|
|
8
|
+
|
9
|
+
# required vagrant plugins
|
10
|
+
config.plugin.deps do
|
11
|
+
depend 'vagrant-omnibus', '1.0.2'
|
12
|
+
depend 'vagrant-cachier', '0.1.0'
|
13
|
+
depend 'vagrant-berkshelf', '1.2.0'
|
14
|
+
end
|
15
|
+
|
16
|
+
# enable cachier
|
17
|
+
config.cache.auto_detect = true
|
18
|
+
# the Chef version to use
|
19
|
+
config.omnibus.chef_version = "11.4.4"
|
20
|
+
# enable berkshelf plugin
|
21
|
+
config.berkshelf.enabled = true
|
22
|
+
|
23
|
+
#
|
24
|
+
# define the sample-app VM
|
25
|
+
#
|
26
|
+
config.vm.define :"sample-app" do | sample_app_config |
|
27
|
+
|
28
|
+
# configure the basebox
|
29
|
+
sample_app_config.vm.box = "opscode_ubuntu-13.04_provisionerless"
|
30
|
+
sample_app_config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-13.04_provisionerless.box"
|
31
|
+
# configure host-only network
|
32
|
+
sample_app_config.vm.hostname = "sample-app-berkshelf.local"
|
33
|
+
sample_app_config.vm.network :private_network, ip: "33.33.40.15"
|
34
|
+
# virtualbox customizations
|
35
|
+
sample_app_config.vm.provider :virtualbox do |vbox, override|
|
36
|
+
vbox.customize ["modifyvm", :id, "--name", "sample-app-berkshelf.local"]
|
37
|
+
end
|
38
|
+
|
39
|
+
# provisioning
|
40
|
+
sample_app_config.vm.provision :chef_solo do |chef|
|
41
|
+
chef.add_recipe "sample-app"
|
42
|
+
chef.json = {
|
43
|
+
:sample_app => {
|
44
|
+
:words_of_wisdom => "Sample App with vagrant-berkshelf Plugin!"
|
45
|
+
}
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -31,7 +31,7 @@ def aws_config(instance_type)
|
|
31
31
|
override.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
|
32
32
|
# override ssh user and private key
|
33
33
|
override.ssh.username = "ubuntu"
|
34
|
-
override.ssh.private_key_path = "
|
34
|
+
override.ssh.private_key_path = "./ssh_key/chef-tlc-insecure-key"
|
35
35
|
|
36
36
|
# aws specific settings
|
37
37
|
aws.access_key_id = ENV['AWS_ACCESS_KEY']
|
@@ -40,8 +40,8 @@ def aws_config(instance_type)
|
|
40
40
|
aws.region = "eu-west-1"
|
41
41
|
aws.availability_zone = "eu-west-1c"
|
42
42
|
aws.instance_type = instance_type
|
43
|
-
aws.security_groups = [ "
|
44
|
-
aws.keypair_name = "
|
43
|
+
aws.security_groups = [ "ssh", "http" ]
|
44
|
+
aws.keypair_name = "chef-tlc-insecure-key"
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -60,13 +60,16 @@ end
|
|
60
60
|
# Vagrantfile for testing
|
61
61
|
#
|
62
62
|
# NOTE: you need the following plugins:
|
63
|
-
# - `vagrant plugin install vagrant-
|
64
|
-
# - `vagrant plugin install vagrant-managed-servers --plugin-version 0.1.0`
|
65
|
-
# - `vagrant plugin install vagrant-omnibus --plugin-version 1.0.2`
|
66
|
-
# - `vagrant plugin install vagrant-cachier --plugin-version 0.1.0`
|
63
|
+
# - `vagrant plugin install vagrant-plugin-bundler --plugin-version 0.1.0`
|
67
64
|
#
|
68
65
|
Vagrant::configure("2") do |config|
|
69
66
|
|
67
|
+
# required vagrant plugins
|
68
|
+
config.plugin.depend 'vagrant-aws', '0.2.2.rsyncfix'
|
69
|
+
config.plugin.depend 'vagrant-managed-servers', '0.1.0'
|
70
|
+
config.plugin.depend 'vagrant-omnibus', '1.0.2'
|
71
|
+
config.plugin.depend 'vagrant-cachier', '0.1.0'
|
72
|
+
|
70
73
|
# the Chef version to use
|
71
74
|
config.omnibus.chef_version = "11.4.4"
|
72
75
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEowIBAAKCAQEAsKLqz0Mkyv5w5hip7H1EV09NIvbYtY2Nc/r/zOUxdLl9bMj0tdmKmefdzWj7
|
3
|
+
afoa7e+4wbBNTlQD72Ar4D3aIMpNyplcpFQ6EXnfrwYgtjGdynavQv9/aKRmKcHn8l+BcMjVJcTA
|
4
|
+
biuIFbntR9waYkkaAwK4mzHcDI4/ENzNUuexTiPz3W0vNrMxmY9678DimZbjJjCtEkCiPDpnbmUO
|
5
|
+
scVzwSEdqoTRIHrIxI4MtOVWQJ3hobwyJYk5AzlkIS8p6U1qeTvIoMC8l+JTyERPziVGovhfTjrd
|
6
|
+
gjwFdXOgaOESaIP8la2Nu/29a+J7BFwllgwXfnx/uxAElMCmQFdpbwIDAQABAoIBAA9QcK87kQsQ
|
7
|
+
eFVauhDI4432UCfB4xQKi8MMdfUbwefu1RMDcUP68mtZkP9oJLQRfRg3+nrAgFNUMWslmWg9tJW3
|
8
|
+
NHtmRIPy0X4GZQBVtaxWLOoK1DMo17EI39qq9yMqaJyQrPozTsO+fnPzxMDAMoFm+RxdtgeukPd9
|
9
|
+
tbYOjrarPtpxbsUPcKp6590+ity7ZIyyyDsJyrgzaJDxAUQyjB0OfnBJQVk2iZQ1zsFO2hcTL7Xa
|
10
|
+
LQbQVkKQnHW6TpyfYQZFtRif2CmwoUfgNK++lLq/SRbfgi20ZHQI8uLGXZ3nvooBplIgIlK1QGc6
|
11
|
+
yOtZNAOroZgIciUjdRsEnkxH/7ECgYEA5GWotYbjCdbX8WExqSR2v6qSnrvnDYAodOLCzCK370o/
|
12
|
+
Mdv4KG5Dlz/QrgTeeDE7Sj4qljg22e0y7wRNdp+SqL4GZAwWvYAJsIBE9xQX5AMgTRVqhnEh347n
|
13
|
+
3G3MNAILxVx3fe9cAR3UReaeGT7TCugbSDjFDSqJoN2YhxvpCFsCgYEAxfvXjPso1ynPbllrD40x
|
14
|
+
Y4msjJnGKj+6m/zat6A0/kMXzm4jv4JdZQGU+bf0RTi53uiBCqtURuDkWE7QVs1NrMwt6cG2/Bm9
|
15
|
+
q+xLm5oqPLI9HsLIGbAEcKPhI7nVXIfAdzq3gdBJ9by6ZwJI+ISmx2EX8z2x8V3my5cADc0DD30C
|
16
|
+
gYAzeT3Ge3nbk9HjEpaQmikxFQ4qPArcng+AGELyorh1c3Q+lmadJgyRn842Cd7hk6bbGpuac1zZ
|
17
|
+
TH34JC4ZF+mDoh/qmFbfqmWEo8PnM14XAyVaegMh/Yk2ywwyP4SQDA3/EtHTTgicL87RWiIzaldB
|
18
|
+
1AGiCzlNuFKAMLDZck7YlQKBgQCIq66EAwmRZqpsGcwfQy+579sugCTdG3s9nVJ6+lw6vaQce8mv
|
19
|
+
tVW1mV729/bnJh6hc01JSTZ3a14WW+nUUgtx4s07Fd+0rixSF1+mPck0dzJcHsg1e13FSEvt9qYE
|
20
|
+
Jy5E4EK3mUrFGZBv9ZLcA+6BqlP3NTq2TUU6e7Ws0T5wnQKBgAwk4Eh3lUPiN7MOjsbzyXjfLrtv
|
21
|
+
DS9Oas7qQ4zJJGeh4SfCQcRCn8Q0EVetj5Xt2zEiSBUveWdtCNuBWE+F89YoEaey/GXiT1F9A9T/
|
22
|
+
/Re+YmI2ekmE+xNB8x15I02d0tDH2F+mzvSejDcgKXQlWCXbboHrCZ3DWje6Z1rMgVah
|
23
|
+
-----END RSA PRIVATE KEY-----
|
metadata
CHANGED
@@ -1,148 +1,130 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-tlc-workflow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Torben Knerr
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-18 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: chef
|
14
|
+
name: chef
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 11.4.4
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 11.4.4
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
28
|
+
name: berkshelf
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - '='
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: 2.0.4
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - '='
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
version: 2.0.4
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- - '
|
45
|
+
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0
|
47
|
+
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- - '
|
52
|
+
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
54
|
+
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
56
|
+
name: json
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - '='
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version: 1.7.
|
61
|
+
version: 1.7.7
|
70
62
|
type: :runtime
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - '='
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.7.
|
68
|
+
version: 1.7.7
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
70
|
+
name: foodcritic
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
73
|
- - '='
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
75
|
+
version: 2.0.1
|
86
76
|
type: :runtime
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
80
|
- - '='
|
92
81
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.
|
82
|
+
version: 2.0.1
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
84
|
+
name: chefspec
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - '='
|
100
88
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
89
|
+
version: 1.3.1
|
102
90
|
type: :runtime
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - '='
|
108
95
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
96
|
+
version: 1.3.1
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
98
|
+
name: fauxhai
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - '='
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
103
|
+
version: 1.1.1
|
118
104
|
type: :runtime
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - '='
|
124
109
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
110
|
+
version: 1.1.1
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: knife-solo_data_bag
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
115
|
- - '='
|
132
116
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.
|
117
|
+
version: 0.4.0
|
134
118
|
type: :runtime
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
122
|
- - '='
|
140
123
|
- !ruby/object:Gem::Version
|
141
|
-
version: 0.
|
124
|
+
version: 0.4.0
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: ruby-wmi
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
129
|
- - '='
|
148
130
|
- !ruby/object:Gem::Version
|
@@ -150,7 +132,6 @@ dependencies:
|
|
150
132
|
type: :runtime
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
136
|
- - '='
|
156
137
|
- !ruby/object:Gem::Version
|
@@ -158,7 +139,6 @@ dependencies:
|
|
158
139
|
- !ruby/object:Gem::Dependency
|
159
140
|
name: win32-service
|
160
141
|
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
142
|
requirements:
|
163
143
|
- - '='
|
164
144
|
- !ruby/object:Gem::Version
|
@@ -166,7 +146,6 @@ dependencies:
|
|
166
146
|
type: :runtime
|
167
147
|
prerelease: false
|
168
148
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
149
|
requirements:
|
171
150
|
- - '='
|
172
151
|
- !ruby/object:Gem::Version
|
@@ -186,18 +165,17 @@ files:
|
|
186
165
|
- Rakefile
|
187
166
|
- chef-tlc-workflow.gemspec
|
188
167
|
- docs/ApplicationVsLibraryVsForkedCookbooks.md
|
189
|
-
- docs/TmpLibrarianHelpers.md
|
190
168
|
- docs/TmpWorkflowTasks.md
|
191
169
|
- lib/chef-tlc-workflow.rb
|
192
170
|
- lib/chef-tlc-workflow/helpers.rb
|
171
|
+
- lib/chef-tlc-workflow/tasks.rb
|
193
172
|
- lib/chef-tlc-workflow/version.rb
|
194
|
-
- lib/chef-workflow/tasks/tlc.rb
|
195
|
-
- lib/chef-workflow/tasks/tlc/deps.rb
|
196
|
-
- lib/chef-workflow/tasks/tlc/test.rb
|
197
173
|
- test/esx_fake/Vagrantfile
|
174
|
+
- test/sample-app/.gitignore
|
175
|
+
- test/sample-app/Berksfile
|
198
176
|
- test/sample-app/CHANGELOG.md
|
199
|
-
- test/sample-app/Cheffile
|
200
177
|
- test/sample-app/README.md
|
178
|
+
- test/sample-app/Vagrantfile
|
201
179
|
- test/sample-app/attributes/default.rb
|
202
180
|
- test/sample-app/metadata.rb
|
203
181
|
- test/sample-app/recipes/default.rb
|
@@ -207,35 +185,37 @@ files:
|
|
207
185
|
- test/vagrant-1.x-bootstrap/Rakefile
|
208
186
|
- test/vagrant-1.x-bootstrap/Vagrantfile
|
209
187
|
- test/vagrant-1.x-bootstrap/app_cookbooks.yml
|
188
|
+
- test/vagrant-1.x-bootstrap/ssh_key/chef-tlc-insecure-key
|
210
189
|
homepage: https://github.com/tknerr/chef-tlc-workflow
|
211
190
|
licenses: []
|
191
|
+
metadata: {}
|
212
192
|
post_install_message:
|
213
193
|
rdoc_options: []
|
214
194
|
require_paths:
|
215
195
|
- lib
|
216
196
|
required_ruby_version: !ruby/object:Gem::Requirement
|
217
|
-
none: false
|
218
197
|
requirements:
|
219
198
|
- - ! '>='
|
220
199
|
- !ruby/object:Gem::Version
|
221
200
|
version: '0'
|
222
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
|
-
none: false
|
224
202
|
requirements:
|
225
203
|
- - ! '>='
|
226
204
|
- !ruby/object:Gem::Version
|
227
205
|
version: '0'
|
228
206
|
requirements: []
|
229
207
|
rubyforge_project:
|
230
|
-
rubygems_version:
|
208
|
+
rubygems_version: 2.0.3
|
231
209
|
signing_key:
|
232
|
-
specification_version:
|
210
|
+
specification_version: 4
|
233
211
|
summary: Chef Workflow based on the idea of Top-Level Cookbooks
|
234
212
|
test_files:
|
235
213
|
- test/esx_fake/Vagrantfile
|
214
|
+
- test/sample-app/.gitignore
|
215
|
+
- test/sample-app/Berksfile
|
236
216
|
- test/sample-app/CHANGELOG.md
|
237
|
-
- test/sample-app/Cheffile
|
238
217
|
- test/sample-app/README.md
|
218
|
+
- test/sample-app/Vagrantfile
|
239
219
|
- test/sample-app/attributes/default.rb
|
240
220
|
- test/sample-app/metadata.rb
|
241
221
|
- test/sample-app/recipes/default.rb
|
@@ -245,3 +225,4 @@ test_files:
|
|
245
225
|
- test/vagrant-1.x-bootstrap/Rakefile
|
246
226
|
- test/vagrant-1.x-bootstrap/Vagrantfile
|
247
227
|
- test/vagrant-1.x-bootstrap/app_cookbooks.yml
|
228
|
+
- test/vagrant-1.x-bootstrap/ssh_key/chef-tlc-insecure-key
|
data/docs/TmpLibrarianHelpers.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
|
2
|
-
## Librarian Helpers
|
3
|
-
|
4
|
-
Since librarian does not support reading the cookbook dependencies from `metadata.rb`,
|
5
|
-
the `ChefTLCWorkflow::Helpers` module adds this functionality.
|
6
|
-
|
7
|
-
In the trivial case you can use it in your cookbook project's `Cheffile` like so:
|
8
|
-
|
9
|
-
require 'chef-tlc-workflow/helpers'
|
10
|
-
|
11
|
-
ChefTLCWorkflow::Helpers::from_metadata.each do |cb_name, cb_version|
|
12
|
-
cookbook cb_name, cb_version
|
13
|
-
end
|
14
|
-
|
15
|
-
If some of the cookbooks defined in metadata.rb are not available from the community site,
|
16
|
-
you can provide a .yml file with custom location mappings and pass it to the helper method:
|
17
|
-
|
18
|
-
...
|
19
|
-
ChefTLCWorkflow::Helpers::from_metadata('../../locations.yml').each do |cb_name, cb_version, location|
|
20
|
-
cookbook cb_name, cb_version, location
|
21
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
namespace :tlc do
|
3
|
-
namespace :test do
|
4
|
-
|
5
|
-
#
|
6
|
-
# destroy the default Vagrant VM, resolve dependencies and converge the default Vagrant VM
|
7
|
-
#
|
8
|
-
task :converge do
|
9
|
-
sh "vagrant destroy -f"
|
10
|
-
Rake::Task["tlc:deps:resolve"].invoke
|
11
|
-
sh "vagrant up"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
data/test/sample-app/Cheffile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
site "http://community.opscode.com/api/v1"
|
2
|
-
|
3
|
-
require 'chef-tlc-workflow/helpers'
|
4
|
-
|
5
|
-
#
|
6
|
-
# read dependencies from metadata
|
7
|
-
#
|
8
|
-
ChefTLCWorkflow::Helpers::from_metadata.each do |cb_name, cb_version|
|
9
|
-
cookbook cb_name, cb_version
|
10
|
-
end
|
11
|
-
|
12
|
-
#
|
13
|
-
# resolve self for testing with vagrant
|
14
|
-
#
|
15
|
-
cookbook "sample-app", :path => '.'
|