r10k 2.6.4 → 2.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.github/pull_request_template.md +4 -0
  3. data/.github/workflows/release.yml +36 -0
  4. data/.gitignore +0 -1
  5. data/.travis.yml +16 -9
  6. data/CHANGELOG.mkd +51 -1
  7. data/CODEOWNERS +1 -0
  8. data/doc/dynamic-environments/usage.mkd +12 -0
  9. data/integration/Gemfile +2 -2
  10. data/integration/Rakefile +2 -3
  11. data/integration/pre-suite/00_pe_install.rb +2 -0
  12. data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +2 -2
  13. data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +2 -2
  14. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +2 -12
  15. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +2 -11
  16. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +2 -12
  17. data/lib/r10k/action/deploy/environment.rb +15 -2
  18. data/lib/r10k/cli/deploy.rb +1 -0
  19. data/lib/r10k/module/git.rb +5 -0
  20. data/lib/r10k/puppetfile.rb +17 -6
  21. data/lib/r10k/util/subprocess/runner/posix.rb +3 -3
  22. data/lib/r10k/version.rb +4 -1
  23. data/locales/r10k.pot +486 -0
  24. data/r10k.gemspec +7 -3
  25. data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +5 -0
  26. data/spec/unit/action/deploy/environment_spec.rb +63 -0
  27. data/spec/unit/puppetfile_spec.rb +39 -0
  28. metadata +48 -22
  29. data/MAINTAINERS +0 -18
  30. data/integration/pre-suite/30_test_utils.rb +0 -17
  31. data/integration/scripts/README.mkd +0 -86
  32. data/integration/scripts/setup_r10k_env_centos5.sh +0 -23
  33. data/integration/scripts/setup_r10k_env_centos6.sh +0 -23
  34. data/integration/scripts/setup_r10k_env_rhel7.sh +0 -23
  35. data/integration/scripts/setup_r10k_env_sles11.sh +0 -23
  36. data/integration/scripts/setup_r10k_env_sles12.sh +0 -23
  37. data/integration/scripts/setup_r10k_env_ubuntu1004.sh +0 -23
  38. data/integration/scripts/setup_r10k_env_ubuntu1204.sh +0 -23
  39. data/integration/scripts/setup_r10k_env_ubuntu1404.sh +0 -23
  40. data/integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb +0 -71
@@ -28,16 +28,20 @@ Gem::Specification.new do |s|
28
28
  s.add_dependency 'log4r', '1.1.10'
29
29
  s.add_dependency 'multi_json', '~> 1.10'
30
30
 
31
- s.add_dependency 'puppet_forge', '~> 2.2.8'
31
+ s.add_dependency 'puppet_forge', '~> 2.3.0'
32
32
 
33
- s.add_dependency 'gettext-setup', '~> 0.5'
33
+ s.add_dependency 'gettext-setup', '~>0.24'
34
+ # These two pins narrow what is allowed by gettext-setup,
35
+ # to preserver compatability with Ruby 2.4
36
+ s.add_dependency 'fast_gettext', '~> 1.1.0'
37
+ s.add_dependency 'gettext', ['>= 3.0.2', '< 3.3.0']
34
38
 
35
39
  s.add_development_dependency 'rspec', '~> 3.1'
36
40
 
37
41
  s.add_development_dependency 'rake'
38
42
 
39
43
  s.add_development_dependency 'yard', '~> 0.9.11'
40
- s.add_development_dependency 'minitar', '~> 0.6.1'
44
+ s.add_development_dependency 'minitar', '~> 0.9.0'
41
45
 
42
46
  s.files = %x[git ls-files].split($/)
43
47
  s.require_path = 'lib'
@@ -0,0 +1,5 @@
1
+ mod 'cd4pe',
2
+ :git => 'test@randomurl.com:something/some_module.git',
3
+ :ref => 'expected_ref',
4
+ :default_branch => 'here_lies_the_default_branch'
5
+
@@ -19,6 +19,10 @@ describe R10K::Action::Deploy::Environment do
19
19
  described_class.new({puppetfile: true}, [])
20
20
  end
21
21
 
22
+ it "can accept a default_branch_override option" do
23
+ described_class.new({:'default-branch-override' => 'default_branch_override_name'}, [])
24
+ end
25
+
22
26
  it "can accept a no-force option" do
