Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.

Commit b14f9a7

Browse files
committed
Merge branch 'waipeng-master'
2 parents 61ec330 + c41d649 commit b14f9a7

File tree

6 files changed

+41
-15
lines changed

6 files changed

+41
-15
lines changed

.rubocop.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ Lint/AssignmentInCondition:
5151
Layout/IndentHeredoc:
5252
Enabled: false
5353

54+
Naming/HeredocDelimiterNaming:
55+
Enabled: false
56+
5457
Layout/SpaceBeforeComment:
5558
Enabled: True
5659

@@ -122,7 +125,7 @@ Lint/Void:
122125
Layout/AccessModifierIndentation:
123126
Enabled: True
124127

125-
Style/AccessorMethodName:
128+
Naming/AccessorMethodName:
126129
Enabled: True
127130

128131
Style/Alias:
@@ -158,7 +161,7 @@ Layout/CaseIndentation:
158161
Style/CharacterLiteral:
159162
Enabled: True
160163

161-
Style/ClassAndModuleCamelCase:
164+
Naming/ClassAndModuleCamelCase:
162165
Enabled: True
163166

164167
Style/ClassAndModuleChildren:
@@ -256,7 +259,7 @@ Style/CommentAnnotation:
256259
Metrics/CyclomaticComplexity:
257260
Enabled: False
258261

259-
Style/ConstantName:
262+
Naming/ConstantName:
260263
Enabled: True
261264

262265
Style/Documentation:
@@ -365,7 +368,7 @@ Style/UnlessElse:
365368
Style/VariableInterpolation:
366369
Enabled: True
367370

368-
Style/VariableName:
371+
Naming/VariableName:
369372
Enabled: True
370373

371374
Style/WhileUntilDo:
@@ -374,7 +377,7 @@ Style/WhileUntilDo:
374377
Style/EvenOdd:
375378
Enabled: True
376379

377-
Style/FileName:
380+
Naming/FileName:
378381
Enabled: False
379382

380383
Style/For:
@@ -383,7 +386,7 @@ Style/For:
383386
Style/Lambda:
384387
Enabled: True
385388

386-
Style/MethodName:
389+
Naming/MethodName:
387390
Enabled: True
388391

389392
Style/MultilineTernaryOperator:
@@ -419,7 +422,7 @@ Style/NumericLiterals:
419422
Style/OneLineConditional:
420423
Enabled: True
421424

422-
Style/OpMethod:
425+
Naming/BinaryOperatorParameter:
423426
Enabled: True
424427

425428
Style/ParenthesesAroundCondition:
@@ -431,7 +434,7 @@ Style/PercentLiteralDelimiters:
431434
Style/PerlBackrefs:
432435
Enabled: True
433436

434-
Style/PredicateName:
437+
Naming/PredicateName:
435438
Enabled: True
436439

437440
Style/RedundantException:

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,16 @@ First install the dependent modules into the local environment:
270270

271271
r10k puppetfile install --moduledir code/environments/production/modules
272272

273+
Create an `autosign.conf` file with the following:
274+
275+
```
276+
*.dockerbuilder.*
277+
```
278+
273279
Then, from the `examples/master` folder, use Docker to run an instance
274280
of Puppet Server:
275281

276-
docker run --name puppet -P --hostname puppet -v $(pwd)/code:/etc/puppetlabs/code puppet/puppetserver-standalone
282+
docker run --name puppet -P --hostname puppet -v $(pwd)/code:/etc/puppetlabs/code -v $(pwd)/autosign.conf:/etc/puppetlabs/puppet/autosign.conf puppet/puppetserver-standalone
277283

278284
Determine the port on which the Puppet Server is exposed locally:
279285

@@ -286,9 +292,6 @@ and {port} in the following with your own values.
286292

287293
This should use the code on the Puppet Master to build the image.
288294

289-
Note that this currently assumes the requested certificate is autosigned
290-
in some way, expect more guidance on that in the future.
291-
292295

293296
### Minimizing image size with Rocker
294297

lib/puppet_x/puppetlabs/imagebuilder.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ def determine_environment_vars
219219
end
220220
when 'debian'
221221
codename = case @context[:os_version]
222-
when 'latest', 'stable', 'stable-slim', 'stable-backports', 'jessie', 'jessie-slim', 'jessie-backports', %r{^8}
222+
when 'latest', 'stable', 'stable-slim', 'stable-backports', 'stretch', 'stretch-slim', 'stretch-backports', %r{^9}
223+
'stretch'
224+
when 'oldstable', 'oldstable-slim', 'oldstable-backports', 'jessie', 'jessie-slim', 'jessie-backports', %r{^8}
223225
'jessie'
224226
when 'sid', 'sid-slim'
225227
'sid'
@@ -281,7 +283,7 @@ def determine_environment_vars
281283
end
282284

283285
def determine_repository_details
284-
puppet5 = @context[:puppet_agent_version].to_f >= 5 ? true : false
286+
puppet5 = @context[:puppet_agent_version].to_f >= 5
285287
@context[:package_address], @context[:package_name] = case @context[:os]
286288
when 'ubuntu', 'debian'
287289
if puppet5
@@ -366,8 +368,12 @@ def apt_proxy_string
366368
@context[:apt_proxy].nil? ? '' : "--build-arg APT_PROXY=#{@context[:apt_proxy]}"
367369
end
368370

371+
def squash_string
372+
@context[:squash] ? '--squash' : ''
373+
end
374+
369375
def command_build_args
370-
"#{autosign_string} #{apt_proxy_string} #{http_proxy_string} #{https_proxy_string} #{string_args}"
376+
"#{autosign_string} #{apt_proxy_string} #{http_proxy_string} #{https_proxy_string} #{string_args} #{squash_string}"
371377
end
372378

373379
def docker_network

lib/puppet_x/puppetlabs/imagebuilder_face.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ class ImageBuilder::Face < Puppet::Face
3030
default_to { '2.5.5' }
3131
end
3232

33+
option '--r10k-yaml BOOLEAN' do
34+
summary 'When yes, copies the r10k.yaml file to the container before running r10k'
35+
default_to { false }
36+
end
37+
3338
option '--module-path PATH' do
3439
summary 'A path to a directory containing a set of modules to be copied into the image'
3540
end
@@ -124,6 +129,11 @@ class ImageBuilder::Face < Puppet::Face
124129
summary 'Pass the debug flag to the Puppet process used to build the container image'
125130
default_to { false }
126131
end
132+
133+
option '--squash' do
134+
summary 'Automatically squash all layers in the generated image'
135+
default_to { false }
136+
end
127137
end
128138
end
129139
end

spec/support/examples/imagebuilder.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@
593593
'12.04' => 'precise'
594594
},
595595
debian: {
596+
'9' => 'stretch',
596597
'8' => 'jessie',
597598
'7' => 'wheezy'
598599
}

templates/Dockerfile.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ RUN apk add --update git && \
7575
<%= gem_path %> install r10k:"$R10K_VERSION" --no-ri --no-rdoc && \
7676
rm -rf /var/cache/apk/*
7777
<% end %>
78+
<% if r10k_yaml %>
79+
COPY r10k.yaml /r10k.yaml
80+
<% end %>
7881
COPY <%= puppetfile %> /Puppetfile
7982
RUN <%= r10k_path %> puppetfile install --moduledir /etc/puppetlabs/code/modules
8083
<% end %>

0 commit comments

Comments
 (0)