r10k 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/.travis.yml +17 -6
- data/CHANGELOG.mkd +33 -16
- data/azure-pipelines.yml +16 -10
- data/doc/dynamic-environments/usage.mkd +12 -0
- data/docker/.gitignore +1 -0
- data/docker/Gemfile +1 -1
- data/docker/Makefile +47 -0
- data/docker/ci/build.ps1 +81 -13
- data/docker/distelli-manifest.yml +6 -1
- data/docker/r10k/spec/dockerfile_spec.rb +28 -13
- data/docker/r10k/spec/fixtures/Puppetfile +2 -0
- data/integration/Gemfile +2 -2
- data/integration/Rakefile +0 -1
- data/integration/pre-suite/00_pe_install.rb +1 -0
- data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +2 -2
- data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +2 -2
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +2 -12
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +2 -11
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +2 -12
- data/lib/r10k/action/deploy/environment.rb +2 -2
- data/lib/r10k/cli/deploy.rb +1 -0
- data/lib/r10k/module/git.rb +5 -0
- data/lib/r10k/puppetfile.rb +10 -3
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +490 -0
- data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +5 -0
- data/spec/unit/action/deploy/environment_spec.rb +4 -0
- data/spec/unit/puppetfile_spec.rb +19 -0
- metadata +6 -4
- data/docker/ci/build +0 -72
- data/integration/pre-suite/30_test_utils.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cc458f9c6f5fc825c4a915db8ba1f4c62d9f9e3
|
4
|
+
data.tar.gz: f1bcb084a79e0fc0bcf17352a98b2cd162fc1fa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa362d85081c4378839c4027f9feffd8411606d55c88f4101c6fe334eb872b0a470bac76a90ec070532f802310588fd3ff66a63b7164f3e986fd7af0ba1dddc7
|
7
|
+
data.tar.gz: 77b14cd6661fcf9c70d73aec1ad11faccf65ac30479872b08e86055436b0f64fb40ec764e5b5d9174d0ea036ac9430052555057de769d475cee6d07b1f6596f9
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,15 +1,26 @@
|
|
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
|
-
before_install: gem update bundler
|
9
|
-
rvm:
|
10
|
-
- "2.5"
|
11
|
-
- "2.4"
|
12
|
-
- "2.3"
|
13
|
-
- "jruby"
|
14
10
|
jdk:
|
15
11
|
- oraclejdk8
|
12
|
+
before_install: gem install bundler -v '< 2' --no-document
|
13
|
+
matrix:
|
14
|
+
include:
|
15
|
+
- stage: r10k tests
|
16
|
+
rvm: 2.5.0
|
17
|
+
- stage: r10k tests
|
18
|
+
rvm: 2.4.0
|
19
|
+
- stage: r10k tests
|
20
|
+
rvm: 2.3.0
|
21
|
+
- stage: r10k tests
|
22
|
+
rvm: jruby
|
23
|
+
- stage: r10k container tests
|
24
|
+
language: generic
|
25
|
+
script:
|
26
|
+
- cd docker && make lint && make build && make test
|
data/CHANGELOG.mkd
CHANGED
@@ -1,52 +1,60 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
3.0.4
|
5
|
+
----
|
6
|
+
|
7
|
+
### Changes
|
8
|
+
- Flag for overriding default branch configuration in Puppetfile
|
9
|
+
- Plumbing for internationalization
|
10
|
+
- Numerous test fixes and legacy docker work
|
11
|
+
|
4
12
|
3.0.3
|
5
13
|
----
|
6
14
|
|
7
|
-
|
15
|
+
### Changes
|
8
16
|
|
9
|
-
(RK-324) Fix Ruby pipe bug affecting Ubuntu
|
17
|
+
- (RK-324) Fix Ruby pipe bug affecting Ubuntu
|
10
18
|
|
11
19
|
3.0.2
|
12
20
|
----
|
13
21
|
|
14
|
-
|
22
|
+
### Changes
|
15
23
|
|
16
|
-
Minor test fixes.
|
24
|
+
- Minor test fixes.
|
17
25
|
|
18
26
|
3.0.1
|
19
27
|
----
|
20
28
|
|
21
|
-
|
29
|
+
### Changes
|
22
30
|
|
23
31
|
Because of dependency issues R10K 3.0.0 required Ruby >= 2.3
|
24
32
|
rather than the reported 2.0. This release makes the requirement of
|
25
33
|
Ruby >= 2.3 official and documented.
|
26
34
|
|
27
|
-
(#853) ([RK-327](https://tickets.puppetlabs.com/browse/RK-327) Uninitialized Constant Cri::Error
|
28
|
-
|
29
|
-
|
30
|
-
|
35
|
+
- (#853) ([RK-327](https://tickets.puppetlabs.com/browse/RK-327) Uninitialized Constant Cri::Error
|
36
|
+
When resolving the Cri dependency >= 2.13 R10K would fail with an
|
37
|
+
uninitialized constant error. Thanks to @ostavnaas for the bug report,
|
38
|
+
@ddfreyne for the fix, and @baurmatt for the review.
|
31
39
|
|
32
40
|
|
33
41
|
3.0.0
|
34
42
|
----
|
35
43
|
|
36
|
-
|
44
|
+
### Changes
|
37
45
|
|
38
|
-
|
46
|
+
#### Known issues
|
39
47
|
- Child processes may die unexpectedly when deploying many environments
|
40
48
|
on Ubuntu Bionic. See
|
41
49
|
[RK-324](https://tickets.puppetlabs.com/browse/RK-324).
|
42
50
|
|
43
|
-
|
51
|
+
#### Backwards breaking changes
|
44
52
|
- Drop support for Ruby < 2.0
|
45
53
|
- Remove support for PUPPETFILE and PUPPETFILE_DIR environment variables
|
46
54
|
when running the `puppetfile` action, please use flags instead.
|
47
55
|
- Fail when duplicate module definitions in Puppetfile
|
48
56
|
|
49
|
-
|
57
|
+
#### Bug fixes
|
50
58
|
- More reliable pruning of refs on fetch
|
51
59
|
- Improved error messaging when:
|
52
60
|
- Unable to connect to a proxy
|
@@ -54,24 +62,32 @@ Ruby >= 2.3 official and documented.
|
|
54
62
|
- Unable to parse Puppetfile
|
55
63
|
- Various perfomance improvements
|
56
64
|
|
65
|
+
2.6.6
|
66
|
+
----
|
67
|
+
|
68
|
+
### Changes
|
69
|
+
- Flag for overriding default branch configuration in Puppetfile
|
70
|
+
- Plumbing for internationalization
|
71
|
+
- Numerous test fixes and legacy docker work
|
57
72
|
|
58
73
|
2.6.5
|
59
74
|
----
|
60
75
|
|
61
|
-
|
76
|
+
### Bug Fix
|
62
77
|
|
63
78
|
(RK-324) Fix Ruby pipe bug affecting Ubuntu
|
64
79
|
|
65
80
|
2.6.4
|
66
81
|
----
|
67
82
|
|
68
|
-
|
83
|
+
### Changes
|
69
84
|
|
70
85
|
Numerous test fixes.
|
71
86
|
|
72
87
|
2.6.3
|
73
88
|
----
|
74
|
-
|
89
|
+
|
90
|
+
### Changes
|
75
91
|
|
76
92
|
Update specs with new error string.
|
77
93
|
|
@@ -80,6 +96,7 @@ when a release is made on that branch.
|
|
80
96
|
|
81
97
|
2.6.2
|
82
98
|
-----
|
99
|
+
|
83
100
|
### Changes
|
84
101
|
|
85
102
|
(RK-311) Yard dependency updated for security fix.
|
data/azure-pipelines.yml
CHANGED
@@ -5,9 +5,15 @@ pool:
|
|
5
5
|
name: Default
|
6
6
|
|
7
7
|
variables:
|
8
|
-
|
8
|
+
NAMESPACE: puppet
|
9
|
+
|
10
|
+
# completely disables the pipeline
|
11
|
+
trigger: none
|
12
|
+
pr: none
|
9
13
|
|
10
14
|
steps:
|
15
|
+
- checkout: self
|
16
|
+
clean: true
|
11
17
|
- powershell: |
|
12
18
|
$line = '=' * 80
|
13
19
|
Write-Host "$line`nWindows`n$line`n"
|
@@ -46,27 +52,27 @@ steps:
|
|
46
52
|
name: hostinfo
|
47
53
|
- powershell: |
|
48
54
|
. ./docker/ci/build.ps1
|
49
|
-
|
50
|
-
displayName:
|
51
|
-
name:
|
55
|
+
Lint-Dockerfile -Path ./docker/r10k/Dockerfile
|
56
|
+
displayName: Lint r10k Dockerfile
|
57
|
+
name: lint_dockerfile
|
52
58
|
- powershell: |
|
53
59
|
. ./docker/ci/build.ps1
|
54
|
-
Build-Container -
|
55
|
-
displayName: Build r10k
|
56
|
-
name:
|
60
|
+
Build-Container -Namespace $ENV:NAMESPACE
|
61
|
+
displayName: Build r10k Container
|
62
|
+
name: build_r10k_container
|
57
63
|
- powershell: |
|
58
64
|
. ./docker/ci/build.ps1
|
59
|
-
Invoke-ContainerTest -
|
65
|
+
Invoke-ContainerTest -Namespace $ENV:NAMESPACE
|
60
66
|
displayName: Test r10k
|
61
67
|
name: test_r10k
|
62
68
|
- task: PublishTestResults@2
|
63
69
|
displayName: Publish r10k test results
|
64
70
|
inputs:
|
65
71
|
testResultsFormat: 'JUnit'
|
66
|
-
testResultsFiles: 'docker
|
72
|
+
testResultsFiles: 'docker/TEST-*.xml'
|
67
73
|
testRunTitle: r10k Test Results
|
68
74
|
- powershell: |
|
69
75
|
. ./docker/ci/build.ps1
|
70
|
-
Clear-ContainerBuilds
|
76
|
+
Clear-ContainerBuilds -Name r10k
|
71
77
|
displayName: Container Cleanup
|
72
78
|
condition: always()
|
@@ -60,6 +60,18 @@ 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
|
+
|
63
75
|
### Deploying modules
|
64
76
|
|
65
77
|
Update a single module across all environments:
|
data/docker/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
TEST-rspec.xml
|
data/docker/Gemfile
CHANGED
data/docker/Makefile
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
git_describe = $(shell git describe)
|
2
|
+
vcs_ref := $(shell git rev-parse HEAD)
|
3
|
+
build_date := $(shell date -u +%FT%T)
|
4
|
+
hadolint_available := $(shell hadolint --help > /dev/null 2>&1; echo $$?)
|
5
|
+
hadolint_command := hadolint --ignore DL3008 --ignore DL3018 --ignore DL4000 --ignore DL4001
|
6
|
+
hadolint_container := hadolint/hadolint:latest
|
7
|
+
|
8
|
+
ifeq ($(IS_NIGHTLY),true)
|
9
|
+
dockerfile := Dockerfile.nightly
|
10
|
+
version := puppet6-nightly
|
11
|
+
else
|
12
|
+
version = $(shell echo $(git_describe) | sed 's/-.*//')
|
13
|
+
dockerfile := Dockerfile
|
14
|
+
endif
|
15
|
+
|
16
|
+
|
17
|
+
prep:
|
18
|
+
ifneq ($(IS_NIGHTLY),true)
|
19
|
+
@git fetch --unshallow ||:
|
20
|
+
@git fetch origin 'refs/tags/*:refs/tags/*'
|
21
|
+
endif
|
22
|
+
|
23
|
+
lint:
|
24
|
+
ifeq ($(hadolint_available),0)
|
25
|
+
@$(hadolint_command) r10k/$(dockerfile)
|
26
|
+
else
|
27
|
+
@docker pull $(hadolint_container)
|
28
|
+
@docker run --rm -v $(PWD)/r10k/$(dockerfile):/Dockerfile -i $(hadolint_container) $(hadolint_command) Dockerfile
|
29
|
+
endif
|
30
|
+
|
31
|
+
build: prep
|
32
|
+
@docker build --pull --build-arg vcs_ref=$(vcs_ref) --build-arg build_date=$(build_date) --build-arg version=$(version) --file r10k/$(dockerfile) --tag puppet/r10k:$(version) r10k
|
33
|
+
ifeq ($(IS_LATEST),true)
|
34
|
+
@docker tag puppet/r10k:$(version) puppet/r10k:latest
|
35
|
+
endif
|
36
|
+
|
37
|
+
test: prep
|
38
|
+
@bundle install --path .bundle/gems
|
39
|
+
@PUPPET_TEST_DOCKER_IMAGE=puppet/r10k:$(version) bundle exec rspec r10k/spec
|
40
|
+
|
41
|
+
publish: prep
|
42
|
+
@docker push puppet/r10k:$(version)
|
43
|
+
ifeq ($(IS_LATEST),true)
|
44
|
+
@docker push puppet/r10k:latest
|
45
|
+
endif
|
46
|
+
|
47
|
+
.PHONY: lint build test publish
|
data/docker/ci/build.ps1
CHANGED
@@ -6,33 +6,101 @@ function Get-CurrentDirectory
|
|
6
6
|
[IO.Path]::GetDirectoryName((Get-Content function:$thisName).File)
|
7
7
|
}
|
8
8
|
|
9
|
-
|
10
|
-
function Invoke-ContainerBuildSetup
|
9
|
+
function Get-ContainerVersion
|
11
10
|
{
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
# shallow repositories need to pull remaining code to `git describe` correctly
|
12
|
+
if (Test-Path "$(git rev-parse --git-dir)/shallow")
|
13
|
+
{
|
14
|
+
git pull --unshallow
|
15
|
+
}
|
16
|
+
|
17
|
+
# tags required for versioning
|
18
|
+
git fetch origin 'refs/tags/*:refs/tags/*'
|
19
|
+
(git describe) -replace '-.*', ''
|
20
|
+
}
|
21
|
+
|
22
|
+
function Lint-Dockerfile($Path)
|
23
|
+
{
|
24
|
+
hadolint --ignore DL3008 --ignore DL3018 --ignore DL4000 --ignore DL4001 $Path
|
16
25
|
}
|
17
26
|
|
18
|
-
function Build-Container(
|
27
|
+
function Build-Container(
|
28
|
+
$Namespace = 'puppet',
|
29
|
+
$Version = (Get-ContainerVersion),
|
30
|
+
$Vcs_ref = $(git rev-parse HEAD))
|
19
31
|
{
|
20
32
|
Push-Location (Join-Path (Get-CurrentDirectory) '..')
|
21
|
-
|
22
|
-
|
33
|
+
|
34
|
+
$build_date = (Get-Date).ToUniversalTime().ToString('o')
|
35
|
+
$docker_args = @(
|
36
|
+
'--pull',
|
37
|
+
'--build-arg', "vcs_ref=$Vcs_ref",
|
38
|
+
'--build-arg', "build_date=$build_date",
|
39
|
+
'--build-arg', "version=$Version",
|
40
|
+
'--file', "r10k/Dockerfile",
|
41
|
+
'--tag', "$Namespace/r10k:$Version"
|
42
|
+
)
|
43
|
+
|
44
|
+
docker build $docker_args r10k
|
45
|
+
|
23
46
|
Pop-Location
|
24
47
|
}
|
25
48
|
|
26
|
-
function Invoke-ContainerTest(
|
49
|
+
function Invoke-ContainerTest(
|
50
|
+
$Namespace = 'puppet',
|
51
|
+
$Version = (Get-ContainerVersion))
|
27
52
|
{
|
28
53
|
Push-Location (Join-Path (Get-CurrentDirectory) '..')
|
29
|
-
|
54
|
+
|
55
|
+
bundle install --path .bundle/gems
|
56
|
+
$ENV:PUPPET_TEST_DOCKER_IMAGE = "$Namespace/r10k:$Version"
|
57
|
+
bundle exec rspec r10k/spec
|
58
|
+
|
30
59
|
Pop-Location
|
31
60
|
}
|
32
61
|
|
33
|
-
# removes
|
34
|
-
|
62
|
+
# removes temporary layers / containers / images used during builds
|
63
|
+
# removes $Namespace/$Name images > 14 days old by default
|
64
|
+
function Clear-ContainerBuilds(
|
65
|
+
$Namespace = 'puppet',
|
66
|
+
$Name,
|
67
|
+
$OlderThan = [DateTime]::Now.Subtract([TimeSpan]::FromDays(14))
|
68
|
+
)
|
35
69
|
{
|
70
|
+
Write-Output 'Pruning Containers'
|
36
71
|
docker container prune --force
|
72
|
+
|
73
|
+
# this provides example data which ConvertFrom-String infers parsing structure with
|
74
|
+
$template = @'
|
75
|
+
{Version*:1.2.3} {ID:5b84704c1d01} {[DateTime]Created:2019-02-07 18:24:51} +0000 GMT
|
76
|
+
{Version*:latest} {ID:0123456789ab} {[DateTime]Created:2019-01-29 00:05:33} +0000 GMT
|
77
|
+
'@
|
78
|
+
$output = docker images --filter=reference="$Namespace/${Name}" --format "{{.Tag}} {{.ID}} {{.CreatedAt}}"
|
79
|
+
Write-Output @"
|
80
|
+
|
81
|
+
Found $Namespace/${Name} images:
|
82
|
+
$($output | Out-String)
|
83
|
+
|
84
|
+
"@
|
85
|
+
|
86
|
+
if ($output -eq $null) { return }
|
87
|
+
|
88
|
+
Write-Output "Filtering removal candidates..."
|
89
|
+
# docker image prune supports filter until= but not repository like 'puppetlabs/foo'
|
90
|
+
# must use label= style filtering which is a bit more inconvenient
|
91
|
+
# that output is also not user-friendly!
|
92
|
+
# engine doesn't maintain "last used" or "last pulled" metadata, which would be more useful
|
93
|
+
# https://github.com/moby/moby/issues/4237
|
94
|
+
$output |
|
95
|
+
ConvertFrom-String -TemplateContent $template |
|
96
|
+
? { $_.Created -lt $OlderThan } |
|
97
|
+
# ensure 'latest' are listed first
|
98
|
+
Sort-Object -Property Version -Descending |
|
99
|
+
% {
|
100
|
+
Write-Output "Removing Old $Namespace/${Name} Image $($_.Version) ($($_.ID)) Created On $($_.Created)"
|
101
|
+
docker image rm $_.ID
|
102
|
+
}
|
103
|
+
|
104
|
+
Write-Output "`nPruning Dangling Images"
|
37
105
|
docker image prune --filter "dangling=true" --force
|
38
106
|
}
|
@@ -1,24 +1,39 @@
|
|
1
|
-
require '
|
1
|
+
require 'rspec/core'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
|
-
|
4
|
+
SPEC_DIRECTORY = File.dirname(__FILE__)
|
4
5
|
|
5
|
-
describe '
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
describe 'r10k container' do
|
7
|
+
before(:all) do
|
8
|
+
@image = ENV['PUPPET_TEST_DOCKER_IMAGE']
|
9
|
+
if @image.nil?
|
10
|
+
error_message = <<-MSG
|
11
|
+
* * * * *
|
12
|
+
PUPPET_TEST_DOCKER_IMAGE environment variable must be set so we
|
13
|
+
know which image to test against!
|
14
|
+
* * * * *
|
15
|
+
MSG
|
16
|
+
fail error_message
|
10
17
|
end
|
18
|
+
@container = %x(docker run --rm --detach --entrypoint /bin/bash --interactive --volume #{File.join(SPEC_DIRECTORY, 'fixtures')}:/test #{@image}).chomp
|
19
|
+
%x(docker exec #{@container} cp test/Puppetfile /)
|
11
20
|
end
|
12
21
|
|
13
|
-
|
14
|
-
|
22
|
+
after(:all) do
|
23
|
+
%x(docker container kill #{@container})
|
24
|
+
FileUtils.rm_rf(File.join(SPEC_DIRECTORY, 'fixtures', 'modules'))
|
15
25
|
end
|
16
26
|
|
17
|
-
|
18
|
-
|
27
|
+
it 'should validate the Puppetfile' do
|
28
|
+
%x(docker exec #{@container} r10k puppetfile check)
|
29
|
+
status = $?
|
30
|
+
expect(status).to eq(0)
|
19
31
|
end
|
20
32
|
|
21
|
-
|
22
|
-
|
33
|
+
it 'should install the Puppetfile' do
|
34
|
+
%x(docker exec #{@container} r10k puppetfile install)
|
35
|
+
status = $?
|
36
|
+
expect(status).to eq(0)
|
37
|
+
expect(Dir.exist?(File.join(SPEC_DIRECTORY, 'fixtures', 'modules', 'ntp'))).to eq(true)
|
23
38
|
end
|
24
39
|
end
|