r10k 3.2.3 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +20 -1
- data/CHANGELOG.mkd +41 -53
- data/doc/dynamic-environments/usage.mkd +0 -12
- data/docker/.rspec +1 -1
- data/docker/Gemfile +4 -0
- data/docker/Makefile +10 -12
- data/docker/r10k/Dockerfile +1 -1
- data/docker/r10k/spec/dockerfile_spec.rb +12 -5
- data/integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb +71 -0
- data/lib/r10k/action/deploy/environment.rb +2 -20
- data/lib/r10k/cli/deploy.rb +0 -1
- data/lib/r10k/module/git.rb +0 -5
- data/lib/r10k/puppetfile.rb +3 -10
- data/lib/r10k/version.rb +1 -1
- data/r10k.gemspec +2 -2
- data/spec/unit/action/deploy/environment_spec.rb +0 -63
- data/spec/unit/puppetfile_spec.rb +0 -19
- metadata +9 -10
- data/docker/r10k/spec/spec_helper.rb +0 -22
- data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32980c97963f0d5bb6515fcdd0482f19607bb7dd
|
4
|
+
data.tar.gz: a6797080cc3652fbcddf7a4b8433a9d8443d6fdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65f2fd216db51e69dcbd799b707f25b96329de64679f598bdfdb35fa25762b65d35ee1e891086366f383a78174ec0e0c06ff2b1f30502dace98d923613bcfe86
|
7
|
+
data.tar.gz: c2ff647aa4e140eef64e49256a2812aee64a5293e8ed0a4bf40341d0efb109c4ab5a5382cce824e05fe2a8d65f2a5de97d6a08341855897eb59975c0136f1172
|
data/.travis.yml
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
---
|
2
2
|
language: ruby
|
3
|
+
services:
|
4
|
+
- docker
|
3
5
|
bundler_args: "--without system"
|
4
6
|
script: "bundle exec rspec --color --format documentation spec/unit"
|
5
7
|
notifications:
|
6
8
|
email: false
|
7
9
|
sudo: false
|
8
10
|
jdk:
|
9
|
-
|
11
|
+
- oraclejdk8
|
10
12
|
before_install: gem install bundler -v '< 2' --no-document
|
11
13
|
matrix:
|
12
14
|
include:
|
@@ -18,3 +20,20 @@ matrix:
|
|
18
20
|
rvm: 2.3.0
|
19
21
|
- stage: r10k tests
|
20
22
|
rvm: jruby
|
23
|
+
- stage: r10k container tests
|
24
|
+
language: ruby
|
25
|
+
rvm: 2.5.5
|
26
|
+
env:
|
27
|
+
- DOCKER_COMPOSE_VERSION=1.24.0
|
28
|
+
script:
|
29
|
+
- |
|
30
|
+
set -ex
|
31
|
+
sudo rm /usr/local/bin/docker-compose
|
32
|
+
curl --location https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname --kernel-name`-`uname --machine` > docker-compose
|
33
|
+
chmod +x docker-compose
|
34
|
+
sudo mv docker-compose /usr/local/bin
|
35
|
+
cd docker
|
36
|
+
make lint
|
37
|
+
make build
|
38
|
+
make test
|
39
|
+
set +x
|
data/CHANGELOG.mkd
CHANGED
@@ -1,101 +1,98 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
-
3.
|
5
|
-
|
4
|
+
3.3.0
|
5
|
+
-----
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
## New Feature
|
8
|
+
|
9
|
+
Adds support for installing modules concurrently
|
10
|
+
|
11
|
+
## Bug Fixes
|
12
|
+
|
13
|
+
(RK-343) Pins CRI dependency to 2.15.6 to resolve regression in options
|
14
|
+
parsing.
|
11
15
|
|
12
16
|
3.2.0
|
13
17
|
-----
|
14
18
|
|
15
|
-
|
19
|
+
## New Feature
|
16
20
|
|
17
|
-
|
21
|
+
Add support for running `puppet generate types`
|
18
22
|
|
19
23
|
3.1.1
|
20
24
|
-----
|
21
25
|
|
22
|
-
|
26
|
+
## Bug Fixes
|
23
27
|
|
24
|
-
|
28
|
+
(RK-335) Postrun `modifiedenvs` doesn't include environment prefixes
|
25
29
|
|
26
30
|
3.1.0
|
27
31
|
-----
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
- Substitute environments acted on in postrun command.
|
33
|
+
## New Feature
|
32
34
|
|
33
|
-
|
34
|
-
(eg. ["/usr/local/bin/my-postrun-cmd", "--verbose", "$modifiedenvs"])
|
35
|
-
will have the string substituted with a space separated list
|
36
|
-
of environments acted upon (either a single environment if
|
37
|
-
specified on the command line or all environments).
|
35
|
+
Substitute environments acted on in postrun command.
|
38
36
|
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
Now post run commands that contain the string "$modifiedenvs"
|
38
|
+
(eg. ["/usr/local/bin/my-postrun-cmd", "--verbose", "$modifiedenvs"])
|
39
|
+
will have the string substituted with a space separated list
|
40
|
+
of environments acted upon (either a single environment if
|
41
|
+
specified on the command line or all environments).
|
42
42
|
|
43
|
-
|
43
|
+
Specifically this should allow users to easily wrap
|
44
|
+
`puppet generate types` and matches the terminology used
|
45
|
+
in g10k.
|
44
46
|
|
45
|
-
|
46
|
-
----
|
47
|
+
Many thanks to @raphink for the contribution.
|
47
48
|
|
48
|
-
### Changes
|
49
|
-
- Flag for overriding default branch configuration in Puppetfile
|
50
|
-
- Plumbing for internationalization
|
51
|
-
- Numerous test fixes and legacy docker work
|
52
49
|
|
53
50
|
3.0.3
|
54
51
|
----
|
55
52
|
|
56
|
-
|
53
|
+
## Bug Fixes
|
57
54
|
|
58
|
-
|
55
|
+
(RK-324) Fix Ruby pipe bug affecting Ubuntu
|
59
56
|
|
60
57
|
3.0.2
|
61
58
|
----
|
62
59
|
|
63
|
-
|
60
|
+
## Changes
|
64
61
|
|
65
|
-
|
62
|
+
Minor test fixes.
|
66
63
|
|
67
64
|
3.0.1
|
68
65
|
----
|
69
66
|
|
70
|
-
|
67
|
+
## Changes
|
71
68
|
|
72
69
|
Because of dependency issues R10K 3.0.0 required Ruby >= 2.3
|
73
70
|
rather than the reported 2.0. This release makes the requirement of
|
74
71
|
Ruby >= 2.3 official and documented.
|
75
72
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
(#853) ([RK-327](https://tickets.puppetlabs.com/browse/RK-327) Uninitialized Constant Cri::Error
|
74
|
+
When resolving the Cri dependency >= 2.13 R10K would fail with an
|
75
|
+
uninitialized constant error. Thanks to @ostavnaas for the bug report,
|
76
|
+
@ddfreyne for the fix, and @baurmatt for the review.
|
80
77
|
|
81
78
|
|
82
79
|
3.0.0
|
83
80
|
----
|
84
81
|
|
85
|
-
|
82
|
+
## Changes
|
86
83
|
|
87
|
-
|
84
|
+
### Known issues
|
88
85
|
- Child processes may die unexpectedly when deploying many environments
|
89
86
|
on Ubuntu Bionic. See
|
90
87
|
[RK-324](https://tickets.puppetlabs.com/browse/RK-324).
|
91
88
|
|
92
|
-
|
89
|
+
### Backwards breaking changes
|
93
90
|
- Drop support for Ruby < 2.0
|
94
91
|
- Remove support for PUPPETFILE and PUPPETFILE_DIR environment variables
|
95
92
|
when running the `puppetfile` action, please use flags instead.
|
96
93
|
- Fail when duplicate module definitions in Puppetfile
|
97
94
|
|
98
|
-
|
95
|
+
### Bug fixes
|
99
96
|
- More reliable pruning of refs on fetch
|
100
97
|
- Improved error messaging when:
|
101
98
|
- Unable to connect to a proxy
|
@@ -103,32 +100,24 @@ Ruby >= 2.3 official and documented.
|
|
103
100
|
- Unable to parse Puppetfile
|
104
101
|
- Various perfomance improvements
|
105
102
|
|
106
|
-
2.6.6
|
107
|
-
----
|
108
|
-
|
109
|
-
### Changes
|
110
|
-
- Flag for overriding default branch configuration in Puppetfile
|
111
|
-
- Plumbing for internationalization
|
112
|
-
- Numerous test fixes and legacy docker work
|
113
103
|
|
114
104
|
2.6.5
|
115
105
|
----
|
116
106
|
|
117
|
-
|
107
|
+
## Bug Fix
|
118
108
|
|
119
109
|
(RK-324) Fix Ruby pipe bug affecting Ubuntu
|
120
110
|
|
121
111
|
2.6.4
|
122
112
|
----
|
123
113
|
|
124
|
-
|
114
|
+
## Changes
|
125
115
|
|
126
116
|
Numerous test fixes.
|
127
117
|
|
128
118
|
2.6.3
|
129
119
|
----
|
130
|
-
|
131
|
-
### Changes
|
120
|
+
## Changes
|
132
121
|
|
133
122
|
Update specs with new error string.
|
134
123
|
|
@@ -137,7 +126,6 @@ when a release is made on that branch.
|
|
137
126
|
|
138
127
|
2.6.2
|
139
128
|
-----
|
140
|
-
|
141
129
|
### Changes
|
142
130
|
|
143
131
|
(RK-311) Yard dependency updated for security fix.
|
@@ -60,18 +60,6 @@ Update a single environment and force an update of modules:
|
|
60
60
|
This will update the given environment and update all contained modules. This is
|
61
61
|
useful if you want to make sure that a given environment is fully up to date.
|
62
62
|
|
63
|
-
- - -
|
64
|
-
|
65
|
-
Update a single environment and specify a default branch override:
|
66
|
-
|
67
|
-
r10k deploy environment my_working_environment --puppetfile --default-branch-override default_branch_override
|
68
|
-
|
69
|
-
This will update the given environment and update all contained modules, overrideing
|
70
|
-
the :default_branch entry in the Puppetfile of each module. This is used primarily to allow
|
71
|
-
automated r10k solutions using the control_branch pattern with a temporary branch deployment to
|
72
|
-
ensure the deployment is pushed to the correct module repository branch. Note that the :default_branch
|
73
|
-
is only ever utilized if the desired ref cannot be located.
|
74
|
-
|
75
63
|
### Deploying modules
|
76
64
|
|
77
65
|
Update a single module across all environments:
|
data/docker/.rspec
CHANGED
data/docker/Gemfile
CHANGED
data/docker/Makefile
CHANGED
@@ -6,21 +6,17 @@ build_date := $(shell date -u +%FT%T)
|
|
6
6
|
hadolint_available := $(shell hadolint --help > /dev/null 2>&1; echo $$?)
|
7
7
|
hadolint_command := hadolint --ignore DL3008 --ignore DL3018 --ignore DL4000 --ignore DL4001
|
8
8
|
hadolint_container := hadolint/hadolint:latest
|
9
|
+
pwd := $(shell pwd)
|
10
|
+
export BUNDLE_PATH = $(pwd)/.bundle/gems
|
11
|
+
export BUNDLE_BIN = $(pwd)/.bundle/bin
|
12
|
+
export GEMFILE = $(pwd)/Gemfile
|
9
13
|
|
10
|
-
|
11
|
-
|
12
|
-
version := puppet6-nightly
|
13
|
-
else
|
14
|
-
version = $(shell echo $(git_describe) | sed 's/-.*//')
|
15
|
-
dockerfile := Dockerfile
|
16
|
-
endif
|
17
|
-
|
14
|
+
version = $(shell echo $(git_describe) | sed 's/-.*//')
|
15
|
+
dockerfile := Dockerfile
|
18
16
|
|
19
17
|
prep:
|
20
|
-
ifneq ($(IS_NIGHTLY),true)
|
21
18
|
@git fetch --unshallow ||:
|
22
19
|
@git fetch origin 'refs/tags/*:refs/tags/*'
|
23
|
-
endif
|
24
20
|
|
25
21
|
lint:
|
26
22
|
ifeq ($(hadolint_available),0)
|
@@ -45,8 +41,10 @@ ifeq ($(IS_LATEST),true)
|
|
45
41
|
endif
|
46
42
|
|
47
43
|
test: prep
|
48
|
-
@bundle install --path
|
49
|
-
@PUPPET_TEST_DOCKER_IMAGE=$(NAMESPACE)/r10k:$(version)
|
44
|
+
@bundle install --path $$BUNDLE_PATH --gemfile $$GEMFILE
|
45
|
+
@PUPPET_TEST_DOCKER_IMAGE=$(NAMESPACE)/r10k:$(version) \
|
46
|
+
bundle exec --gemfile $$GEMFILE \
|
47
|
+
rspec r10k/spec
|
50
48
|
|
51
49
|
push-image: prep
|
52
50
|
@docker push $(NAMESPACE)/r10k:$(version)
|
data/docker/r10k/Dockerfile
CHANGED
@@ -5,10 +5,9 @@ require 'open3'
|
|
5
5
|
SPEC_DIRECTORY = File.dirname(__FILE__)
|
6
6
|
|
7
7
|
describe 'r10k container' do
|
8
|
-
include
|
9
|
-
|
8
|
+
include Pupperware::SpecHelpers
|
10
9
|
def run_r10k(command)
|
11
|
-
run_command("docker run --
|
10
|
+
run_command("docker run --detach \
|
12
11
|
--volume #{File.join(SPEC_DIRECTORY, 'fixtures')}:/test \
|
13
12
|
#{@image} #{command} \
|
14
13
|
--puppetfile /test/Puppetfile")
|
@@ -33,12 +32,20 @@ describe 'r10k container' do
|
|
33
32
|
|
34
33
|
it 'should validate the Puppetfile' do
|
35
34
|
result = run_r10k('puppetfile check')
|
36
|
-
|
35
|
+
container = result[:stdout].chomp
|
36
|
+
wait_on_container_exit(container)
|
37
|
+
expect(get_container_exit_code(container)).to eq(0)
|
38
|
+
emit_log(container)
|
39
|
+
teardown_container(container)
|
37
40
|
end
|
38
41
|
|
39
42
|
it 'should install the Puppetfile' do
|
40
43
|
result = run_r10k('puppetfile install')
|
41
|
-
|
44
|
+
container = result[:stdout].chomp
|
45
|
+
wait_on_container_exit(container)
|
46
|
+
expect(get_container_exit_code(container)).to eq(0)
|
42
47
|
expect(Dir.exist?(File.join(SPEC_DIRECTORY, 'fixtures', 'modules', 'ntp'))).to eq(true)
|
48
|
+
emit_log(container)
|
49
|
+
teardown_container(container)
|
43
50
|
end
|
44
51
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'RK-158 - C92361 - Attempt to install a PE-only module with no license file'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
|
8
|
+
r10k_fqp = get_r10k_fqp(master)
|
9
|
+
master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
|
10
|
+
|
11
|
+
git_repo_path = '/git_repos'
|
12
|
+
git_repo_name = 'environments'
|
13
|
+
git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
|
14
|
+
git_environments_path = '/root/environments'
|
15
|
+
last_commit = git_last_commit(master, git_environments_path)
|
16
|
+
git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
|
17
|
+
|
18
|
+
r10k_config_path = get_r10k_config_file_path(master)
|
19
|
+
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
20
|
+
|
21
|
+
#In-line files
|
22
|
+
r10k_conf = <<-CONF
|
23
|
+
cachedir: '/var/cache/r10k'
|
24
|
+
git:
|
25
|
+
provider: '#{git_provider}'
|
26
|
+
sources:
|
27
|
+
control:
|
28
|
+
basedir: "#{env_path}"
|
29
|
+
remote: "#{git_control_remote}"
|
30
|
+
CONF
|
31
|
+
|
32
|
+
#Manifest
|
33
|
+
site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
|
34
|
+
site_pp = create_site_pp(master_certname, ' include peonly')
|
35
|
+
|
36
|
+
# Verification
|
37
|
+
error_message_regex = /You must have a valid Puppet Enterprise® license on this node in order to download ztr-peonly/
|
38
|
+
|
39
|
+
#Teardown
|
40
|
+
teardown do
|
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
|
+
#Setup
|
49
|
+
step 'Stub the forge'
|
50
|
+
stub_forge_on(master)
|
51
|
+
|
52
|
+
step 'Backup a Valid "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 'Inject New "site.pp" to the "production" Environment'
|
59
|
+
inject_site_pp(master, site_pp_path, site_pp)
|
60
|
+
|
61
|
+
step 'Copy Puppetfile to "production" Environment Git Repo'
|
62
|
+
create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"')
|
63
|
+
|
64
|
+
step 'Push Changes'
|
65
|
+
git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
|
66
|
+
|
67
|
+
#Test
|
68
|
+
step 'Deploy "production" Environment via r10k'
|
69
|
+
on(master, "#{r10k_fqp} deploy environment -p", :acceptable_exit_codes => [0,1]) do |result|
|
70
|
+
assert_match(error_message_regex, result.stderr, 'Expected error message was not observed!')
|
71
|
+
end
|
@@ -129,7 +129,7 @@ module R10K
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def visit_puppetfile(puppetfile)
|
132
|
-
puppetfile.load
|
132
|
+
puppetfile.load
|
133
133
|
|
134
134
|
yield
|
135
135
|
|
@@ -145,24 +145,11 @@ module R10K
|
|
145
145
|
end
|
146
146
|
|
147
147
|
def write_environment_info!(environment, started_at, success)
|
148
|
-
module_deploys = []
|
149
|
-
begin
|
150
|
-
environment.puppetfile.modules.each do |mod|
|
151
|
-
name = mod.name
|
152
|
-
version = mod.version
|
153
|
-
sha = mod.repo.head rescue nil
|
154
|
-
module_deploys.push({:name => name, :version => version, :sha => sha})
|
155
|
-
end
|
156
|
-
rescue
|
157
|
-
logger.debug("Unable to get environment module deploy data for .r10k-deploy.json at #{environment.path}")
|
158
|
-
end
|
159
|
-
|
160
148
|
File.open("#{environment.path}/.r10k-deploy.json", 'w') do |f|
|
161
149
|
deploy_info = environment.info.merge({
|
162
150
|
:started_at => started_at,
|
163
151
|
:finished_at => Time.new,
|
164
152
|
:deploy_success => success,
|
165
|
-
:module_deploys => module_deploys,
|
166
153
|
})
|
167
154
|
|
168
155
|
f.puts(JSON.pretty_generate(deploy_info))
|
@@ -179,12 +166,7 @@ module R10K
|
|
179
166
|
end
|
180
167
|
|
181
168
|
def allowed_initialize_opts
|
182
|
-
super.merge(puppetfile: :self,
|
183
|
-
cachedir: :self,
|
184
|
-
'no-force': :self,
|
185
|
-
'generate-types': :self,
|
186
|
-
'puppet-path': :self,
|
187
|
-
'default-branch-override': :self)
|
169
|
+
super.merge(puppetfile: :self, cachedir: :self, 'no-force': :self, 'generate-types': :self, 'puppet-path': :self)
|
188
170
|
end
|
189
171
|
end
|
190
172
|
end
|
data/lib/r10k/cli/deploy.rb
CHANGED
@@ -61,7 +61,6 @@ scheduled. On subsequent deployments, Puppetfile deployment will default to off.
|
|
61
61
|
DESCRIPTION
|
62
62
|
|
63
63
|
flag :p, :puppetfile, 'Deploy modules from a puppetfile'
|
64
|
-
required nil, :'default-branch-override', 'Specify a branchname to override the default branch in the puppetfile'
|
65
64
|
|
66
65
|
runner R10K::Action::CriRunner.wrap(R10K::Action::Deploy::Environment)
|
67
66
|
end
|
data/lib/r10k/module/git.rb
CHANGED
@@ -23,11 +23,6 @@ class R10K::Module::Git < R10K::Module::Base
|
|
23
23
|
# @return [String]
|
24
24
|
attr_reader :desired_ref
|
25
25
|
|
26
|
-
# @!attribute [r] default_ref
|
27
|
-
# @api private
|
28
|
-
# @return [String]
|
29
|
-
attr_reader :default_ref
|
30
|
-
|
31
26
|
def initialize(title, dirname, args, environment=nil)
|
32
27
|
super
|
33
28
|
|
data/lib/r10k/puppetfile.rb
CHANGED
@@ -63,20 +63,17 @@ class Puppetfile
|
|
63
63
|
@loaded = false
|
64
64
|
end
|
65
65
|
|
66
|
-
def load
|
66
|
+
def load
|
67
67
|
if File.readable? @puppetfile_path
|
68
|
-
self.load!
|
68
|
+
self.load!
|
69
69
|
else
|
70
70
|
logger.debug _("Puppetfile %{path} missing or unreadable") % {path: @puppetfile_path.inspect}
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
def load!
|
75
|
-
@default_branch_override = default_branch_override
|
76
|
-
|
74
|
+
def load!
|
77
75
|
dsl = R10K::Puppetfile::DSL.new(self)
|
78
76
|
dsl.instance_eval(puppetfile_contents, @puppetfile_path)
|
79
|
-
|
80
77
|
validate_no_duplicate_names(@modules)
|
81
78
|
@loaded = true
|
82
79
|
rescue SyntaxError, LoadError, ArgumentError, NameError => e
|
@@ -121,10 +118,6 @@ class Puppetfile
|
|
121
118
|
install_path = @moduledir
|
122
119
|
end
|
123
120
|
|
124
|
-
if args.is_a?(Hash) && @default_branch_override != nil
|
125
|
-
args[:default_branch] = @default_branch_override
|
126
|
-
end
|
127
|
-
|
128
121
|
# Keep track of all the content this Puppetfile is managing to enable purging.
|
129
122
|
@managed_content[install_path] = Array.new unless @managed_content.has_key?(install_path)
|
130
123
|
|
data/lib/r10k/version.rb
CHANGED
data/r10k.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.license = 'Apache-2.0'
|
24
24
|
|
25
25
|
s.add_dependency 'colored', '1.2'
|
26
|
-
s.add_dependency 'cri', '
|
26
|
+
s.add_dependency 'cri', '2.15.6'
|
27
27
|
|
28
28
|
s.add_dependency 'log4r', '1.1.10'
|
29
29
|
s.add_dependency 'multi_json', '~> 1.10'
|
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
|
37
37
|
s.add_development_dependency 'rake'
|
38
38
|
|
39
39
|
s.add_development_dependency 'yard', '~> 0.9.11'
|
40
|
-
s.add_development_dependency 'minitar', '~> 0.
|
40
|
+
s.add_development_dependency 'minitar', '~> 0.6.1'
|
41
41
|
|
42
42
|
s.files = %x[git ls-files].split($/)
|
43
43
|
s.require_path = 'lib'
|
@@ -19,10 +19,6 @@ 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
|
-
|
26
22
|
it "can accept a no-force option" do
|
27
23
|
described_class.new({:'no-force' => true}, [])
|
28
24
|
end
|
@@ -332,63 +328,4 @@ describe R10K::Action::Deploy::Environment do
|
|
332
328
|
end
|
333
329
|
end
|
334
330
|
end
|
335
|
-
|
336
|
-
describe "write_environment_info!" do
|
337
|
-
|
338
|
-
class Fake_Environment
|
339
|
-
attr_accessor :path
|
340
|
-
attr_accessor :puppetfile
|
341
|
-
attr_accessor :info
|
342
|
-
|
343
|
-
def initialize(path, info)
|
344
|
-
@path = path
|
345
|
-
@info = info
|
346
|
-
@puppetfile = R10K::Puppetfile.new
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
let(:mock_stateful_repo_1) { instance_double("R10K::Git::StatefulRepository", :head => "123456") }
|
351
|
-
let(:mock_stateful_repo_2) { instance_double("R10K::Git::StatefulRepository", :head => "654321") }
|
352
|
-
let(:mock_git_module_1) { instance_double("R10K::Module::Git", :name => "my_cool_module", :version => "1.0", :repo => mock_stateful_repo_1) }
|
353
|
-
let(:mock_git_module_2) { instance_double("R10K::Module::Git", :name => "my_lame_module", :version => "0.0.1", :repo => mock_stateful_repo_2) }
|
354
|
-
let(:mock_forge_module_1) { double(:name => "their_shiny_module", :version => "2.0.0") }
|
355
|
-
let(:mock_puppetfile) { instance_double("R10K::Puppetfile", :modules => [mock_git_module_1, mock_git_module_2, mock_forge_module_1]) }
|
356
|
-
|
357
|
-
before(:all) do
|
358
|
-
@tmp_path = "./tmp-r10k-test-dir/"
|
359
|
-
Dir.mkdir(@tmp_path) unless File.exists?(@tmp_path)
|
360
|
-
end
|
361
|
-
|
362
|
-
after(:all) do
|
363
|
-
File.delete("#{@tmp_path}/.r10k-deploy.json")
|
364
|
-
Dir.delete(@tmp_path)
|
365
|
-
end
|
366
|
-
|
367
|
-
it "writes the .r10k-deploy file correctly" do
|
368
|
-
allow(R10K::Puppetfile).to receive(:new).and_return(mock_puppetfile)
|
369
|
-
allow(mock_forge_module_1).to receive(:repo).and_raise(NoMethodError)
|
370
|
-
|
371
|
-
fake_env = Fake_Environment.new(@tmp_path, {:name => "my_cool_environment", :signature => "pablo picasso"})
|
372
|
-
subject.send(:write_environment_info!, fake_env, "2019-01-01 23:23:22 +0000", true)
|
373
|
-
|
374
|
-
file_contents = File.read("#{@tmp_path}/.r10k-deploy.json")
|
375
|
-
r10k_deploy = JSON.parse(file_contents)
|
376
|
-
|
377
|
-
expect(r10k_deploy['name']).to eq("my_cool_environment")
|
378
|
-
expect(r10k_deploy['signature']).to eq("pablo picasso")
|
379
|
-
expect(r10k_deploy['started_at']).to eq("2019-01-01 23:23:22 +0000")
|
380
|
-
expect(r10k_deploy['deploy_success']).to eq(true)
|
381
|
-
expect(r10k_deploy['module_deploys'].length).to eq(3)
|
382
|
-
expect(r10k_deploy['module_deploys'][0]['name']).to eq("my_cool_module")
|
383
|
-
expect(r10k_deploy['module_deploys'][0]['version']).to eq("1.0")
|
384
|
-
expect(r10k_deploy['module_deploys'][0]['sha']).to eq("123456")
|
385
|
-
expect(r10k_deploy['module_deploys'][1]['name']).to eq("my_lame_module")
|
386
|
-
expect(r10k_deploy['module_deploys'][1]['version']).to eq("0.0.1")
|
387
|
-
expect(r10k_deploy['module_deploys'][1]['sha']).to eq("654321")
|
388
|
-
expect(r10k_deploy['module_deploys'][2]['name']).to eq("their_shiny_module")
|
389
|
-
expect(r10k_deploy['module_deploys'][2]['version']).to eq("2.0.0")
|
390
|
-
expect(r10k_deploy['module_deploys'][2]['sha']).to eq(nil)
|
391
|
-
|
392
|
-
end
|
393
|
-
end
|
394
331
|
end
|
@@ -227,25 +227,6 @@ describe R10K::Puppetfile do
|
|
227
227
|
subject = described_class.new(path)
|
228
228
|
expect { subject.load! }.not_to raise_error
|
229
229
|
end
|
230
|
-
|
231
|
-
it "creates a git module and applies the default branch sepcified in the Puppetfile" do
|
232
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
|
233
|
-
pf_path = File.join(path, 'Puppetfile')
|
234
|
-
subject = described_class.new(path)
|
235
|
-
expect { subject.load! }.not_to raise_error
|
236
|
-
git_module = subject.modules[0]
|
237
|
-
expect(git_module.default_ref).to eq 'here_lies_the_default_branch'
|
238
|
-
end
|
239
|
-
|
240
|
-
it "creates a git module and applies the provided default_branch_override" do
|
241
|
-
path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
|
242
|
-
pf_path = File.join(path, 'Puppetfile')
|
243
|
-
subject = described_class.new(path)
|
244
|
-
default_branch_override = 'default_branch_override_name'
|
245
|
-
expect { subject.load!(default_branch_override) }.not_to raise_error
|
246
|
-
git_module = subject.modules[0]
|
247
|
-
expect(git_module.default_ref).to eq default_branch_override
|
248
|
-
end
|
249
230
|
end
|
250
231
|
|
251
232
|
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: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrien Thebo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: cri
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.15.
|
33
|
+
version: 2.15.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.15.
|
40
|
+
version: 2.15.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: log4r
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 0.6.1
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 0.6.1
|
153
153
|
description: |2
|
154
154
|
R10K provides a general purpose toolset for deploying Puppet environments and modules.
|
155
155
|
It implements the Puppetfile format and provides a native implementation of Puppet
|
@@ -199,7 +199,6 @@ files:
|
|
199
199
|
- docker/r10k/docker-entrypoint.sh
|
200
200
|
- docker/r10k/spec/dockerfile_spec.rb
|
201
201
|
- docker/r10k/spec/fixtures/Puppetfile
|
202
|
-
- docker/r10k/spec/spec_helper.rb
|
203
202
|
- integration/Gemfile
|
204
203
|
- integration/README.mkd
|
205
204
|
- integration/Rakefile
|
@@ -235,6 +234,7 @@ files:
|
|
235
234
|
- integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb
|
236
235
|
- integration/tests/README.mkd
|
237
236
|
- integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb
|
237
|
+
- integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb
|
238
238
|
- integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb
|
239
239
|
- integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb
|
240
240
|
- integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb
|
@@ -410,7 +410,6 @@ files:
|
|
410
410
|
- spec/fixtures/unit/action/r10k_generate_types.yaml
|
411
411
|
- spec/fixtures/unit/action/r10k_puppet_path.yaml
|
412
412
|
- spec/fixtures/unit/puppetfile/argument-error/Puppetfile
|
413
|
-
- spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile
|
414
413
|
- spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile
|
415
414
|
- spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile
|
416
415
|
- spec/fixtures/unit/puppetfile/load-error/Puppetfile
|
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'open3'
|
2
|
-
|
3
|
-
module Helpers
|
4
|
-
def run_command(command)
|
5
|
-
stdout_string = ''
|
6
|
-
status = nil
|
7
|
-
|
8
|
-
Open3.popen3(command) do |stdin, stdout, stderr, wait_thread|
|
9
|
-
Thread.new do
|
10
|
-
stdout.each { |l| stdout_string << l; STDOUT.puts l }
|
11
|
-
end
|
12
|
-
Thread.new do
|
13
|
-
stderr.each { |l| STDOUT.puts l }
|
14
|
-
end
|
15
|
-
|
16
|
-
stdin.close
|
17
|
-
status = wait_thread.value
|
18
|
-
end
|
19
|
-
|
20
|
-
{ status: status, stdout: stdout_string }
|
21
|
-
end
|
22
|
-
end
|