23
27
  described_class.new({:'no-force' => true}, [])
24
28
  end
@@ -123,4 +127,63 @@ describe R10K::Action::Deploy::Environment do
123
127
  end
124
128
  end
125
129
  end
130
+
131
+ describe "write_environment_info!" do
132
+
133
+ class Fake_Environment
134
+ attr_accessor :path
135
+ attr_accessor :puppetfile
136
+ attr_accessor :info
137
+
138
+ def initialize(path, info)
139
+ @path = path
140
+ @info = info
141
+ @puppetfile = R10K::Puppetfile.new
142
+ end
143
+ end
144
+
145
+ let(:mock_stateful_repo_1) { instance_double("R10K::Git::StatefulRepository", :head => "123456") }
146
+ let(:mock_stateful_repo_2) { instance_double("R10K::Git::StatefulRepository", :head => "654321") }
147
+ let(:mock_git_module_1) { instance_double("R10K::Module::Git", :name => "my_cool_module", :version => "1.0", :repo => mock_stateful_repo_1) }
148
+ let(:mock_git_module_2) { instance_double("R10K::Module::Git", :name => "my_lame_module", :version => "0.0.1", :repo => mock_stateful_repo_2) }
149
+ let(:mock_forge_module_1) { double(:name => "their_shiny_module", :version => "2.0.0") }
150
+ let(:mock_puppetfile) { instance_double("R10K::Puppetfile", :modules => [mock_git_module_1, mock_git_module_2, mock_forge_module_1]) }
151
+
152
+ before(:all) do
153
+ @tmp_path = "./tmp-r10k-test-dir/"
154
+ Dir.mkdir(@tmp_path) unless File.exists?(@tmp_path)
155
+ end
156
+
157
+ after(:all) do
158
+ File.delete("#{@tmp_path}/.r10k-deploy.json")
159
+ Dir.delete(@tmp_path)
160
+ end
161
+
162
+ it "writes the .r10k-deploy file correctly" do
163
+ allow(R10K::Puppetfile).to receive(:new).and_return(mock_puppetfile)
164
+ allow(mock_forge_module_1).to receive(:repo).and_raise(NoMethodError)
165
+
166
+ fake_env = Fake_Environment.new(@tmp_path, {:name => "my_cool_environment", :signature => "pablo picasso"})
167
+ subject.send(:write_environment_info!, fake_env, "2019-01-01 23:23:22 +0000", true)
168
+
169
+ file_contents = File.read("#{@tmp_path}/.r10k-deploy.json")
170
+ r10k_deploy = JSON.parse(file_contents)
171
+
172
+ expect(r10k_deploy['name']).to eq("my_cool_environment")
173
+ expect(r10k_deploy['signature']).to eq("pablo picasso")
174
+ expect(r10k_deploy['started_at']).to eq("2019-01-01 23:23:22 +0000")
175
+ expect(r10k_deploy['deploy_success']).to eq(true)
176
+ expect(r10k_deploy['module_deploys'].length).to eq(3)
177
+ expect(r10k_deploy['module_deploys'][0]['name']).to eq("my_cool_module")
178
+ expect(r10k_deploy['module_deploys'][0]['version']).to eq("1.0")
179
+ expect(r10k_deploy['module_deploys'][0]['sha']).to eq("123456")
180
+ expect(r10k_deploy['module_deploys'][1]['name']).to eq("my_lame_module")
181
+ expect(r10k_deploy['module_deploys'][1]['version']).to eq("0.0.1")
182
+ expect(r10k_deploy['module_deploys'][1]['sha']).to eq("654321")
183
+ expect(r10k_deploy['module_deploys'][2]['name']).to eq("their_shiny_module")
184
+ expect(r10k_deploy['module_deploys'][2]['version']).to eq("2.0.0")
185
+ expect(r10k_deploy['module_deploys'][2]['sha']).to eq(nil)
186
+
187
+ end
188
+ end
126
189
  end
@@ -128,6 +128,26 @@ describe R10K::Puppetfile do
128
128
  end
129
129
  end
130
130
 
