r10k 2.3.0 → 2.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79a29967cc56c3178634ae325404b4b201aa9841
4
- data.tar.gz: 5ddfd39f4a437e52ed87adc06f08945a8c2eef07
3
+ metadata.gz: e63992636be8dd543768f160bad72b447b3fd892
4
+ data.tar.gz: 8929577087203a2d4a72a63b0ff6d5da96ff1312
5
5
  SHA512:
6
- metadata.gz: 1da246a1e621b9b47f9a5baca4641160c8a71a0ba66f86849f28bac73a1341b586987b154e5e4b97aca66f074fae813c4a153119f2ccc508f34b8fe2ea4c1241
7
- data.tar.gz: 64f55efe4f54dae8da9d6ff5c8d5ed28201dd80ca1202e73c9af22c9867e309cb009d3c4bc6454b3b88870656bb751bed68866816d711ad47c64c0dc295d83db
6
+ metadata.gz: 32f6becccbae5df50626fd9133cb6f210a2d95fffce5ad69a5d534c19eceb59bee6b936f4783f4be0c3451adf3613557a4eca608255f5bff61e2c55f34282817
7
+ data.tar.gz: 67885326574423b9d78386e4f3045f87ba922efcf284bd2959d49a4c89ae01ba3d884055fdcbd0b121c14f1f387d2b53b49899c7ff7a609ec8206b5a47a64de7
@@ -1,6 +1,25 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 2.3.1
5
+ -----
6
+
7
+ 2016/11/30
8
+
9
+ (RK-78) Use :prune option for #fetch in Rugged::BareRepository
10
+
11
+ Versions of the "rugged" gem prior to 0.24.0 lacked the ability to automatically
12
+ "prune" branches from a local repo that no longer existed in the matching remote
13
+ repo after a fetch. To work around this issue, r10k included code that would
14
+ manually remove/recreate branches during a fetch. Since "rugged" 0.24.0 is now
15
+ widely available, r10k has been updated to use the built-in "prune" option
16
+ during a fetch and the workaround code has been removed.
17
+
18
+ NOTE: If you use the "rugged" gem with r10k, you will need to manually upgrade
19
+ it to a version >= 0.24.0 to take advantage of the new functionality. If you
20
+ are using a "rugged" version less than 0.24.0, r10k will now issue a warning
21
+ every time it fetches from a remote git repository.
22
+
4
23
  2.3.0
5
24
  -----
6
25
 
