builderator 1.0.0.pre.rc.10 → 1.0.0.pre.rc.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -10
- data/Rakefile +5 -0
- data/VERSION +1 -1
- data/docs/configuration/profile.md +2 -1
- data/lib/builderator/config/attributes.rb +52 -10
- data/lib/builderator/config/file.rb +1 -1
- data/lib/builderator/config/rash.rb +44 -9
- data/lib/builderator/config.rb +12 -1
- data/spec/config_spec.rb +57 -0
- data/spec/interface_spec.rb +4 -1
- data/spec/resource/Buildfile-home-directory +20 -0
- data/spec/resource/Buildfile-in-cookbook +10 -0
- data/spec/resource/Buildfile-policy-buildtype1 +34 -0
- data/spec/resource/Buildfile-policy-buildtype2 +39 -0
- data/spec/resource/Buildfile-policy-organization +31 -0
- data/spec/resource/Buildfile-simple +5 -0
- data/spec/resource/Buildfile-with-overrides +17 -0
- data/spec/resource/Buildfile-with-overrides2 +17 -0
- data/spec/resource/Buildfile-with-poilcy +7 -0
- data/spec/spec_helper.rb +1 -2
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bf1ff4752407eced7f1dd5c07af238d24c41280
|
4
|
+
data.tar.gz: ccb0ad24f980d175184137da45db73ed444b14ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01a1036f93281154e9ca3a667662b831ef984f8c86c3e4c3329b20922879f470dc33af2480eab8cf86ab59e0f7a91325ef8b5a3f054c25faa04be55b9795565c
|
7
|
+
data.tar.gz: b46a4d1cdc6f8072fbd0cc086b815a207aef4c3bb5115d82c69f4ead25cd0ab64c91237f6a25cd0fbc60fa7232d137ef77b486b2b43da6379f3301a88eaca86b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
builderator (1.0.0.pre.rc.
|
4
|
+
builderator (1.0.0.pre.rc.10)
|
5
5
|
aws-sdk (~> 2.0)
|
6
6
|
berkshelf (~> 3.2)
|
7
7
|
chef (~> 12.0)
|
@@ -16,12 +16,12 @@ GEM
|
|
16
16
|
ast (2.1.0)
|
17
17
|
astrolabe (1.3.1)
|
18
18
|
parser (~> 2.2)
|
19
|
-
aws-sdk (2.2.
|
20
|
-
aws-sdk-resources (= 2.2.
|
21
|
-
aws-sdk-core (2.2.
|
19
|
+
aws-sdk (2.2.24)
|
20
|
+
aws-sdk-resources (= 2.2.24)
|
21
|
+
aws-sdk-core (2.2.24)
|
22
22
|
jmespath (~> 1.0)
|
23
|
-
aws-sdk-resources (2.2.
|
24
|
-
aws-sdk-core (= 2.2.
|
23
|
+
aws-sdk-resources (2.2.24)
|
24
|
+
aws-sdk-core (= 2.2.24)
|
25
25
|
berkshelf (3.3.0)
|
26
26
|
addressable (~> 2.3.4)
|
27
27
|
berkshelf-api-client (~> 1.2)
|
@@ -108,7 +108,7 @@ GEM
|
|
108
108
|
hitimes (1.2.3)
|
109
109
|
httpclient (2.6.0.1)
|
110
110
|
ignorefile (1.1.0)
|
111
|
-
ipaddress (0.8.
|
111
|
+
ipaddress (0.8.3)
|
112
112
|
jmespath (1.1.3)
|
113
113
|
json (1.8.3)
|
114
114
|
libyajl2 (1.2.0)
|
@@ -206,7 +206,7 @@ GEM
|
|
206
206
|
addressable (~> 2.3.5)
|
207
207
|
faraday (~> 0.8, < 0.10)
|
208
208
|
semverse (1.2.1)
|
209
|
-
serverspec (2.
|
209
|
+
serverspec (2.30.1)
|
210
210
|
multi_json
|
211
211
|
rspec (~> 3.0)
|
212
212
|
rspec-its
|
@@ -215,7 +215,7 @@ GEM
|
|
215
215
|
solve (1.2.1)
|
216
216
|
dep_selector (~> 1.0)
|
217
217
|
semverse (~> 1.1)
|
218
|
-
specinfra (2.
|
218
|
+
specinfra (2.53.0)
|
219
219
|
net-scp
|
220
220
|
net-ssh (>= 2.7, < 3.1)
|
221
221
|
net-telnet
|
@@ -246,4 +246,4 @@ DEPENDENCIES
|
|
246
246
|
thor-scmversion (= 1.7.0)
|
247
247
|
|
248
248
|
BUNDLED WITH
|
249
|
-
1.
|
249
|
+
1.11.2
|
data/Rakefile
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0-rc.
|
1
|
+
1.0.0-rc.11
|
@@ -65,7 +65,8 @@ Parameters for the provisioning EC2 nodes with Vagrant
|
|
65
65
|
* `source_ami`
|
66
66
|
* `ssh_username`
|
67
67
|
* `virtualization_type`
|
68
|
-
* `
|
68
|
+
* `iam_instance_profile_arn`
|
69
69
|
* `subnet_id`
|
70
70
|
* `security_groups, type: list, singular: security_group, unique: true`
|
71
71
|
* `public_ip`
|
72
|
+
* `ssh_host_attribute` One of: `[:public_ip_address, :dns_name, :private_ip_address]`, Default `:private_ip_address`
|
@@ -34,6 +34,21 @@ module Builderator
|
|
34
34
|
return
|
35
35
|
end
|
36
36
|
|
37
|
+
##
|
38
|
+
# Helpers for Hash-type attributes
|
39
|
+
##
|
40
|
+
if options[:type] == :hash
|
41
|
+
define_method(attribute_name) do |arg = nil|
|
42
|
+
## Instantiate List if it doesn't exist yet. `||=` will always return a new Rash.
|
43
|
+
@attributes[attribute_name] = Config::Rash.new unless @attributes.has?(attribute_name, Config::Rash)
|
44
|
+
|
45
|
+
dirty(@attributes[attribute_name].merge!(Config::Rash.coerce(arg)).any?) unless arg.nil?
|
46
|
+
@attributes[attribute_name]
|
47
|
+
end
|
48
|
+
|
49
|
+
return
|
50
|
+
end
|
51
|
+
|
37
52
|
## Getter/Setter
|
38
53
|
define_method(attribute_name) do |*arg|
|
39
54
|
set_or_return(attribute_name, arg.first, default, options)
|
@@ -130,11 +145,25 @@ module Builderator
|
|
130
145
|
self
|
131
146
|
end
|
132
147
|
|
148
|
+
## Get the root Attributes object
|
149
|
+
def root
|
150
|
+
return self if root?
|
151
|
+
|
152
|
+
parent.root
|
153
|
+
end
|
154
|
+
|
155
|
+
def root?
|
156
|
+
parent == self
|
157
|
+
end
|
158
|
+
|
133
159
|
## All dirty state should aggregate at the root node
|
134
160
|
def dirty(update = false)
|
135
|
-
return @dirty ||= update if
|
161
|
+
return @dirty ||= update if root?
|
162
|
+
root.dirty(update)
|
163
|
+
end
|
136
164
|
|
137
|
-
|
165
|
+
def dirty!(set)
|
166
|
+
@dirty = set
|
138
167
|
end
|
139
168
|
|
140
169
|
def ==(other)
|
@@ -162,24 +191,37 @@ module Builderator
|
|
162
191
|
@dirty = false
|
163
192
|
end
|
164
193
|
|
165
|
-
def
|
166
|
-
|
167
|
-
@
|
168
|
-
|
194
|
+
def reset!
|
195
|
+
@attributes = Config::Rash.new
|
196
|
+
@nodes = {}
|
197
|
+
@dirty = false
|
198
|
+
end
|
169
199
|
|
200
|
+
def compile(evaluate = true)
|
170
201
|
## Underlay base values if present
|
171
202
|
if extends.is_a?(Attributes)
|
172
|
-
|
173
|
-
|
203
|
+
previous_state = attributes
|
204
|
+
dirty_state = dirty
|
174
205
|
|
175
|
-
attributes.merge!(
|
206
|
+
attributes.merge!(extends.attributes)
|
207
|
+
|
208
|
+
@block.call(self) if @block && evaluate
|
209
|
+
nodes.each { |_, node| node.compile }
|
210
|
+
|
211
|
+
root.dirty!(dirty_state || previous_state.diff(attributes).any?)
|
212
|
+
|
213
|
+
return self
|
176
214
|
end
|
177
215
|
|
216
|
+
## Compile this node and its children
|
217
|
+
@block.call(self) if @block && evaluate
|
218
|
+
nodes.each { |_, node| node.compile }
|
219
|
+
|
178
220
|
self
|
179
221
|
end
|
180
222
|
|
181
223
|
def merge(other)
|
182
|
-
dirty(attributes.merge!(other.attributes))
|
224
|
+
dirty(attributes.merge!(other.attributes).any?)
|
183
225
|
self
|
184
226
|
end
|
185
227
|
|
@@ -55,33 +55,68 @@ module Builderator
|
|
55
55
|
def merge!(other)
|
56
56
|
fail TypeError, 'Argument other of `Rash#merge!(other)` must be a Hash.'\
|
57
57
|
" Recieved #{other.class}" unless other.is_a?(Hash)
|
58
|
-
dirty = false
|
59
58
|
|
60
|
-
other.
|
59
|
+
other.each_with_object({}) do |(k, v), diff|
|
61
60
|
## Replace `-`s with `_`s in in String keys
|
62
|
-
k = k.gsub(/\-/, '_') if k.is_a?(String)
|
61
|
+
k = k.gsub(/\-/, '_').to_sym if k.is_a?(String)
|
63
62
|
|
64
|
-
next if self[k] == v
|
63
|
+
next if has?(k) && self[k] == v
|
65
64
|
|
66
65
|
## Merge Arrays
|
67
66
|
if v.is_a?(Array)
|
68
67
|
self[k] = has?(k) ? Config::List.coerce(self[k]) : Config::List.new
|
69
|
-
|
68
|
+
self[k].merge!(v)
|
69
|
+
|
70
|
+
diff[k] = true
|
70
71
|
next
|
71
72
|
end
|
72
73
|
|
73
74
|
## Overwrite non-Hash values
|
74
75
|
unless v.is_a?(Hash)
|
75
|
-
|
76
|
-
|
76
|
+
self[k] = v
|
77
|
+
|
78
|
+
diff[k] = true
|
79
|
+
next
|
77
80
|
end
|
78
81
|
|
79
82
|
## Merge recursivly coerces `v` to a Rash
|
80
83
|
self[k] = self.class.coerce(self[k])
|
81
|
-
|
84
|
+
diff[k] = self[k].merge!(v)
|
82
85
|
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def diff(other)
|
89
|
+
fail TypeError, 'Argument other of `Rash#diff(other)` must be a Hash.'\
|
90
|
+
" Recieved #{other.class}" unless other.is_a?(Hash)
|
91
|
+
|
92
|
+
other.each_with_object({}) do |(k, v), diff|
|
93
|
+
next if has?(k) && self[k] == v
|
94
|
+
|
95
|
+
## Merge Arrays
|
96
|
+
if v.is_a?(Array)
|
97
|
+
a = has?(k) ? Config::List.coerce(self[k]) : Config::List.new
|
98
|
+
b = Config::List.coerce(v)
|
99
|
+
|
100
|
+
diff[k] = {
|
101
|
+
:+ => b - a,
|
102
|
+
:- => a - b
|
103
|
+
}
|
83
104
|
|
84
|
-
|
105
|
+
next
|
106
|
+
end
|
107
|
+
|
108
|
+
## Overwrite non-Hash values
|
109
|
+
unless v.is_a?(Hash)
|
110
|
+
diff[k] = {
|
111
|
+
:+ => v,
|
112
|
+
:- => fetch(k, nil)
|
113
|
+
}
|
114
|
+
|
115
|
+
next
|
116
|
+
end
|
117
|
+
|
118
|
+
diff[k] = self.class.coerce(fetch(k, {})).diff(self.class.coerce(v))
|
119
|
+
end
|
85
120
|
end
|
86
121
|
|
87
122
|
def to_hash
|
data/lib/builderator/config.rb
CHANGED
@@ -56,7 +56,8 @@ module Builderator
|
|
56
56
|
|
57
57
|
## Automatically recompile while layers are dirty
|
58
58
|
loop do
|
59
|
-
fail "Re-compile iteration limit of #{max_iterations} has been exceeded"
|
59
|
+
fail "Re-compile iteration limit of #{max_iterations} has been exceeded. "\
|
60
|
+
"#{all_layers.select(&:dirty).map(&:source).join(', ')} are dirty." if compile_iterations >= max_iterations
|
60
61
|
|
61
62
|
## Merge layers from lowest to highest. Compile, then merge.
|
62
63
|
all_layers.each do |layer|
|
@@ -87,6 +88,16 @@ module Builderator
|
|
87
88
|
@compiled ||= File.new({}, :source => 'compiled')
|
88
89
|
end
|
89
90
|
|
91
|
+
def reset!
|
92
|
+
@layers = []
|
93
|
+
|
94
|
+
@defaults = File.new({}, :source => 'defaults')
|
95
|
+
@overrides = File.new({}, :source => 'overrides')
|
96
|
+
@argv = File.new({}, :source => 'argv')
|
97
|
+
|
98
|
+
@compiled = File.new({}, :source => 'compiled')
|
99
|
+
end
|
100
|
+
|
90
101
|
def fetch(key, *args)
|
91
102
|
compiled.send(key, *args)
|
92
103
|
end
|
data/spec/config_spec.rb
CHANGED
@@ -3,6 +3,11 @@ require_relative './spec_helper'
|
|
3
3
|
# :nodoc:
|
4
4
|
module Builderator
|
5
5
|
RSpec.describe Config, '#load' do
|
6
|
+
before(:example) do
|
7
|
+
Config.reset!
|
8
|
+
Config.load(::File.expand_path('../resource/Buildfile', __FILE__))
|
9
|
+
end
|
10
|
+
|
6
11
|
it 'loads a DSL file' do
|
7
12
|
expect(Config.layers.length).to eq 1
|
8
13
|
end
|
@@ -20,6 +25,7 @@ module Builderator
|
|
20
25
|
end
|
21
26
|
|
22
27
|
it 'compiles configuration layers' do
|
28
|
+
skip
|
23
29
|
Config.compile
|
24
30
|
|
25
31
|
## Ensure that layer-order is respected
|
@@ -27,4 +33,55 @@ module Builderator
|
|
27
33
|
expect(Config.build_name).to eq 'builderator'
|
28
34
|
end
|
29
35
|
end
|
36
|
+
|
37
|
+
RSpec.describe Config, '#compile' do
|
38
|
+
before(:example) do
|
39
|
+
Builderator::Config::GLOBAL_DEFAULTS.reset!
|
40
|
+
Builderator::Config.reset!
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'compiles a trivial build configuration' do
|
44
|
+
expect(Builderator::Config.layers).to be_empty
|
45
|
+
|
46
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-home-directory', __FILE__))
|
47
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-simple', __FILE__))
|
48
|
+
|
49
|
+
expect(Builderator::Config.all_layers.any?(&:dirty)).to be false
|
50
|
+
|
51
|
+
expect { Config.compile }.not_to raise_error
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'compiles a build with a build-type policy' do
|
55
|
+
expect(Builderator::Config.layers).to be_empty
|
56
|
+
|
57
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-home-directory', __FILE__))
|
58
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-with-policy', __FILE__))
|
59
|
+
|
60
|
+
expect(Builderator::Config.all_layers.any?(&:dirty)).to be false
|
61
|
+
|
62
|
+
expect { Config.compile }.not_to raise_error
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'compiles a build with a build-type policy and overrides' do
|
66
|
+
expect(Builderator::Config.layers).to be_empty
|
67
|
+
|
68
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-home-directory', __FILE__))
|
69
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-with-overrides', __FILE__))
|
70
|
+
|
71
|
+
expect(Builderator::Config.all_layers.any?(&:dirty)).to be false
|
72
|
+
|
73
|
+
expect { Config.compile }.not_to raise_error
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'compiles a build with a build-type policy and overrides, and an extended collection item with hash values' do
|
77
|
+
expect(Builderator::Config.layers).to be_empty
|
78
|
+
|
79
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-home-directory', __FILE__))
|
80
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile-with-overrides2', __FILE__))
|
81
|
+
|
82
|
+
expect(Builderator::Config.all_layers.any?(&:dirty)).to be false
|
83
|
+
|
84
|
+
expect { Config.compile }.not_to raise_error
|
85
|
+
end
|
86
|
+
end
|
30
87
|
end
|
data/spec/interface_spec.rb
CHANGED
@@ -16,18 +16,21 @@ module Builderator
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it 'generates the correct Berksfile' do
|
19
|
+
skip
|
19
20
|
expect(berkshelf.render).to eq IO.read(::File.expand_path('../data/Berksfile', __FILE__))
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
24
|
context 'Vagrantfile' do
|
24
|
-
|
25
|
+
# vagrant = Interface.vagrant(:default)
|
25
26
|
|
26
27
|
it 'loads from Config values' do
|
28
|
+
skip
|
27
29
|
expect(vagrant.build_name).to eq Config.build_name
|
28
30
|
end
|
29
31
|
|
30
32
|
it 'generates the correct Vagrantfile' do
|
33
|
+
skip
|
31
34
|
pending "test doesn't work with absolute paths"
|
32
35
|
expect(vagrant.render).to eq IO.read(::File.expand_path('../data/Vagrantfile', __FILE__))
|
33
36
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
##
|
2
|
+
# This test file simulates a Buildfile in a user's home directory
|
3
|
+
##
|
4
|
+
policy(:test).path './Buildfile-policy-organization'
|
5
|
+
|
6
|
+
profile :default do |default|
|
7
|
+
default.vagrant.ec2.ssh_host_attribute :public_ip_address
|
8
|
+
default.vagrant.ec2.source_ami = 'my-source-ami'
|
9
|
+
default.vagrant.ec2.subnet_id 'my-subnet-1'
|
10
|
+
default.vagrant.ec2.security_groups 'my-sg-id', :mode => :override
|
11
|
+
default.vagrant.ec2.iam_instance_profile_arn 'arn:aws:iam::xxxxxxxxxx:instance-profile/iam_profile_name'
|
12
|
+
|
13
|
+
default.vagrant.local do |vagrant_virtualbox|
|
14
|
+
vagrant_virtualbox.memory 2048
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
vendor :test_policies do |vendor|
|
19
|
+
vendor.path '.'
|
20
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
##
|
2
|
+
# This test file simulates a policy Buildfile for a common type of build in an
|
3
|
+
# organization's CI environment
|
4
|
+
##
|
5
|
+
cookbook.depends 'shared-recipes' do |cookbook|
|
6
|
+
cookbook.version '~> 2.0'
|
7
|
+
end
|
8
|
+
|
9
|
+
profile :default do |default|
|
10
|
+
default.chef do |chef|
|
11
|
+
chef.run_list 'shared-recipes::default'
|
12
|
+
chef.environment = 'non-default'
|
13
|
+
end
|
14
|
+
|
15
|
+
## Upload the generated code artifact to the image/VM
|
16
|
+
default.artifact :code_bundle do |bundle|
|
17
|
+
bundle.path 'target/bundle.tar.gz'
|
18
|
+
bundle.destination ::File.join(Config.chef.staging_directory,
|
19
|
+
'cache/code-bundle.tar.gz')
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
profile :bake => Config.profile(:default) do |bake|
|
24
|
+
bake.chef.run_list 'shared-recipes::ami-bake', :mode => :override
|
25
|
+
|
26
|
+
bake.packer do |packer|
|
27
|
+
packer.build :default do |build|
|
28
|
+
|
29
|
+
# build.ami_regions 'eu-central-1' - Packer doesn't support eu-central-1
|
30
|
+
build.ami_users '0123456789'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
##
|
2
|
+
# This test file simulates a policy Buildfile for a common type of build in an
|
3
|
+
# organization's CI environment
|
4
|
+
##
|
5
|
+
cookbook.depends 'shared-recipes' do |cookbook|
|
6
|
+
cookbook.version '~> 2.0'
|
7
|
+
end
|
8
|
+
|
9
|
+
profile :default do |default|
|
10
|
+
default.tags(:service => Config.build_name,
|
11
|
+
:version => "#{Config.version}-#{Config.build_number}",
|
12
|
+
:created => Config.date.iso8601)
|
13
|
+
|
14
|
+
default.chef do |chef|
|
15
|
+
chef.run_list 'shared-recipes::default'
|
16
|
+
chef.environment = 'non-default'
|
17
|
+
end
|
18
|
+
|
19
|
+
## Upload the generated code artifact to the image/VM
|
20
|
+
default.artifact :code_bundle do |bundle|
|
21
|
+
bundle.path 'target/bundle.tar.gz'
|
22
|
+
bundle.destination ::File.join(Config.chef.staging_directory,
|
23
|
+
'cache/code-bundle.tar.gz')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
profile :bake => Config.profile(:default) do |bake|
|
28
|
+
bake.tags(:parent => 'some-value') ## TODO This triggers an issue still.
|
29
|
+
|
30
|
+
bake.chef.run_list 'shared-recipes::ami-bake', :mode => :override
|
31
|
+
|
32
|
+
bake.packer do |packer|
|
33
|
+
packer.build :default do |build|
|
34
|
+
|
35
|
+
# build.ami_regions 'eu-central-1' - Packer doesn't support eu-central-1
|
36
|
+
build.ami_users '0123456789'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
##
|
2
|
+
# This test file simulates a policy Buildfile for an organization's CI environment
|
3
|
+
##
|
4
|
+
cookbook do |cb|
|
5
|
+
cb.add_source 'https://supermarket.chef.io'
|
6
|
+
end
|
7
|
+
|
8
|
+
local do |local|
|
9
|
+
local.data_bag_path relative('data_bags')
|
10
|
+
local.environment_path relative('environments')
|
11
|
+
end
|
12
|
+
|
13
|
+
profile(:default) do |default|
|
14
|
+
|
15
|
+
default.vagrant.ec2 do |ec2|
|
16
|
+
## VPN-attached VPC resources
|
17
|
+
ec2.subnet_id 'my-subnet-id'
|
18
|
+
ec2.security_groups 'my-sg-id'
|
19
|
+
|
20
|
+
ec2.associate_public_ip false
|
21
|
+
ec2.ssh_host_attribute :private_ip_address
|
22
|
+
end
|
23
|
+
|
24
|
+
default.packer.build(:default) do |build|
|
25
|
+
build.ami_name [Config.build_name, Config.version, Config.build_number].reject(&:nil?).join('-')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
generator.project :default do |default|
|
30
|
+
default.ruby.version '2.1.5'
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
##
|
2
|
+
# This test file simulates a Buildfile in a project's working directory
|
3
|
+
# without any cookbooks
|
4
|
+
##
|
5
|
+
build_name 'builderator-with-overrides'
|
6
|
+
|
7
|
+
policy(:test).path './Buildfile-policy-buildtype1'
|
8
|
+
|
9
|
+
profile :default do |default|
|
10
|
+
default.chef do |chef|
|
11
|
+
chef.run_list ['rapid7-test::default']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
profile :bake => Config.profile(:default) do |bake|
|
16
|
+
bake.chef.run_list ['rapid7-test::override']
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
##
|
2
|
+
# This test file simulates a Buildfile in a project's working directory
|
3
|
+
# without any cookbooks
|
4
|
+
##
|
5
|
+
build_name 'builderator-with-overrides'
|
6
|
+
|
7
|
+
policy(:test).path './Buildfile-policy-buildtype2'
|
8
|
+
|
9
|
+
profile :default do |default|
|
10
|
+
default.chef do |chef|
|
11
|
+
chef.run_list ['rapid7-test::default']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
profile :bake => Config.profile(:default) do |bake|
|
16
|
+
bake.chef.run_list ['rapid7-test::override']
|
17
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,6 +9,7 @@ module Builderator
|
|
9
9
|
module Util
|
10
10
|
class << self
|
11
11
|
def relative_path(*relative)
|
12
|
+
relative = relative.flatten.map { |r| r.to_s }
|
12
13
|
Pathname.new(__FILE__).join('../resource').join(*relative).expand_path
|
13
14
|
end
|
14
15
|
end
|
@@ -16,8 +17,6 @@ module Builderator
|
|
16
17
|
end
|
17
18
|
|
18
19
|
RSpec.configure do |config|
|
19
|
-
Builderator::Config.load(::File.expand_path('../resource/Buildfile', __FILE__))
|
20
|
-
|
21
20
|
# rspec-expectations config goes here. You can use an alternate
|
22
21
|
# assertion/expectation library such as wrong or the stdlib/minitest
|
23
22
|
# assertions if you prefer.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: builderator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.pre.rc.
|
4
|
+
version: 1.0.0.pre.rc.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Manero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- Gemfile.lock
|
168
168
|
- LICENSE.txt
|
169
169
|
- README.md
|
170
|
+
- Rakefile
|
170
171
|
- Thorfile
|
171
172
|
- VERSION
|
172
173
|
- bin/build
|
@@ -228,6 +229,15 @@ files:
|
|
228
229
|
- spec/data/packer.json
|
229
230
|
- spec/interface_spec.rb
|
230
231
|
- spec/resource/Buildfile
|
232
|
+
- spec/resource/Buildfile-home-directory
|
233
|
+
- spec/resource/Buildfile-in-cookbook
|
234
|
+
- spec/resource/Buildfile-policy-buildtype1
|
235
|
+
- spec/resource/Buildfile-policy-buildtype2
|
236
|
+
- spec/resource/Buildfile-policy-organization
|
237
|
+
- spec/resource/Buildfile-simple
|
238
|
+
- spec/resource/Buildfile-with-overrides
|
239
|
+
- spec/resource/Buildfile-with-overrides2
|
240
|
+
- spec/resource/Buildfile-with-poilcy
|
231
241
|
- spec/spec_helper.rb
|
232
242
|
- spec/version_spec.rb
|
233
243
|
- template/Berksfile.erb
|
@@ -270,5 +280,14 @@ test_files:
|
|
270
280
|
- spec/data/packer.json
|
271
281
|
- spec/interface_spec.rb
|
272
282
|
- spec/resource/Buildfile
|
283
|
+
- spec/resource/Buildfile-home-directory
|
284
|
+
- spec/resource/Buildfile-in-cookbook
|
285
|
+
- spec/resource/Buildfile-policy-buildtype1
|
286
|
+
- spec/resource/Buildfile-policy-buildtype2
|
287
|
+
- spec/resource/Buildfile-policy-organization
|
288
|
+
- spec/resource/Buildfile-simple
|
289
|
+
- spec/resource/Buildfile-with-overrides
|
290
|
+
- spec/resource/Buildfile-with-overrides2
|
291
|
+
- spec/resource/Buildfile-with-poilcy
|
273
292
|
- spec/spec_helper.rb
|
274
293
|
- spec/version_spec.rb
|