131
+ describe '#managed_directories' do
132
+ it 'returns an array of paths that can be purged' do
133
+ allow(R10K::Module).to receive(:new).with('puppet/test_module', subject.moduledir, '1.2.3', anything).and_call_original
134
+
135
+ subject.add_module('puppet/test_module', '1.2.3')
136
+ expect(subject.managed_directories).to match_array(["/some/nonexistent/basedir/modules"])
137
+ end
138
+
139
+ context 'with a module with install_path == \'\'' do
140
+ it 'basedir isn\'t in the list of paths to purge' do
141
+ module_opts = { install_path: '', git: 'git@example.com:puppet/test_module.git' }
142
+
143
+ allow(R10K::Module).to receive(:new).with('puppet/test_module', subject.basedir, module_opts, anything).and_call_original
144
+
145
+ subject.add_module('puppet/test_module', module_opts)
146
+ expect(subject.managed_directories).to be_empty
147
+ end
148
+ end
149
+ end
150
+
131
151
  describe "evaluating a Puppetfile" do
132
152
  def expect_wrapped_error(orig, pf_path, wrapped_error)
133
153
  expect(orig).to be_a_kind_of(R10K::Error)
@@ -181,6 +201,25 @@ describe R10K::Puppetfile do
181
201
  subject = described_class.new(path)
182
202
  expect { subject.load! }.not_to raise_error
183
203
  end
204
+
205
+ it "creates a git module and applies the default branch sepcified in the Puppetfile" do
206
+ path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
207
+ pf_path = File.join(path, 'Puppetfile')
208
+ subject = described_class.new(path)
209
+ expect { subject.load! }.not_to raise_error
210
+ git_module = subject.modules[0]
211
+ expect(git_module.default_ref).to eq 'here_lies_the_default_branch'
212
+ end
213
+
214
+ it "creates a git module and applies the provided default_branch_override" do
215
+ path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
216
+ pf_path = File.join(path, 'Puppetfile')
217
+ subject = described_class.new(path)
218
+ default_branch_override = 'default_branch_override_name'
219
+ expect { subject.load!(default_branch_override) }.not_to raise_error
220
+ git_module = subject.modules[0]
221
+ expect(git_module.default_ref).to eq default_branch_override
222
+ end
184
223
  end
185
224
 
186
225
  describe "accepting a visitor" do
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.6.4
4
+ version: 2.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-22 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -72,28 +72,62 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.2.8
75
+ version: 2.3.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.2.8
82
+ version: 2.3.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gettext-setup
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.5'
89
+ version: '0.24'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.5'
96
+ version: '0.24'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fast_gettext
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.1.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.1.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: gettext
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 3.0.2
118
+ - - "<"
119
+ - !ruby/object:Gem::Version
120
+ version: 3.3.0
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 3.0.2
128
+ - - "<"
129
+ - !ruby/object:Gem::Version
130
+ version: 3.3.0
97
131
  - !ruby/object:Gem::Dependency
98
132
  name: rspec
99
133
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +176,14 @@ dependencies:
142
176
  requirements:
143
177
  - - "~>"
144
178
  - !ruby/object:Gem::Version
145
- version: 0.6.1
179
+ version: 0.9.0
146
180
  type: :development
147
181
  prerelease: false
148
182
  version_requirements: !ruby/object:Gem::Requirement
149
183
  requirements:
150
184
  - - "~>"
151
185
  - !ruby/object:Gem::Version
152
- version: 0.6.1
186
+ version: 0.9.0
153
187
  description: |2
154
188
  R10K provides a general purpose toolset for deploying Puppet environments and modules.
155
189
  It implements the Puppetfile format and provides a native implementation of Puppet
@@ -160,13 +194,15 @@ executables:
160
194
  extensions: []
161
195
  extra_rdoc_files: []
162
196
  files:
197
+ - ".github/pull_request_template.md"
198
+ - ".github/workflows/release.yml"
163
199
  - ".gitignore"
164
200
  - ".travis.yml"
165
201
  - CHANGELOG.mkd
202
+ - CODEOWNERS
166
203
  - CONTRIBUTING.mkd
167
204
  - Gemfile
168
205
  - LICENSE
169
- - MAINTAINERS
170
206
  - README.mkd
171
207
  - Rakefile
172
208
  - bin/r10k
@@ -206,22 +242,11 @@ files:
206
242
  - integration/pre-suite/00_pe_install.rb