@@ -0,0 +1,25 @@
1
+ HOSTS:
2
+ ubuntu-1604-amd64-master:
3
+ roles:
4
+ - master
5
+ - dashboard
6
+ - database
7
+ - agent
8
+ platform: ubuntu-16.04-amd64
9
+ template: Delivery/Quality Assurance/Templates/vCloud/ubuntu-1604-x86_64
10
+ hypervisor: vcloud
11
+ ubuntu-1604-agent:
12
+ roles:
13
+ - agent
14
+ - frictionless
15
+ platform: ubuntu-16.04-amd64
16
+ template: Delivery/Quality Assurance/Templates/vCloud/ubuntu-1604-x86_64
17
+ hypervisor: vcloud
18
+ CONFIG:
19
+ nfs_server: none
20
+ consoleport: 443
21
+ datastore: instance0
22
+ folder: Delivery/Quality Assurance/Enterprise/Dynamic
23
+ resourcepool: delivery/Quality Assurance/Enterprise/Dynamic
24
+ pooling_api: http://vmpooler.delivery.puppetlabs.net/
25
+ forge_host: forge-aio01-petest.puppetlabs.com
@@ -0,0 +1,70 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ test_name 'CODEMGMT-730 - C97982 - HTTPS_PROXY effects git source in puppetfile'
5
+
6
+ #Init
7
+ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
+ r10k_fqp = get_r10k_fqp(master)
9
+
10
+ git_repo_path = '/git_repos'
11
+ git_repo_name = 'environments'
12
+ git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
13
+ git_environments_path = '/root/environments'
14
+ last_commit = git_last_commit(master, git_environments_path)
15
+ git_provider = ENV['GIT_PROVIDER']
16
+
17
+ r10k_config_path = get_r10k_config_file_path(master)
18
+ r10k_config_bak_path = "#{r10k_config_path}.bak"
19
+
20
+ puppetfile =<<-EOS
21
+ mod 'motd',
22
+ :git => 'https://github.com/puppetlabs/puppetlabs-motd'
23
+ EOS
24
+
25
+ proxy_env_value = 'https://ferritsarebest.net:3219'
26
+
27
+ #In-line files
28
+ r10k_conf = <<-CONF
29
+ cachedir: '/var/cache/r10k'
30
+ git:
31
+ provider: '#{git_provider}'
32
+ sources:
33
+ control:
34
+ basedir: "#{env_path}"
35
+ remote: "#{git_control_remote}"
36
+ CONF
37
+
38
+ teardown do
39
+ master.clear_env_var('HTTPS_PROXY')
40
+
41
+ step 'Restore Original "r10k" Config'
42
+ on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
43
+
44
+ step 'cleanup r10k'
45
+ clean_up_r10k(master, last_commit, git_environments_path)
46
+ end
47
+
48
+ master.add_env_var('HTTPS_PROXY', proxy_env_value)
49
+
50
+ step 'Backup Current "r10k" Config'
51
+ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
52
+
53
+ step 'Update the "r10k" Config'
54
+ create_remote_file(master, r10k_config_path, r10k_conf)
55
+
56
+ step 'Checkout "production" Branch'
57
+ git_on(master, 'checkout production', git_environments_path)
58
+
59
+ step 'Copy Puppetfile to "production" Environment Git Repo'
60
+ create_remote_file(master, "#{git_environments_path}/Puppetfile", puppetfile)
61
+
62
+ step 'Push Changes'
63
+ git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
64
+
65
+ #test
66
+ on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |r|
67
+ regex = /(Couldn't|Could not) resolve proxy.*ferritsarebest\.net/i
68
+ assert(r.exit_code == 1, 'expected error code was not observed')
69
+ assert_match(regex, r.stderr, 'The expected error message was not observed' )
70
+ end
@@ -0,0 +1,72 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ test_name 'CODEMGMT-730 - C97981 - HTTP_PROXY effects git source in puppetfile'
5
+
6
+ #Init
7
+ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
+ r10k_fqp = get_r10k_fqp(master)
9
+
10
+ git_repo_path = '/git_repos'
11
+ git_repo_name = 'environments'
12
+ git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
13
+ git_environments_path = '/root/environments'
14
+ last_commit = git_last_commit(master, git_environments_path)
15
+ git_provider = ENV['GIT_PROVIDER']
16
+
17
+ r10k_config_path = get_r10k_config_file_path(master)
18
+ r10k_config_bak_path = "#{r10k_config_path}.bak"
19
+
20
+ puppetfile =<<-EOS
21
+ mod 'puppetlabs/apache', '0.10.0'
22
+ EOS
23
+
24
+ proxy_env_value = 'http://iloveferrits.net:3219'
25
+
26
+ #In-line files
27
+ r10k_conf = <<-CONF
28
+ proxy: 'http://ilovedogs.com:3128'
29
+ cachedir: '/var/cache/r10k'
30
+ git:
31
+ provider: '#{git_provider}'
32
+ sources:
33
+ control:
34
+ basedir: "#{env_path}"
35
+ remote: "#{git_control_remote}"
36
+ forge:
37
+ proxy: "http://ilovecats.net:3128"
38
+ CONF
39
+
40
+ teardown do
41
+ master.clear_env_var('HTTP_PROXY')
42
+
43
+ step 'Restore Original "r10k" Config'
44
+ on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
45
+
46
+ step 'cleanup r10k'
47
+ clean_up_r10k(master, last_commit, git_environments_path)
48
+ end
49
+
50
+ master.add_env_var('HTTP_PROXY', proxy_env_value)
51
+
52
+ step 'Backup Current "r10k" Config'
53
+ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
54
+
55
+ step 'Update the "r10k" Config'
56
+ create_remote_file(master, r10k_config_path, r10k_conf)
57
+
58
+ step 'Checkout "production" Branch'
59
+ git_on(master, 'checkout production', git_environments_path)
60
+
61
+ step 'Copy Puppetfile to "production" Environment Git Repo'
62
+ create_remote_file(master, "#{git_environments_path}/Puppetfile", puppetfile)
63
+
64
+ step 'Push Changes'
65
+ git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
66
+
67
+ #test
68
+ on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |r|
69
+ regex = /using proxy http:\/\/ilovecats\.net:3128/i
70
+ assert(r.exit_code == 1, 'expected error code was not observed')
71
+ assert_match(regex, r.stderr, 'The expected error message was not observed' )
72
+ end
@@ -9,48 +9,26 @@ confine(:to, :platform => ['el', 'sles'])
9
9
  master_platform = fact_on(master, 'osfamily')
10
10
  r10k_fqp = get_r10k_fqp(master)
11
11
 
12
- case master_platform
13
- when 'RedHat'
14
- pkg_manager = 'yum'
15
- when 'Suse'
16
- pkg_manager = 'zypper'
17
- end
18
-
19
- install_squid = "#{pkg_manager} install -y squid"
20
- remove_squid = "#{pkg_manager} remove -y squid"
21
-
22
12
  #Verification
23
- error_regex = /Unable to connect to.*getaddrinfo: Name or service not known/i
13
+ proxy_hostname = "http://notarealhostname:3128"
14
+ error_regex = /Unable to connect to.*#{proxy_hostname}/i
24
15
 
25
16
  #Teardown
26
17
  teardown do
27
18
  step 'Remove puppetfile'
28
19
  on(master, 'rm -rf modules/')
29
20
  on(master, 'rm Puppetfile')
30
-
31
- step 'Remove Squid'
32
- on(master, puppet("apply -e 'service {'squid' : ensure => stopped}'"))
33
- on(master, remove_squid)
34
-
35
- step 'Remove proxy environment variable'
36
- master.delete_env_var('http_proxy', 'http://notarealhostname:3128')
37
21
  end
38
22
 
39
- step 'Install and configure squid proxy'
40
- on(master, install_squid)
41
- master.add_env_var('http_proxy', "http://notarealhostname:3128")
42
-
43
23
  step 'turn off the firewall'
44
24
  on(master, puppet("apply -e 'service {'iptables' : ensure => stopped}'"))
45
25
 
46
- step 'start squid proxy'
47
- on(master, puppet("apply -e 'service {'squid' : ensure => running}'"))
48
-
49
26
  #Tests
50
27
  step 'make a puppetfile'
51
28
  create_remote_file(master, "Puppetfile", 'mod "puppetlabs/motd"')
52
29
 
53
30
  step 'Use a r10k puppetfile'
54
- on(master, "#{r10k_fqp} puppetfile install", {:acceptable_exit_codes => [0,1,2]}) do |result|
31
+ on(master, "#{r10k_fqp} puppetfile install", {:acceptable_exit_codes => [0,1,2], :environment => {"http_proxy" => proxy_hostname}}) do |result|
32
+ assert(result.exit_code == 1, 'The expected exit code was not observed.')
55
33
  assert_match(error_regex, result.stderr, 'Did not see the expected error')
56
34
  end
@@ -0,0 +1,72 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ test_name 'CODEMGMT-730 - C97977 - Specify HTTPS_PROXY environment var and proxy for specific git source'
5
+
6
+ #Init
7
+ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
+ r10k_fqp = get_r10k_fqp(master)
9
+
10
+ git_environments_path = '/root/environments'
11
+ last_commit = git_last_commit(master, git_environments_path)
12
+ git_provider = ENV['GIT_PROVIDER']
13
+
14
+ r10k_config_path = get_r10k_config_file_path(master)
15
+ r10k_config_bak_path = "#{r10k_config_path}.bak"
16
+
17
+ puppetfile =<<-EOS
18
+ mod 'motd',
19
+ :git => 'https://github.com/puppetlabs/puppetlabs-motd'
20
+ EOS
21
+
22
+ proxy_env_value = 'https://cattastic.net:3219'
23
+
24
+ #In-line files
25
+ r10k_conf = <<-CONF
26
+ cachedir: '/var/cache/r10k'
27
+ git:
28
+ provider: '#{git_provider}'
29
+ repositories:
30
+ - remote: 'https://example.com/fake_git_source.git'
31
+ proxy: 'https://ilovecatvideos.com:3128'
32
+ sources:
33
+ control:
34
+ basedir: "#{env_path}"
35
+ remote: "https://example.com/fake_git_source.git"
36
+ CONF
37
+
38
+ teardown do
39
+ master.clear_env_var('HTTPS_PROXY')
40
+
41
+ step 'Restore Original "r10k" Config'
42
+ on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
43
+
44
+ step 'cleanup r10k'
45
+ clean_up_r10k(master, last_commit, git_environments_path)
46
+ end
47
+
48
+ master.add_env_var('HTTPS_PROXY', proxy_env_value)
49
+
50
+ step 'Backup Current "r10k" Config'
51
+ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
52
+
53
+ step 'Update the "r10k" Config'
54
+ create_remote_file(master, r10k_config_path, r10k_conf)
55
+
56
+ step 'Checkout "production" Branch'
57
+ git_on(master, 'checkout production', git_environments_path)
58
+
59
+ step 'Copy Puppetfile to "production" Environment Git Repo'
60
+ create_remote_file(master, "#{git_environments_path}/Puppetfile", puppetfile)
61
+
62
+ step 'Push Changes'
63
+ git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
64
+
65
+ #test
66
+ on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |r|
67
+ regex = /proxy.*ilovecatvideos\.com/
68
+ assert(r.exit_code == 1, 'expected error code was not observed')
69
+ expect_failure('Failure due to RK-262') do
70
+ assert_match(regex, r.stderr, 'The expected error message was not observed' )
71
+ end
72
+ end
@@ -24,7 +24,7 @@ sources:
24
24
  CONF
25
25
 
26
26
  #Verification
27
- error_message_regex = /ERROR.*(Failed to make directory|could not create leading directories of.*File name too long)/m
27
+ error_message_regex = /ERROR.*(Failed to make directory|File name too long)/m
28
28
 
29
29
  #Teardown
30
30
  teardown do
@@ -49,9 +49,14 @@ class R10K::Git::Rugged::BareRepository < R10K::Git::Rugged::BaseRepository
49
49
  #
50
50
  # @return [void]
51
51
  def fetch(remote_name='origin')
52
- backup_branches = wipe_branches
53
52
  logger.debug1 { "Fetching remote '#{remote_name}' at #{@path}" }
54
- options = {:credentials => credentials}
53
+
54
+ # Check to see if we have a version of Rugged that supports "fetch --prune" and warn if not
55
+ if defined?(Rugged::Version) && !Gem::Dependency.new('rugged', '>= 0.24.0').match?('rugged', Rugged::Version)
56
+ logger.warn { "Rugged versions prior to 0.24.0 do not support pruning stale branches during fetch, please upgrade your \'rugged\' gem. (Current version is: #{Rugged::Version})" }
57
+ end
58
+
59
+ options = {:credentials => credentials, :prune => true}
55
60
  refspecs = ['+refs/*:refs/*']
56
61
 
57
62
  remote = remotes[remote_name]
@@ -64,37 +69,12 @@ class R10K::Git::Rugged::BareRepository < R10K::Git::Rugged::BaseRepository
64
69
 
65
70
  report_transfer(results, remote_name)
66
71
  rescue Rugged::SshError, Rugged::NetworkError => e
67
- restore_branches(backup_branches)
68
72
  raise R10K::Git::GitError.new(e.message, :git_dir => git_dir, :backtrace => e.backtrace)
69
73
  rescue
70
- restore_branches(backup_branches)
71
74
  raise
72
75
  end
73
76
 
74
77
  def exist?
75
78
  @path.exist?
76
79
  end
77
-
78
- def wipe_branches
79
- backup_branches = {}
80
- with_repo do |repo|
81
- repo.branches.each do |branch|
82
- if !branch.head?
83
- backup_branches[branch.name] = branch.target_id
84
- repo.branches.delete(branch)
85
- end
86
- end
87
- end
88
- backup_branches
89
- end
90
-
91
- def restore_branches(backup_branches)
92
- with_repo do |repo|
93
- backup_branches.each_pair do |name, ref|
94
- if !repo.branches.exist?(name)
95
- repo.create_branch(name, ref)
96
- end
97
- end
98
- end
99
- end
100
80
  end
@@ -1,3 +1,3 @@
1
1
  module R10K
2
- VERSION = '2.3.0'
2
+ VERSION = '2.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r10k
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -184,6 +184,7 @@ files:
184
184
  - integration/configs/pe/ubuntu-1004-64mda
185
185
  - integration/configs/pe/ubuntu-1204-64mda
186
186
  - integration/configs/pe/ubuntu-1404-64mda
187
+ - integration/configs/pe/ubuntu-1604-64mda
187
188
  - integration/files/README.mkd
188
189
  - integration/files/hiera.yaml
189
190
  - integration/files/modules/helloworld/manifests/init.pp
@@ -228,6 +229,8 @@ files:
228
229
  - integration/test_run_scripts/git_source/all_tests-pe-centos6.sh
229
230
  - integration/test_run_scripts/user_scenario/basic_workflow/all_tests-pe-centos6.sh
230
231
  - integration/test_run_scripts/user_scenario/complex_workflow/all_tests-pe-centos6.sh
232
+ - integration/tests/Puppetfile/HTTPS_PROXY_effects_git_source.rb
233
+ - integration/tests/Puppetfile/HTTP_PROXY_effects_forge_source.rb
231
234
  - integration/tests/README.mkd
232
235
  - integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb
233
236
  - integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb
@@ -245,6 +248,7 @@ files:
245
248
  - integration/tests/command_line/negative/neg_invalid_cli_dep_flag.rb
246
249
  - integration/tests/command_line/negative/neg_invalid_cli_env_flag.rb
247
250
  - integration/tests/command_line/negative/neg_invalid_cmd_line_arg.rb
251
+ - integration/tests/git_source/HTTPS_proxy_and_git_source.rb
248
252
  - integration/tests/git_source/git_source_git.rb
249
253
  - integration/tests/git_source/git_source_ssh.rb
250
254
  - integration/tests/git_source/git_source_submodule.rb
@@ -507,9 +511,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
507
511
  version: '0'
508
512
  requirements: []
509
513
  rubyforge_project:
510
- rubygems_version: 2.4.5.1
514
+ rubygems_version: 2.5.1
511
515
  signing_key:
512
516
  specification_version: 4
513
517
  summary: Puppet environment and module deployment
514
518
  test_files: []
515
- has_rdoc: