vanagon 0.34.0 → 0.35.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae6556da0f96b7521a38d26be19def6e520dbfbcfcb29518dd64a4ffee5e370c
4
- data.tar.gz: 171786b0b94db1a5caf4ad280d47b816e34a4c72f5e8049b6e970ad088c2202f
3
+ metadata.gz: 4f8772f1446c288009a4909d14a0443687fa83ed0013062b5110bf87dd07bdf4
4
+ data.tar.gz: 63412e68e08b5a2d4eb4f39bc04ac2840373127ab2869a9aa7a9842298abe2b8
5
5
  SHA512:
6
- metadata.gz: 2b31b5db82382402b119c009a896e6a43edcb90cf9dcb322f606f2d805f8af1d5abdbbc0b0c59eb79a97949d7100821142c379807ab0e8affcdb20673e5c694a
7
- data.tar.gz: fc3d985c8ad2fa6b5aabb3d9e1d715eb9b615aeef71f7054379afae466c74b261f073d3d22245933ded9996c1cc04d7ce2f084aa62191c148f12ec5c0335a6de
6
+ metadata.gz: 8777b1881b31ea9c3f34a97730a5cd5f4fd136de88364ccc8efabdbf55507b11b0302859d56dec8ef9b3a9bf0dad115cf271a81e895bade588b1394bf941246f
7
+ data.tar.gz: bf3bc5fdeb639925bcfe284aa5e088bff53fe2ec581a60ba01cb971690256b31ff627d78aa5153f39bef4324ca93a8457d514479e1cf6adbc1a719ff89106a85
@@ -9,8 +9,9 @@ class Vanagon
9
9
  def initialize(platform, target = nil, **opts)
10
10
  @platform = platform
11
11
  @required_attributes = ["ssh_port"]
12
- @target = target if target
13
- @target_user = @platform.target_user
12
+ parse_target_defaults(target) if target
13
+ @target_port ||= @platform.ssh_port
14
+ @target_user ||= @platform.target_user
14
15
  @remote_workdir_path = opts[:remote_workdir]
15
16
  end
16
17
 
@@ -19,6 +20,17 @@ class Vanagon
19
20
  'base'
20
21
  end
21
22
 
23
+ def parse_target_defaults(target)
24
+ # If there's no scheme, we need to add // to make it parse properly
25
+ target_uri = target.include?('//') ? URI.parse(target) : URI.parse("//#{target}")
26
+ @target = target_uri.hostname
27
+ @target_port = target_uri.port
28
+ @target_user = target_uri.user
29
+ rescue URI::Error
30
+ # Just assume it's not meant to be a URI
31
+ @target = target
32
+ end
33
+
22
34
  # Get the engine specific name of the host to build on
23
35
  def build_host_name
24
36
  raise Vanagon::Error, '#build_host_name has not been implemented for your engine.'
@@ -32,7 +44,7 @@ class Vanagon
32
44
 
33
45
  # Dispatches the command for execution
34
46
  def dispatch(command, return_output = false)
35
- Vanagon::Utilities.remote_ssh_command("#{@target_user}@#{@target}", command, @platform.ssh_port, return_command_output: return_output)
47
+ Vanagon::Utilities.remote_ssh_command("#{@target_user}@#{@target}", command, @target_port, return_command_output: return_output)
36
48
  end
37
49
 
38
50
  # Steps needed to tear down or clean up the system after the build is
@@ -70,7 +82,7 @@ class Vanagon
70
82
  end
71
83
 
72
84
  def ship_workdir(workdir)
73
- Vanagon::Utilities.rsync_to("#{workdir}/*", "#{@target_user}@#{@target}", @remote_workdir, @platform.ssh_port)
85
+ Vanagon::Utilities.rsync_to("#{workdir}/*", "#{@target_user}@#{@target}", @remote_workdir, @target_port)
74
86
  end
75
87
 
76
88
  def retrieve_built_artifact(artifacts_to_fetch, no_packaging)
@@ -80,7 +92,7 @@ class Vanagon
80
92
  artifacts_to_fetch << "#{@remote_workdir}/output/*"
81
93
  end
82
94
  artifacts_to_fetch.each do |path|
83
- Vanagon::Utilities.rsync_from(path, "#{@target_user}@#{@target}", output_path, @platform.ssh_port)
95
+ Vanagon::Utilities.rsync_from(path, "#{@target_user}@#{@target}", output_path, @target_port)
84
96
  end
