vanagon 0.15.22 → 0.15.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vanagon/component.rb +17 -0
- data/lib/vanagon/component/dsl.rb +11 -0
- data/lib/vanagon/engine/docker.rb +7 -2
- data/lib/vanagon/platform.rb +1 -0
- data/lib/vanagon/platform/dsl.rb +7 -0
- data/spec/lib/vanagon/component_spec.rb +43 -0
- metadata +33 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bf8cec1d39b4fe95d0d109181be2d573f5be24eb8e1241936b5b9035022ebbd
|
4
|
+
data.tar.gz: bc390abf3fe18a06fb82d7ed4936f54ca4f64840bb1b4374ec7f4a5d0c3119f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afd0ca4f73413d2f228e520f1456aa4f8c59cd9c28cd36522fc43a74d8b38d0e43b3a032de8703f3d821d469d02d12d9e9cf03c2456920bf820bfe218d86955a
|
7
|
+
data.tar.gz: '08197372b61873aacff50c307f23fa80e7b566e6ad2c45bd98b7d662d101650f79594227438cd192febe4037d8746b44b472810663e3d13e80c6cfab2036b8cc'
|
data/lib/vanagon/component.rb
CHANGED
@@ -383,6 +383,23 @@ class Vanagon
|
|
383
383
|
end
|
384
384
|
end
|
385
385
|
|
386
|
+
# Force version determination for components
|
387
|
+
#
|
388
|
+
# If the component doesn't already have a version set (which normally happens for git sources),
|
389
|
+
# the source will be fetched into a temporary directory to attempt to figure out the version if the
|
390
|
+
# source type supports :version. This directory will be cleaned once the get_sources method returns
|
391
|
+
#
|
392
|
+
# @raise Vanagon::Error raises a vanagon error if we're unable to determine the version
|
393
|
+
def force_version
|
394
|
+
if @version.nil?
|
395
|
+
Dir.mktmpdir do |dir|
|
396
|
+
get_source(dir)
|
397
|
+
end
|
398
|
+
end
|
399
|
+
raise Vanagon::Error, "Unable to determine source version for component #{@name}!" if @version.nil?
|
400
|
+
@version
|
401
|
+
end
|
402
|
+
|
386
403
|
# Prints the environment in a way suitable for use in a Makefile
|
387
404
|
# or shell script. This is deprecated, because all Env. Vars. are
|
388
405
|
# moving directly into the Makefile (and out of recipe subshells).
|
@@ -512,6 +512,17 @@ class Vanagon
|
|
512
512
|
@component.preremove_actions << OpenStruct.new(:pkg_state => pkg_state, :scripts => scripts)
|
513
513
|
end
|
514
514
|
|
515
|
+
# Force version determination for components
|
516
|
+
#
|
517
|
+
# If the component doesn't already have a version set (which normally happens for git sources),
|
518
|
+
# the source will be fetched into a temporary directory to attempt to figure out the version if the
|
519
|
+
# source type supports :version. This directory will be cleaned once the get_sources method returns
|
520
|
+
#
|
521
|
+
# @raise Vanagon::Error raises a vanagon error if we're unable to determine the version
|
522
|
+
def get_version_forced
|
523
|
+
@component.force_version
|
524
|
+
end
|
525
|
+
|
515
526
|
# Adds action to run during the postremoval phase of packaging
|
516
527
|
#
|
517
528
|
# @param pkg_state [Array] the state in which the scripts should execute. Can be
|
@@ -21,7 +21,10 @@ class Vanagon
|
|
21
21
|
def build_host_name
|
22
22
|
if @build_host_name.nil?
|
23
23
|
validate_platform
|
24
|
-
|
24
|
+
# Docker requires container names to match: [a-zA-Z0-9][a-zA-Z0-9_.-]
|
25
|
+
# So, transform slashes and colons commonly used as separators in
|
26
|
+
# image names.
|
27
|
+
@build_host_name = @platform.docker_image.gsub(%r{[/:]}, '_')
|
25
28
|
end
|
26
29
|
|
27
30
|
@build_host_name
|
@@ -31,7 +34,9 @@ class Vanagon
|
|
31
34
|
# a docker container.
|
32
35
|
# @raise [Vanagon::Error] if a target cannot be obtained
|
33
36
|
def select_target
|
34
|
-
|
37
|
+
extra_args = @platform.docker_run_args.nil? ? [] : @platform.docker_run_args
|
38
|
+
|
39
|
+
Vanagon::Utilities.ex("#{@docker_cmd} run -d --name #{build_host_name}-builder -p #{@platform.ssh_port}:22 #{extra_args.join(' ')} #{@platform.docker_image}")
|
35
40
|
@target = 'localhost'
|
36
41
|
|
37
42
|
# Wait for ssh to come up in the container
|
data/lib/vanagon/platform.rb
CHANGED
data/lib/vanagon/platform/dsl.rb
CHANGED
@@ -277,6 +277,13 @@ class Vanagon
|
|
277
277
|
@platform.docker_image = image_name
|
278
278
|
end
|
279
279
|
|
280
|
+
# Set additional `docker run` arguments to pass when creating containers
|
281
|
+
#
|
282
|
+
# @param args [Array<String>] array of CLI arguments for `docker run`
|
283
|
+
def docker_run_args(args)
|
284
|
+
@platform.docker_run_args = Array(args)
|
285
|
+
end
|
286
|
+
|
280
287
|
# Set the ami for the platform to use
|
281
288
|
#
|
282
289
|
# @param ami [String] the ami id used.
|
@@ -242,6 +242,49 @@ describe "Vanagon::Component" do
|
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
245
|
+
describe '#force_version' do
|
246
|
+
let(:source) {
|
247
|
+
allow(File).to receive(:realpath).and_return('/this/is/a/test')
|
248
|
+
Vanagon::Component::Source::Git.new('git://github.com/puppetlabs/facter', workdir: '/this/is/a/test')
|
249
|
+
}
|
250
|
+
|
251
|
+
let(:component) {
|
252
|
+
Vanagon::Component.new('force-version-test', {}, {}).tap do |comp|
|
253
|
+
comp.url = 'git://github.com/puppetlabs/facter'
|
254
|
+
comp.source = source
|
255
|
+
end
|
256
|
+
}
|
257
|
+
|
258
|
+
let(:versioned_component) {
|
259
|
+
Vanagon::Component.new('force-version-test', {}, {}).tap do |comp|
|
260
|
+
comp.version = '1.2.3'
|
261
|
+
end
|
262
|
+
}
|
263
|
+
|
264
|
+
it 'returns a version if it\'s already set' do
|
265
|
+
expect(versioned_component).not_to receive(:get_source)
|
266
|
+
expect(versioned_component.force_version).to eq('1.2.3')
|
267
|
+
end
|
268
|
+
|
269
|
+
it 'fetches sources if no version is set' do
|
270
|
+
clone = double(Git::Base)
|
271
|
+
allow(::Git).to receive(:clone).and_return(clone)
|
272
|
+
allow(clone).to receive(:describe).and_return('4.5.6')
|
273
|
+
allow(clone).to receive(:checkout).and_return(nil)
|
274
|
+
allow(clone).to receive(:update_submodules).and_return(nil)
|
275
|
+
expect(component.force_version).to eq('4.5.6')
|
276
|
+
end
|
277
|
+
|
278
|
+
it 'fails if it can\'t determine the version' do
|
279
|
+
clone = double(Git::Base)
|
280
|
+
allow(::Git).to receive(:clone).and_return(clone)
|
281
|
+
allow(clone).to receive(:describe).and_return(nil)
|
282
|
+
allow(clone).to receive(:checkout).and_return(nil)
|
283
|
+
allow(clone).to receive(:update_submodules).and_return(nil)
|
284
|
+
expect{ component.force_version }.to raise_error(Vanagon::Error, /unable to determine source version/i)
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
245
288
|
describe 'rpm ghost files' do
|
246
289
|
let(:component) { Vanagon::Component.new('ghost-test', {}, {}) }
|
247
290
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanagon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -260,46 +260,47 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
260
|
- !ruby/object:Gem::Version
|
261
261
|
version: '0'
|
262
262
|
requirements: []
|
263
|
-
|
263
|
+
rubyforge_project:
|
264
|
+
rubygems_version: 2.7.6
|
264
265
|
signing_key:
|
265
266
|
specification_version: 3
|
266
267
|
summary: All of your packages will fit into this van with this one simple trick.
|
267
268
|
test_files:
|
268
|
-
- spec/lib/git/rev_list_spec.rb
|
269
|
-
- spec/lib/makefile_spec.rb
|
270
|
-
- spec/lib/vanagon/common/pathname_spec.rb
|
271
|
-
- spec/lib/vanagon/common/user_spec.rb
|
272
|
-
- spec/lib/vanagon/component/dsl_spec.rb
|
273
|
-
- spec/lib/vanagon/component/rules_spec.rb
|
274
|
-
- spec/lib/vanagon/component/source/git_spec.rb
|
275
|
-
- spec/lib/vanagon/component/source/http_spec.rb
|
276
|
-
- spec/lib/vanagon/component/source/local_spec.rb
|
277
|
-
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
278
|
-
- spec/lib/vanagon/component/source_spec.rb
|
279
269
|
- spec/lib/vanagon/component_spec.rb
|
270
|
+
- spec/lib/vanagon/project_spec.rb
|
271
|
+
- spec/lib/vanagon/optparse_spec.rb
|
280
272
|
- spec/lib/vanagon/driver_spec.rb
|
281
|
-
- spec/lib/vanagon/engine/always_be_scheduling_spec.rb
|
282
|
-
- spec/lib/vanagon/engine/base_spec.rb
|
283
|
-
- spec/lib/vanagon/engine/docker_spec.rb
|
284
|
-
- spec/lib/vanagon/engine/ec2_spec.rb
|
285
|
-
- spec/lib/vanagon/engine/hardware_spec.rb
|
286
|
-
- spec/lib/vanagon/engine/local_spec.rb
|
287
|
-
- spec/lib/vanagon/engine/pooler_spec.rb
|
288
273
|
- spec/lib/vanagon/environment_spec.rb
|
289
|
-
- spec/lib/vanagon/
|
290
|
-
- spec/lib/vanagon/
|
291
|
-
- spec/lib/vanagon/
|
292
|
-
- spec/lib/vanagon/optparse_spec.rb
|
293
|
-
- spec/lib/vanagon/platform/deb_spec.rb
|
274
|
+
- spec/lib/vanagon/platform/windows_spec.rb
|
275
|
+
- spec/lib/vanagon/platform/solaris_11_spec.rb
|
276
|
+
- spec/lib/vanagon/platform/solaris_10_spec.rb
|
294
277
|
- spec/lib/vanagon/platform/dsl_spec.rb
|
295
278
|
- spec/lib/vanagon/platform/osx_spec.rb
|
296
|
-
- spec/lib/vanagon/platform/
|
279
|
+
- spec/lib/vanagon/platform/deb_spec.rb
|
297
280
|
- spec/lib/vanagon/platform/rpm_spec.rb
|
298
|
-
- spec/lib/vanagon/platform/
|
299
|
-
- spec/lib/vanagon/
|
300
|
-
- spec/lib/vanagon/
|
301
|
-
- spec/lib/vanagon/
|
281
|
+
- spec/lib/vanagon/platform/rpm/aix_spec.rb
|
282
|
+
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
283
|
+
- spec/lib/vanagon/component/source/git_spec.rb
|
284
|
+
- spec/lib/vanagon/component/source/local_spec.rb
|
285
|
+
- spec/lib/vanagon/component/source/http_spec.rb
|
286
|
+
- spec/lib/vanagon/component/dsl_spec.rb
|
287
|
+
- spec/lib/vanagon/component/source_spec.rb
|
288
|
+
- spec/lib/vanagon/component/rules_spec.rb
|
289
|
+
- spec/lib/vanagon/extensions/string_spec.rb
|
290
|
+
- spec/lib/vanagon/extensions/set/json_spec.rb
|
291
|
+
- spec/lib/vanagon/extensions/ostruct/json_spec.rb
|
302
292
|
- spec/lib/vanagon/project/dsl_spec.rb
|
303
|
-
- spec/lib/vanagon/project_spec.rb
|
304
293
|
- spec/lib/vanagon/utilities/shell_utilities_spec.rb
|
305
294
|
- spec/lib/vanagon/utilities_spec.rb
|
295
|
+
- spec/lib/vanagon/common/pathname_spec.rb
|
296
|
+
- spec/lib/vanagon/common/user_spec.rb
|
297
|
+
- spec/lib/vanagon/platform_spec.rb
|
298
|
+
- spec/lib/vanagon/engine/always_be_scheduling_spec.rb
|
299
|
+
- spec/lib/vanagon/engine/docker_spec.rb
|
300
|
+
- spec/lib/vanagon/engine/ec2_spec.rb
|
301
|
+
- spec/lib/vanagon/engine/hardware_spec.rb
|
302
|
+
- spec/lib/vanagon/engine/local_spec.rb
|
303
|
+
- spec/lib/vanagon/engine/base_spec.rb
|
304
|
+
- spec/lib/vanagon/engine/pooler_spec.rb
|
305
|
+
- spec/lib/makefile_spec.rb
|
306
|
+
- spec/lib/git/rev_list_spec.rb
|