207
243
  - integration/pre-suite/10_git_config.rb
208
244
  - integration/pre-suite/20_pe_r10k.rb
209
- - integration/pre-suite/30_test_utils.rb
210
245
  - integration/pre-suite/README.mkd
211
- - integration/scripts/README.mkd
212
- - integration/scripts/setup_r10k_env_centos5.sh
213
- - integration/scripts/setup_r10k_env_centos6.sh
214
- - integration/scripts/setup_r10k_env_rhel7.sh
215
- - integration/scripts/setup_r10k_env_sles11.sh
216
- - integration/scripts/setup_r10k_env_sles12.sh
217
- - integration/scripts/setup_r10k_env_ubuntu1004.sh
218
- - integration/scripts/setup_r10k_env_ubuntu1204.sh
219
- - integration/scripts/setup_r10k_env_ubuntu1404.sh
220
246
  - integration/tests/Puppetfile/HTTP_PROXY_affects_forge_source.rb
221
247
  - integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb
222
248
  - integration/tests/README.mkd
223
249
  - integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb
224
- - integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb
225
250
  - integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb
226
251
  - integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb
227
252
  - integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb
@@ -383,6 +408,7 @@ files:
383
408
  - lib/r10k/util/symbolize_keys.rb
384
409
  - lib/r10k/version.rb
385
410
  - locales/config.yaml
411
+ - locales/r10k.pot
386
412
  - r10k.gemspec
387
413
  - r10k.yaml.example
388
414
  - spec/fixtures/empty/.empty
@@ -391,6 +417,7 @@ files:
391
417
  - spec/fixtures/module/forge/eight_hundred/Modulefile
392
418
  - spec/fixtures/module/forge/eight_hundred/metadata.json
393
419
  - spec/fixtures/unit/puppetfile/argument-error/Puppetfile
420
+ - spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile
394
421
  - spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile
395
422
  - spec/fixtures/unit/puppetfile/load-error/Puppetfile
396
423
  - spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile
@@ -511,8 +538,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
511
538
  - !ruby/object:Gem::Version
512
539
  version: '0'
513
540
  requirements: []
514
- rubyforge_project:
515
- rubygems_version: 2.6.11
541
+ rubygems_version: 3.0.8
516
542
  signing_key:
517
543
  specification_version: 4
518
544
  summary: Puppet environment and module deployment
