r10k 1.3.5 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +1 -1
- data/CHANGELOG.mkd +210 -0
- data/CONTRIBUTING.mkd +105 -0
- data/Gemfile +2 -6
- data/README.mkd +97 -0
- data/doc/common-patterns.mkd +44 -0
- data/doc/dynamic-environments.mkd +12 -5
- data/doc/dynamic-environments/configuration.mkd +16 -1
- data/doc/dynamic-environments/{git-environments.markdown → git-environments.mkd} +13 -9
- data/doc/dynamic-environments/introduction.mkd +1 -2
- data/doc/dynamic-environments/master-configuration.mkd +70 -0
- data/doc/dynamic-environments/quickstart.mkd +241 -0
- data/doc/dynamic-environments/svn-environments.mkd +45 -0
- data/doc/dynamic-environments/usage.mkd +44 -5
- data/doc/dynamic-environments/workflow-guide.mkd +247 -0
- data/doc/faq.mkd +52 -0
- data/doc/puppetfile.mkd +203 -0
- data/lib/r10k/action/cri_runner.rb +75 -0
- data/lib/r10k/action/deploy.rb +9 -0
- data/lib/r10k/action/deploy/display.rb +104 -0
- data/lib/r10k/action/deploy/environment.rb +92 -0
- data/lib/r10k/action/deploy/module.rb +70 -0
- data/lib/r10k/action/puppetfile.rb +10 -0
- data/lib/r10k/action/puppetfile/check.rb +41 -0
- data/lib/r10k/action/puppetfile/cri_runner.rb +32 -0
- data/lib/r10k/action/puppetfile/install.rb +53 -0
- data/lib/r10k/action/puppetfile/purge.rb +37 -0
- data/lib/r10k/action/runner.rb +36 -0
- data/lib/r10k/action/visitor.rb +31 -0
- data/lib/r10k/cli/deploy.rb +14 -45
- data/lib/r10k/cli/puppetfile.rb +15 -53
- data/lib/r10k/deployment.rb +113 -58
- data/lib/r10k/deployment/basedir.rb +3 -38
- data/lib/r10k/deployment/config.rb +2 -1
- data/lib/r10k/deployment/source.rb +2 -0
- data/lib/r10k/environment/base.rb +40 -0
- data/lib/r10k/environment/git.rb +14 -17
- data/lib/r10k/environment/svn.rb +31 -15
- data/lib/r10k/errors.rb +33 -22
- data/lib/r10k/errors/formatting.rb +28 -0
- data/lib/r10k/execution.rb +2 -0
- data/lib/r10k/git/cache.rb +1 -6
- data/lib/r10k/git/errors.rb +1 -2
- data/lib/r10k/git/ref.rb +1 -1
- data/lib/r10k/module.rb +1 -1
- data/lib/r10k/module/base.rb +94 -2
- data/lib/r10k/module/forge.rb +33 -30
- data/lib/r10k/module/git.rb +13 -9
- data/lib/r10k/module/svn.rb +41 -28
- data/lib/r10k/puppetfile.rb +17 -1
- data/lib/r10k/semver.rb +2 -0
- data/lib/r10k/source/base.rb +8 -0
- data/lib/r10k/source/git.rb +1 -1
- data/lib/r10k/source/svn.rb +23 -5
- data/lib/r10k/svn/remote.rb +23 -3
- data/lib/r10k/svn/working_dir.rb +60 -9
- data/lib/r10k/task.rb +1 -0
- data/lib/r10k/task/deployment.rb +9 -1
- data/lib/r10k/task/environment.rb +2 -0
- data/lib/r10k/task/module.rb +1 -0
- data/lib/r10k/task/puppetfile.rb +3 -0
- data/lib/r10k/task_runner.rb +1 -0
- data/lib/r10k/util/attempt.rb +84 -0
- data/lib/r10k/util/basedir.rb +65 -0
- data/lib/r10k/util/purgeable.rb +55 -45
- data/lib/r10k/util/setopts.rb +53 -0
- data/lib/r10k/util/subprocess.rb +6 -30
- data/lib/r10k/util/subprocess/posix/runner.rb +29 -2
- data/lib/r10k/util/subprocess/result.rb +17 -4
- data/lib/r10k/util/subprocess/subprocess_error.rb +24 -0
- data/lib/r10k/version.rb +1 -1
- data/r10k.gemspec +7 -29
- data/spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/load-error/Puppetfile +1 -0
- data/spec/matchers/exit_with.rb +28 -0
- data/spec/r10k-mocks.rb +3 -0
- data/spec/r10k-mocks/mock_config.rb +28 -0
- data/spec/r10k-mocks/mock_env.rb +7 -0
- data/spec/r10k-mocks/mock_source.rb +10 -0
- data/spec/shared-examples/git-ref.rb +7 -7
- data/spec/spec_helper.rb +17 -5
- data/spec/unit/action/cri_runner_spec.rb +76 -0
- data/spec/unit/action/puppetfile/cri_action_spec.rb +65 -0
- data/spec/unit/action/runner_spec.rb +64 -0
- data/spec/unit/action/visitor_spec.rb +39 -0
- data/spec/unit/deployment_spec.rb +142 -0
- data/spec/unit/environment/base_spec.rb +38 -0
- data/spec/unit/environment/git_spec.rb +40 -10
- data/spec/unit/environment/svn_spec.rb +41 -4
- data/spec/unit/errors/formatting_spec.rb +84 -0
- data/spec/unit/git/alternates_spec.rb +1 -1
- data/spec/unit/git/head_spec.rb +1 -1
- data/spec/unit/git/ref_spec.rb +1 -1
- data/spec/unit/git/working_dir_spec.rb +1 -1
- data/spec/unit/module/base_spec.rb +72 -0
- data/spec/unit/module/forge_spec.rb +49 -8
- data/spec/unit/module/git_spec.rb +78 -0
- data/spec/unit/module/svn_spec.rb +40 -4
- data/spec/unit/module_spec.rb +3 -3
- data/spec/unit/puppetfile_spec.rb +84 -0
- data/spec/unit/settings/container_spec.rb +1 -1
- data/spec/unit/source/base_spec.rb +31 -0
- data/spec/unit/source/git_spec.rb +7 -7
- data/spec/unit/source/svn_spec.rb +1 -1
- data/spec/unit/svn/working_dir_spec.rb +56 -0
- data/spec/unit/util/attempt_spec.rb +82 -0
- data/spec/unit/util/setopts_spec.rb +59 -0
- data/spec/unit/util/subprocess/result_spec.rb +36 -0
- data/spec/unit/util/subprocess/subprocess_error_spec.rb +26 -0
- data/spec/unit/util/subprocess_spec.rb +2 -7
- metadata +83 -100
- data/.nodeset.yml +0 -7
- data/.rspec +0 -1
- data/README.markdown +0 -276
- data/Rakefile +0 -1
- data/doc/puppetfile.markdown +0 -87
- data/spec/rspec-system-r10k/puppetfile.rb +0 -24
- data/spec/rspec-system-r10k/tmpdir.rb +0 -32
- data/spec/system-provisioning/el.rb +0 -38
- data/spec/system/module/forge/install_spec.rb +0 -51
- data/spec/system/module/git/install_spec.rb +0 -117
- data/spec/system/module/svn/install_spec.rb +0 -51
- data/spec/system/module/svn/update_spec.rb +0 -38
- data/spec/system/spec_helper.rb +0 -60
- data/spec/system/system-helpers.rb +0 -4
- data/spec/system/version_spec.rb +0 -7
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'system/spec_helper'
|
2
|
-
|
3
|
-
describe 'installing modules from the forge' do
|
4
|
-
|
5
|
-
describe 'when no version is specified' do
|
6
|
-
|
7
|
-
include_context 'system module installation'
|
8
|
-
|
9
|
-
before(:all) do
|
10
|
-
shell %[echo 'mod "adrien/boolean"' > ./Puppetfile]
|
11
|
-
shell %[r10k puppetfile install]
|
12
|
-
end
|
13
|
-
|
14
|
-
describe file('modules/boolean/metadata.json') do
|
15
|
-
its(:content) { should match /adrien-boolean/ }
|
16
|
-
its(:content) { should match /version.*1\.0\.1/ }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe 'when a specific version is specified' do
|
21
|
-
|
22
|
-
include_context 'system module installation'
|
23
|
-
|
24
|
-
before(:all) do
|
25
|
-
shell %[echo 'mod "adrien/boolean", "0.9.0"' > ./Puppetfile]
|
26
|
-
shell %[r10k puppetfile install]
|
27
|
-
end
|
28
|
-
|
29
|
-
describe file('modules/boolean/metadata.json') do
|
30
|
-
its(:content) { should match /adrien-boolean/ }
|
31
|
-
its(:content) { should match /version.*0\.9\.0/ }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'when the latest version is requested' do
|
36
|
-
|
37
|
-
include_context 'system module installation'
|
38
|
-
|
39
|
-
before(:all) do
|
40
|
-
shell %[echo 'mod "adrien/boolean", "0.9.0"' > ./Puppetfile]
|
41
|
-
shell %[r10k puppetfile install]
|
42
|
-
shell %[echo 'mod "adrien/boolean", :latest' > ./Puppetfile]
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'upgrades to the latest version' do
|
46
|
-
shell %[r10k puppetfile install]
|
47
|
-
|
48
|
-
expect(file('modules/boolean/metadata.json').content).to match /version.*1\.0\.1/
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'system/spec_helper'
|
2
|
-
|
3
|
-
describe 'installing modules from git' do
|
4
|
-
|
5
|
-
before(:all) { yum_install 'git' }
|
6
|
-
after(:all) { shell %[yum -y remove git] }
|
7
|
-
|
8
|
-
describe 'when no version is specified' do
|
9
|
-
|
10
|
-
include_context 'system module installation'
|
11
|
-
|
12
|
-
before(:all) do
|
13
|
-
create_puppetfile(
|
14
|
-
%[mod 'boolean', :git => 'git://github.com/adrienthebo/puppet-boolean']
|
15
|
-
)
|
16
|
-
end
|
17
|
-
it "defaults to 'master'" do
|
18
|
-
puppetfile_install
|
19
|
-
|
20
|
-
shell %[git --git-dir=modules/boolean/.git rev-parse HEAD] do |results|
|
21
|
-
expect(results.stdout).to match /157011a4eaa27f1202a9d94335ee4876b26d377e/
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "with a ref" do
|
27
|
-
|
28
|
-
include_context 'system module installation'
|
29
|
-
|
30
|
-
before(:all) do
|
31
|
-
create_puppetfile(
|
32
|
-
%[mod 'boolean',
|
33
|
-
:git => 'git://github.com/adrienthebo/puppet-boolean',
|
34
|
-
:ref => '0.9.0'
|
35
|
-
]
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "checks out the tag when the ref is a tag" do
|
40
|
-
puppetfile_install
|
41
|
-
|
42
|
-
shell %[git --git-dir=modules/boolean/.git rev-parse HEAD] do |results|
|
43
|
-
expect(results.stdout).to match /3084373e8d181cf2fea5b4ade2690ba22872bd67/
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
it "checks out the commit when the ref is a commit"
|
48
|
-
it "checks out the branch when the ref is a branch"
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "with a tag" do
|
52
|
-
|
53
|
-
include_context 'system module installation'
|
54
|
-
|
55
|
-
before(:all) do
|
56
|
-
create_puppetfile(
|
57
|
-
%[mod 'boolean',
|
58
|
-
:git => 'git://github.com/adrienthebo/puppet-boolean',
|
59
|
-
:tag => '0.9.0'
|
60
|
-
]
|
61
|
-
)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "checks out the tag" do
|
65
|
-
puppetfile_install
|
66
|
-
|
67
|
-
shell %[git --git-dir=modules/boolean/.git rev-parse HEAD] do |results|
|
68
|
-
expect(results.stdout).to match /3084373e8d181cf2fea5b4ade2690ba22872bd67/
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
describe "with a commit" do
|
74
|
-
|
75
|
-
include_context 'system module installation'
|
76
|
-
|
77
|
-
before(:all) do
|
78
|
-
create_puppetfile(
|
79
|
-
%[mod 'boolean',
|
80
|
-
:git => 'git://github.com/adrienthebo/puppet-boolean',
|
81
|
-
:commit => 'd98ba4af3b4fd632fc7f2d652c4f9e142186dbd1'
|
82
|
-
]
|
83
|
-
)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "checks out the commit" do
|
87
|
-
puppetfile_install
|
88
|
-
|
89
|
-
shell %[git --git-dir=modules/boolean/.git rev-parse HEAD] do |results|
|
90
|
-
expect(results.stdout).to match /d98ba4af3b4fd632fc7f2d652c4f9e142186dbd1/
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "with a branch" do
|
96
|
-
|
97
|
-
include_context 'system module installation'
|
98
|
-
|
99
|
-
before(:all) do
|
100
|
-
create_puppetfile(
|
101
|
-
%[mod 'boolean',
|
102
|
-
:git => 'git://github.com/adrienthebo/puppet-boolean',
|
103
|
-
:branch => 'master'
|
104
|
-
]
|
105
|
-
)
|
106
|
-
end
|
107
|
-
|
108
|
-
it "checks out the branch" do
|
109
|
-
puppetfile_install
|
110
|
-
|
111
|
-
shell %[git --git-dir=modules/boolean/.git rev-parse HEAD] do |results|
|
112
|
-
expect(results.stdout).to match /157011a4eaa27f1202a9d94335ee4876b26d377e/
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'system/spec_helper'
|
2
|
-
|
3
|
-
describe 'installing modules from SVN' do
|
4
|
-
|
5
|
-
extend SystemProvisioning::EL
|
6
|
-
|
7
|
-
before(:all) { yum_install 'subversion' }
|
8
|
-
after(:all) { shell %[yum -y remove subversion] }
|
9
|
-
|
10
|
-
describe 'when no version is specified' do
|
11
|
-
|
12
|
-
include_context 'system module installation'
|
13
|
-
|
14
|
-
before(:all) do
|
15
|
-
shell %[echo "mod 'gitolite', :svn => 'https://github.com/nvalentine-puppetlabs/puppet-gitolite/trunk'" > ./Puppetfile]
|
16
|
-
end
|
17
|
-
|
18
|
-
it "installs the module successfully" do
|
19
|
-
shell %[r10k puppetfile install] do |sh|
|
20
|
-
expect(sh.exit_code).to eq 0
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it "creates the svn module" do
|
25
|
-
expect(file('modules/gitolite/.svn')).to be_directory
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe 'when a revision is specified' do
|
30
|
-
|
31
|
-
include_context 'system module installation'
|
32
|
-
|
33
|
-
before(:all) do
|
34
|
-
shell %[echo "mod 'gitolite', :svn => 'https://github.com/nvalentine-puppetlabs/puppet-gitolite/trunk', :rev => '10'" > ./Puppetfile]
|
35
|
-
end
|
36
|
-
|
37
|
-
it "installs the module successfully" do
|
38
|
-
shell %[r10k puppetfile install] do |sh|
|
39
|
-
expect(sh.exit_code).to eq 0
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
it "creates the svn module" do
|
44
|
-
expect(file('modules/gitolite/.svn')).to be_directory
|
45
|
-
end
|
46
|
-
|
47
|
-
it "checks out the specific revision" do
|
48
|
-
expect(command('cd modules/gitolite; svn info')).to return_stdout /Revision: 10/
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'system/spec_helper'
|
2
|
-
|
3
|
-
describe 'updating modules from SVN' do
|
4
|
-
|
5
|
-
extend SystemProvisioning::EL
|
6
|
-
|
7
|
-
before(:all) { yum_install 'subversion' }
|
8
|
-
after(:all) { shell %[yum -y remove subversion] }
|
9
|
-
|
10
|
-
|
11
|
-
it "reinstalls the module when the installed module isn't an svn repo"
|
12
|
-
it "reinstalls the module when the svn url doesn't match the installed module"
|
13
|
-
|
14
|
-
describe 'updating to a specific revision' do
|
15
|
-
|
16
|
-
include_context 'system module installation'
|
17
|
-
|
18
|
-
before(:all) do
|
19
|
-
shell %[echo "mod 'gitolite', :svn => 'https://github.com/nvalentine-puppetlabs/puppet-gitolite/trunk', :rev => '10'" > ./Puppetfile]
|
20
|
-
shell %[r10k puppetfile install]
|
21
|
-
shell %[echo "mod 'gitolite', :svn => 'https://github.com/nvalentine-puppetlabs/puppet-gitolite/trunk', :rev => '20'" > ./Puppetfile]
|
22
|
-
end
|
23
|
-
|
24
|
-
it "installs the module successfully" do
|
25
|
-
shell %[r10k puppetfile install] do |sh|
|
26
|
-
expect(sh.exit_code).to eq 0
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it "checks out the specific revision" do
|
31
|
-
expect(command('cd modules/gitolite; svn info')).to return_stdout /Revision: 20/
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'when the installed revision is newer than the requested version' do
|
36
|
-
it 'downgrades the module'
|
37
|
-
end
|
38
|
-
end
|
data/spec/system/spec_helper.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'rspec-system/spec_helper'
|
2
|
-
require 'rspec-system-serverspec/helpers'
|
3
|
-
|
4
|
-
require 'system/system-helpers'
|
5
|
-
|
6
|
-
require 'system-provisioning/el'
|
7
|
-
|
8
|
-
require 'rspec-system-r10k/tmpdir'
|
9
|
-
require 'rspec-system-r10k/puppetfile'
|
10
|
-
|
11
|
-
RSpec.configure do |c|
|
12
|
-
|
13
|
-
include SystemProvisioning::EL
|
14
|
-
|
15
|
-
def install_deps
|
16
|
-
install_epel_release
|
17
|
-
install_puppetlabs_release
|
18
|
-
|
19
|
-
yum_install %w[ruby rubygems]
|
20
|
-
yum_install %w[puppet]
|
21
|
-
end
|
22
|
-
|
23
|
-
def build_artifact
|
24
|
-
require 'r10k/version'
|
25
|
-
|
26
|
-
desc = %x{git describe}.chomp
|
27
|
-
artifact_name = "r10k-#{desc}.gem"
|
28
|
-
|
29
|
-
system('gem build r10k.gemspec')
|
30
|
-
FileUtils.mv "r10k-#{R10K::VERSION}.gem", artifact_name
|
31
|
-
|
32
|
-
artifact_name
|
33
|
-
end
|
34
|
-
|
35
|
-
def upload_artifact(name)
|
36
|
-
rcp :sp => "./#{name}", :dp => '/root'
|
37
|
-
FileUtils.rm name
|
38
|
-
end
|
39
|
-
|
40
|
-
def install_artifact(name)
|
41
|
-
shell "gem install --no-rdoc --no-ri /root/#{name}"
|
42
|
-
shell "rm /root/#{name}"
|
43
|
-
end
|
44
|
-
|
45
|
-
def purge_gems
|
46
|
-
shell 'gem list | cut -d" " -f1 | xargs gem uninstall -aIx'
|
47
|
-
end
|
48
|
-
|
49
|
-
def purge_r10k
|
50
|
-
shell 'gem uninstall -aIx r10k'
|
51
|
-
end
|
52
|
-
|
53
|
-
c.before(:suite) do
|
54
|
-
purge_r10k
|
55
|
-
install_deps
|
56
|
-
name = build_artifact
|
57
|
-
upload_artifact(name)
|
58
|
-
install_artifact(name)
|
59
|
-
end
|
60
|
-
end
|