85
97
  end
86
98
 
@@ -36,11 +36,11 @@ class Vanagon
36
36
  # a docker container.
37
37
  # @raise [Vanagon::Error] if a target cannot be obtained
38
38
  def select_target
39
- ssh_args = @platform.use_docker_exec ? '' : "-p #{@platform.ssh_port}:22"
39
+ ssh_args = @platform.use_docker_exec ? '' : "-p #{@target_port}:22"
40
40
  extra_args = @platform.docker_run_args.nil? ? [] : @platform.docker_run_args
41
41
 
42
42
  Vanagon::Utilities.ex("#{@docker_cmd} run -d --name #{build_host_name}-builder #{ssh_args} #{extra_args.join(' ')} #{@platform.docker_image}")
43
- @target = 'localhost'
43
+ @target = URI.new('localhost')
44
44
 
45
45
  wait_for_ssh unless @platform.use_docker_exec
46
46
  rescue StandardError => e
@@ -141,7 +141,7 @@ class Vanagon
141
141
  def wait_for_ssh
142
142
  Vanagon::Utilities.retry_with_timeout(5, 5) do
143
143
  begin
144
- Vanagon::Utilities.remote_ssh_command("#{@target_user}@#{@target}", 'exit', @platform.ssh_port)
144
+ Vanagon::Utilities.remote_ssh_command("#{@target_user}@#{@target}", 'exit', @target_port)
145
145
  rescue StandardError => e
146
146
  sleep(1) # Give SSHD some time to start.
147
147
  raise e
@@ -5,6 +5,8 @@ platform "osx-10.15-x86_64" do |plat|
5
5
 
6
6
  plat.provision_with "export HOMEBREW_NO_EMOJI=true"
7
7
  plat.provision_with "export HOMEBREW_VERBOSE=true"
8
+ plat.provision_with "export HOMEBREW_NO_ANALYTICS=1"
9
+
8
10
  plat.provision_with "sudo dscl . -create /Users/test"
9
11
  plat.provision_with "sudo dscl . -create /Users/test UserShell /bin/bash"
10
12
  plat.provision_with "sudo dscl . -create /Users/test UniqueID 1001"
@@ -15,7 +17,7 @@ platform "osx-10.15-x86_64" do |plat|
15
17
  plat.provision_with "echo 'test ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/username"
16
18
  plat.provision_with "mkdir -p /etc/homebrew"
17
19
  plat.provision_with "cd /etc/homebrew"