@@ -1,18 +0,0 @@
1
- {
2
- "version": 1,
3
- "file_format": "This MAINTAINERS file format is described at https://github.com/puppetlabs/maintainers",
4
- "issues": "https://tickets.puppet.com/browse/RK",
5
- "internal_list": "https://groups.google.com/a/puppet.com/forum/?hl=en#!forum/discuss-code-manager-maintainers",
6
- "people": [
7
- {
8
- "github": "andersonmills",
9
- "email": "anderson@puppet.com",
10
- "name": "Anderson Mills"
11
- },
12
- {
13
- "github": "scotje",
14
- "email": "jesse@puppet.com",
15
- "name": "Jesse Scott"
16
- }
17
- ]
18
- }
@@ -1,17 +0,0 @@
1
- test_name 'CODEMGMT-62 - C63199 - Install Utilities for r10k Integration Testing'
2
-
3
- #Init
4
- filebucket_path = '/opt/filebucket'
5
- filebucket_script_path = '/etc/profile.d/filebucket_path.sh'
6
-
7
- filebucket_script = <<-SCRIPT
8
- #!/bin/bash
9
- export PATH="${PATH}:#{filebucket_path}"
10
- SCRIPT
11
-
12
- step 'Install "filebucket" File Generator'
13
- create_remote_file(master, filebucket_script_path, filebucket_script)
14
- on(master, "git clone git://github.com/puppetlabs/filebucket.git #{filebucket_path}")
15
-
16
- on(master, "chmod 755 #{filebucket_script_path}")
17
- on(master, "chmod 755 #{filebucket_path}/filebucketapp.py")
@@ -1,86 +0,0 @@
1
- Scripts
2
- =======
3
-
4
- This folder contains helper scripts for setting up manual testing environments
5
- using [Beaker](https://github.com/puppetlabs/beaker) configuration files. The
6
- environments created by these scripts have "r10k" fully configured along with
7
- a Git repository with a valid "production" environment.
8
-
9
- These scripts are specific to the Puppet Labs environment and will not work in
10
- other environments without alteration!
11
-
12
- ## Prerequisites
13
-
14
- To utilize this test scripts you will need to have Ruby 1.9.3 or greater
15
- installed on your system along with Bundler. Also, the scripts utilize the
16
- "vmpooler" for virtual machine creation. Access to the "vmpooler" machines
17
- require having valid SSH private keys located on your local computer. Speak
18
- with a QA team member for more information on where to find the necessary
19
- SSH keys.
20
-
21
- ## Usage
22
-
23
- The scripts are written in Bash and should run on any Linux or Mac system as
24
- long as the prerequisites mentioned above are satisfied.
25
-
26
- ### Cloning
27
-
28
- First you will need to clone the "[r10k](https://github.com/puppetlabs/r10k)" repository on your local machine:
29
-
30
- ```bash
31
- git clone git@github.com:puppetlabs/r10k.git
32
- ```
33
-
34
- ### Executing Script
35
-
36
- Navigate to the integration tests "scripts" folder of the "r10k" repository
37
- clone:
38
-
39
- ```bash
40
- cd r10k/integration/scripts
41
- ```
42
-
43
- There are separate scripts for each supported platform. Select a desired
44
- platform and execute the script:
45
-
46
- ```bash
47
- bash setup_r10k_env_centos6.sh
48
- ```
49
-
50
- ## Connecting to Machines
51
-
52
- The setup process takes about 10 minutes to complete. Once finished Beaker
53
- will report that all tests have been run successfully. The output log will
54
- list the machines created. The Puppet master will have a name ending with
55
- "-master" which you can scrape from the Beaker console output. Example:
56
-
57
- ```
58
- a9lrs93vnujsrrg.delivery.puppetlabs.net (centos-6-x86_64-master) executed in 1.26 seconds
59
- ```
60
-
61
- The FQDN of the Puppet master ("a9lrs93vnujsrrg.delivery.puppetlabs.net" in the
62
- above example) will be printed to the left of the machine tag. The machine tag
63
- is a combination of the platform and role of the virtual machine.
64
-
65
- Now that you have the FQDN you can connect to the machine using SSH:
66
-
67
- ```bash
68
- ssh -i private_key root@a9lrs93vnujsrrg.delivery.puppetlabs.net
69
- ```
70
-
71
- *Note:* The correct SSH private key needs to be installed on your local machine
72
- first. Speak with a QA representative to get the correct key for "vmpooler"
73
- machines.
74
-
75
- ## Configuration Details
76
-
77
- Now that you have successfully connected to the Puppet master you can begin
78
- manual testing. The script has configured Git on the Puppet master to provide
79
- a working "production" environment for "r10k" testing. The Git repository
80
- serving the Puppet environments is located at "/git_repos/environments.git".
81
- There is a Git clone of the remote repository located at "/root/environments".
82
-
83
- When performing manual "r10k" testing you should utilize the Git clone
84
- repository located at "/root/environments". The "r10k" configuration file
85
- "/etc/puppetlabs/r10k/r10k.yaml" is already configured to use the remote Git
86
- repository for deployments.
@@ -1,23 +0,0 @@
1
- #!/bin/bash
2
- SCRIPT_PATH=$(pwd)
3
- BASENAME_CMD="basename ${SCRIPT_PATH}"
4
- SCRIPT_BASE_PATH=`eval ${BASENAME_CMD}`
5
-
6
- if [ $SCRIPT_BASE_PATH = "scripts" ]; then
7
- cd ../
8
- fi
9
-
10
- export pe_dist_dir=http://neptune.puppetlabs.lan/4.0/ci-ready/
11
- export GIT_PROVIDER=shellgit
12
-
13
- bundle install --path .bundle/gems
14
-
15
- bundle exec beaker \
16
- --preserve-hosts always \
17
- --config configs/pe/centos-5-64mda \
18
- --debug \
19
- --keyfile ~/.ssh/id_rsa-acceptance \
20
- --pre-suite pre-suite \
21
- --load-path lib
22
-
23
- rm -rf .bundle