20
+ plat.provision_with "createhomedir -c -u test"
18
21
  plat.provision_with %Q(su test -c 'echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
19
- plat.provision_with "sudo chown -R test:admin /Users/test/"
20
22
  plat.vmpooler_template "osx-1015-x86_64"
21
23
  end
@@ -0,0 +1,24 @@
1
+ platform "osx-11-arm64" do |plat|
2
+ plat.servicetype "launchd"
3
+ plat.servicedir "/Library/LaunchDaemons"
4
+ plat.codename "bigsur"
5
+
6
+ plat.provision_with "export HOMEBREW_NO_EMOJI=true"
7
+ plat.provision_with "export HOMEBREW_VERBOSE=true"
8
+ plat.provision_with "export HOMEBREW_NO_ANALYTICS=1"
9
+
10
+ plat.provision_with "sudo dscl . -create /Users/test"
11
+ plat.provision_with "sudo dscl . -create /Users/test UserShell /bin/bash"
12
+ plat.provision_with "sudo dscl . -create /Users/test UniqueID 1001"
13
+ plat.provision_with "sudo dscl . -create /Users/test PrimaryGroupID 1000"
14
+ plat.provision_with "sudo dscl . -create /Users/test NFSHomeDirectory /Users/test"
15
+ plat.provision_with "sudo dscl . -passwd /Users/test password"
16
+ plat.provision_with "sudo dscl . -merge /Groups/admin GroupMembership test"
17
+ plat.provision_with "echo 'test ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/username"
18
+ plat.provision_with "mkdir -p /etc/homebrew"
19
+ plat.provision_with "cd /etc/homebrew"
20
+ plat.provision_with "createhomedir -c -u test"
21
+ plat.provision_with %(su test -c 'echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
22
+ plat.vmpooler_template "macos-112-x86_64"
23
+ plat.cross_compiled true
24
+ end
@@ -2,8 +2,11 @@ platform "osx-11-x86_64" do |plat|
2
2
  plat.servicetype "launchd"
3
3
  plat.servicedir "/Library/LaunchDaemons"
4
4
  plat.codename "bigsur"
5
+
5
6
  plat.provision_with "export HOMEBREW_NO_EMOJI=true"
6
7
  plat.provision_with "export HOMEBREW_VERBOSE=true"
8
+ plat.provision_with "export HOMEBREW_NO_ANALYTICS=1"
9
+
7
10
  plat.provision_with "sudo dscl . -create /Users/test"
8
11
  plat.provision_with "sudo dscl . -create /Users/test UserShell /bin/bash"
9
12
  plat.provision_with "sudo dscl . -create /Users/test UniqueID 1001"
@@ -14,7 +17,7 @@ platform "osx-11-x86_64" do |plat|
14
17
  plat.provision_with "echo 'test ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/username"
15
18
  plat.provision_with "mkdir -p /etc/homebrew"
16
19
  plat.provision_with "cd /etc/homebrew"
20
+ plat.provision_with "createhomedir -c -u test"
17
21
  plat.provision_with %Q(su test -c 'echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
18
- plat.provision_with "sudo chown -R test:admin /Users/test/"
19
22
  plat.vmpooler_template "macos-112-x86_64"
20
23
  end
@@ -0,0 +1,24 @@
1
+ platform 'osx-12-arm64' do |plat|
2
+ plat.servicetype 'launchd'
3
+ plat.servicedir '/Library/LaunchDaemons'
4
+ plat.codename 'monterey'
5
+
6
+ plat.provision_with 'export HOMEBREW_NO_EMOJI=true'
7
+ plat.provision_with 'export HOMEBREW_VERBOSE=true'
8
+ plat.provision_with "export HOMEBREW_NO_ANALYTICS=1"
9
+
10
+ plat.provision_with 'sudo dscl . -create /Users/test'
11
+ plat.provision_with 'sudo dscl . -create /Users/test UserShell /bin/bash'
12
+ plat.provision_with 'sudo dscl . -create /Users/test UniqueID 1001'
13
+ plat.provision_with 'sudo dscl . -create /Users/test PrimaryGroupID 1000'
14
+ plat.provision_with 'sudo dscl . -create /Users/test NFSHomeDirectory /Users/test'
15
+ plat.provision_with 'sudo dscl . -passwd /Users/test password'
16
+ plat.provision_with 'sudo dscl . -merge /Groups/admin GroupMembership test'
17
+ plat.provision_with 'echo "test ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/username'
18
+ plat.provision_with 'mkdir -p /etc/homebrew'
19
+ plat.provision_with 'cd /etc/homebrew'
20
+ plat.provision_with 'createhomedir -c -u test'
21
+ plat.provision_with 'su test -c \'echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\''
22
+ plat.vmpooler_template 'macos-12-x86_64'
23
+ plat.cross_compiled true
24
+ end
@@ -2,8 +2,11 @@ platform "osx-12-x86_64" do |plat|
2
2
  plat.servicetype "launchd"
3
3
  plat.servicedir "/Library/LaunchDaemons"
4
4
  plat.codename "monterey"
5
+
5
6
  plat.provision_with "export HOMEBREW_NO_EMOJI=true"
6
7
  plat.provision_with "export HOMEBREW_VERBOSE=true"
8
+ plat.provision_with "export HOMEBREW_NO_ANALYTICS=1"
9
+
7
10
  plat.provision_with "sudo dscl . -create /Users/test"
8
11
  plat.provision_with "sudo dscl . -create /Users/test UserShell /bin/bash"
9
12
  plat.provision_with "sudo dscl . -create /Users/test UniqueID 1001"
@@ -14,7 +17,7 @@ platform "osx-12-x86_64" do |plat|
14
17
  plat.provision_with "echo 'test ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/username"
15
18
  plat.provision_with "mkdir -p /etc/homebrew"
16
19
  plat.provision_with "cd /etc/homebrew"
20
+ plat.provision_with "createhomedir -c -u test"
17
21
  plat.provision_with %Q(su test -c 'echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
18
- plat.provision_with "sudo chown -R test:admin /Users/test/"
19
22
  plat.vmpooler_template "macos-12-x86_64"
20
23
  end
@@ -15,15 +15,19 @@ all: file-list-before-build <%= package_name %>
15
15
  file-list-before-build:
16
16
  <%- if dirnames.empty? -%>
17
17
  touch file-list-before-build
18
+ <%- elsif @platform.is_windows? -%>
19
+ (<%= @platform.find %> -H "<%= dirnames.map do |f| "$(shell cygpath -ml '#{f}')" end.join('" "') %>" 2>/dev/null || <%= @platform.find %> "<%= dirnames.map do |f| "$(shell cygpath -ml '#{f}')" end.join('" "') %>" 2>/dev/null) | <%= @platform.sort %> | uniq > file-list-before-build
18
20
  <%- else -%>
19
- (<%= @platform.find %> -H "<%= dirnames.join('" "') %>" 2>/dev/null || <%= @platform.find %> "<%= dirnames.join('" "') %>" 2>/dev/null) | <%= "xargs -I[] cygpath --mixed --long-name --absolute [] |" if @platform.is_windows? %> <%= @platform.sort %> | uniq > file-list-before-build
21
+ (<%= @platform.find %> -H "<%= dirnames.join('" "') %>" 2>/dev/null || <%= @platform.find %> "<%= dirnames.join('" "') %>" 2>/dev/null) | <%= @platform.sort %> | uniq > file-list-before-build
20
22
  <%- end -%>
21
23
 
22
24
  file-list-after-build: <%= @components.map {|comp| comp.name }.join(" ") %>
23
25
  <%- if dirnames.empty? -%>
24
26
  touch file-list-after-build
27
+ <%- elsif @platform.is_windows? -%>
28
+ (<%= @platform.find %> -H "<%= dirnames.map do |f| "$(shell cygpath -ml '#{f}')" end.join('" "') %>" 2>/dev/null || <%= @platform.find %> "<%= dirnames.map do |f| "$(shell cygpath -ml '#{f}')" end.join('" "') %>" 2>/dev/null) | <%= @platform.sort %> | uniq > file-list-after-build
25
29
  <%- else -%>
26
- (<%= @platform.find %> -H "<%= dirnames.join('" "') %>" 2>/dev/null || <%= @platform.find %> "<%= dirnames.join('" "') %>" 2>/dev/null) | <%= "xargs -I[] cygpath --mixed --long-name --absolute [] |" if @platform.is_windows? %> <%= @platform.sort %> | uniq > file-list-after-build
30
+ (<%= @platform.find %> -H "<%= dirnames.join('" "') %>" 2>/dev/null || <%= @platform.find %> "<%= dirnames.join('" "') %>" 2>/dev/null) | <%= @platform.sort %> | uniq > file-list-after-build
27
31
  <%- end -%>
28
32
 
29
33
  <%= @name %>-<%= @version %>.tar.gz: file-list <%= @cleanup ? 'cleanup-components' : '' %>
@@ -2,7 +2,7 @@ require 'vanagon/engine/pooler'
2
2
  require 'vanagon/platform'
3
3
 
4
4
  describe 'Vanagon::Engine::Pooler' do
5
- let (:platform) { double(Vanagon::Platform, :target_user => 'root') }
5
+ let (:platform) { double(Vanagon::Platform, :target_user => 'root', :ssh_port => 22) }
6
6
  let (:platform_with_vcloud_name) {
7
7
  plat = Vanagon::Platform::DSL.new('debian-6-i386')
8
8
  plat.instance_eval("platform 'debian-6-i386' do |plat|
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.34.0
4
+ version: 0.35.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-16 00:00:00.000000000 Z
11
+ date: 2023-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -168,7 +168,9 @@ files:
168
168
  - lib/vanagon/platform/defaults/el-9-x86_64.rb
169
169
  - lib/vanagon/platform/defaults/fedora-36-x86_64.rb
170
170
  - lib/vanagon/platform/defaults/osx-10.15-x86_64.rb
171
+ - lib/vanagon/platform/defaults/osx-11-arm64.rb
171
172
  - lib/vanagon/platform/defaults/osx-11-x86_64.rb
173
+ - lib/vanagon/platform/defaults/osx-12-arm64.rb
172
174
  - lib/vanagon/platform/defaults/osx-12-x86_64.rb
173
175
  - lib/vanagon/platform/defaults/redhatfips-7-x86_64.rb
174
176
  - lib/vanagon/platform/defaults/redhatfips-8-x86_64.rb
@@ -328,42 +330,42 @@ signing_key:
328
330
  specification_version: 3
329
331
  summary: All of your packages will fit into this van with this one simple trick.
330
332
  test_files:
333
+ - spec/lib/vanagon/project_spec.rb
334
+ - spec/lib/vanagon/utilities_spec.rb
331
335
  - spec/lib/vanagon/common/pathname_spec.rb
332
336
  - spec/lib/vanagon/common/user_spec.rb
333
- - spec/lib/vanagon/project_spec.rb
334
337
  - spec/lib/vanagon/platform_spec.rb
335
- - spec/lib/vanagon/component_spec.rb
336
- - spec/lib/vanagon/utilities_spec.rb
337
- - spec/lib/vanagon/cli_spec.rb
338
- - spec/lib/vanagon/driver_spec.rb
339
- - spec/lib/vanagon/environment_spec.rb
340
- - spec/lib/vanagon/project/dsl_spec.rb
341
- - spec/lib/vanagon/engine/hardware_spec.rb
342
- - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
338
+ - spec/lib/vanagon/extensions/string_spec.rb
339
+ - spec/lib/vanagon/extensions/set/json_spec.rb
340
+ - spec/lib/vanagon/extensions/ostruct/json_spec.rb
343
341
  - spec/lib/vanagon/engine/ec2_spec.rb
344
342
  - spec/lib/vanagon/engine/docker_spec.rb
345
- - spec/lib/vanagon/engine/base_spec.rb
343
+ - spec/lib/vanagon/engine/hardware_spec.rb
346
344
  - spec/lib/vanagon/engine/pooler_spec.rb
347
345
  - spec/lib/vanagon/engine/local_spec.rb
348
- - spec/lib/vanagon/extensions/ostruct/json_spec.rb
349
- - spec/lib/vanagon/extensions/set/json_spec.rb
350
- - spec/lib/vanagon/extensions/string_spec.rb
351
- - spec/lib/vanagon/component/rules_spec.rb
346
+ - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
347
+ - spec/lib/vanagon/engine/base_spec.rb
352
348
  - spec/lib/vanagon/component/source_spec.rb
353
- - spec/lib/vanagon/component/dsl_spec.rb
354
- - spec/lib/vanagon/component/source/rewrite_spec.rb
355
349
  - spec/lib/vanagon/component/source/git_spec.rb
356
- - spec/lib/vanagon/component/source/local_spec.rb
357
350
  - spec/lib/vanagon/component/source/http_spec.rb
358
- - spec/lib/vanagon/platform/solaris_11_spec.rb
359
- - spec/lib/vanagon/platform/windows_spec.rb
351
+ - spec/lib/vanagon/component/source/local_spec.rb
352
+ - spec/lib/vanagon/component/source/rewrite_spec.rb
353
+ - spec/lib/vanagon/component/rules_spec.rb
354
+ - spec/lib/vanagon/component/dsl_spec.rb
360
355
  - spec/lib/vanagon/platform/rpm_spec.rb
361
356
  - spec/lib/vanagon/platform/osx_spec.rb
362
- - spec/lib/vanagon/platform/deb_spec.rb
357
+ - spec/lib/vanagon/platform/windows_spec.rb
363
358
  - spec/lib/vanagon/platform/rpm/aix_spec.rb
359
+ - spec/lib/vanagon/platform/deb_spec.rb
364
360
  - spec/lib/vanagon/platform/solaris_10_spec.rb
361
+ - spec/lib/vanagon/platform/solaris_11_spec.rb
365
362
  - spec/lib/vanagon/platform/dsl_spec.rb
366
- - spec/lib/vanagon/utilities/shell_utilities_spec.rb
363
+ - spec/lib/vanagon/component_spec.rb
364
+ - spec/lib/vanagon/environment_spec.rb
365
+ - spec/lib/vanagon/driver_spec.rb
367
366
  - spec/lib/vanagon/utilities/extra_files_signer_spec.rb
367
+ - spec/lib/vanagon/utilities/shell_utilities_spec.rb
368
+ - spec/lib/vanagon/cli_spec.rb
369
+ - spec/lib/vanagon/project/dsl_spec.rb
368
370
  - spec/lib/git/rev_list_spec.rb
369
371
  - spec/lib/makefile_spec.rb