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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86a62176969a42b8de330d9f940f8a70b2ddde34
4
- data.tar.gz: 630a698650dd7633ea5af47c01d2da9e3b4bbce9
3
+ metadata.gz: 8cc458f9c6f5fc825c4a915db8ba1f4c62d9f9e3
4
+ data.tar.gz: f1bcb084a79e0fc0bcf17352a98b2cd162fc1fa5
5
5
  SHA512:
6
- metadata.gz: 88539ba2554f8a4cd81e768598aa242907d59ac1a1cfffcf5a192f9e4b8e2458beece89673615be5336f3d02478cf0ebd2d55d2f372f4bfe864a070cf598f20c
7
- data.tar.gz: cac1fc4ca0ac0b9c8b9ec6aabcb8a1d3596ddfad2e551649895144bcf9458469850641ed9e42a441138c429ba0072482365d8fde2d425b349f136d0af003db38
6
+ metadata.gz: aa362d85081c4378839c4027f9feffd8411606d55c88f4101c6fe334eb872b0a470bac76a90ec070532f802310588fd3ff66a63b7164f3e986fd7af0ba1dddc7
7
+ data.tar.gz: 77b14cd6661fcf9c70d73aec1ad11faccf65ac30479872b08e86055436b0f64fb40ec764e5b5d9174d0ea036ac9430052555057de769d475cee6d07b1f6596f9
data/.gitignore CHANGED
@@ -4,7 +4,6 @@ Gemfile.lock
4
4
  .bundle
5
5
  bundle
6
6
  coverage
7
- locales/r10k.pot
8
7
  integration/log
9
8
  integration/junit
10
9
  integration/configs
@@ -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
@@ -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
- ## Bug Fixes
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
- ## Changes
22
+ ### Changes
15
23
 
16
- Minor test fixes.
24
+ - Minor test fixes.
17
25
 
18
26
  3.0.1
19
27
  ----
20
28
 
21
- ## Changes
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
- When resolving the Cri dependency >= 2.13 R10K would fail with an
29
- uninitialized constant error. Thanks to @ostavnaas for the bug report,
30
- @ddfreyne for the fix, and @baurmatt for the review.
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
- ## Changes
44
+ ### Changes
37
45
 
38
- ### Known issues
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
- ### Backwards breaking changes
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
- ### Bug fixes
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
- ## Bug Fix
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
- ## Changes
83
+ ### Changes
69
84
 
70
85
  Numerous test fixes.
71
86
 
72
87
  2.6.3
73
88
  ----
74
- ## Changes
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.
@@ -5,9 +5,15 @@ pool:
5
5
  name: Default
6
6
 
7
7
  variables:
8
- BUILD_REPOSITORY: 127.0.0.1
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
- Invoke-ContainerBuildSetup
50
- displayName: Prepare Build Environment
51
- name: build_prepare
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 -Name r10k -Repository $ENV:BUILD_REPOSITORY
55
- displayName: Build r10k
56
- name: build_r10k
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 -Name r10k -Repository $ENV:BUILD_REPOSITORY
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/**/TEST-*.xml'
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:
@@ -0,0 +1 @@
1
+ TEST-rspec.xml
@@ -10,5 +10,5 @@ def location_for(place, fake_version = nil)
10
10
  end
11
11
  end
12
12
 
13
- gem 'puppet_docker_tools', *location_for(ENV['PUPPET_DOCKER_LOCATION'] || '~> 0.2')
13
+ gem 'rspec'
14
14
  gem 'rspec_junit_formatter'
@@ -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
@@ -6,33 +6,101 @@ function Get-CurrentDirectory
6
6
  [IO.Path]::GetDirectoryName((Get-Content function:$thisName).File)
7
7
  }
8
8
 
9
- # installs gems for build and test and grabs base images
10
- function Invoke-ContainerBuildSetup
9
+ function Get-ContainerVersion
11
10
  {
12
- Push-Location (Get-CurrentDirectory)
13
- bundle install --path '.bundle/gems'
14
- bundle exec puppet-docker update-base-images ubuntu:16.04
15
- Pop-Location
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($Name, $Repository = '127.0.0.1')
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
- bundle exec puppet-docker local-lint $Name
22
- bundle exec puppet-docker build $Name --no-cache --repository $Repository --build-arg namespace=$Repository
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($Name, $Repository = '127.0.0.1')
49
+ function Invoke-ContainerTest(
50
+ $Namespace = 'puppet',
51
+ $Version = (Get-ContainerVersion))
27
52
  {
28
53
  Push-Location (Join-Path (Get-CurrentDirectory) '..')
29
- bundle exec puppet-docker spec $Name --image $Repository/$Name
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 any temporary containers / images used during builds
34
- function Clear-ContainerBuilds
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,4 +1,9 @@
1
1
  pe-and-platform/r10k:
2
+ PreBuild:
3
+ - make lint
2
4
  Build:
5
+ - make build
6
+ - make test
7
+ AfterBuildSuccess:
3
8
  - docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" "$DISTELLI_DOCKER_ENDPOINT"
4
- - /bin/bash -x ./ci/build
9
+ - make publish
@@ -1,24 +1,39 @@
1
- require 'puppet_docker_tools/spec_helper'
1
+ require 'rspec/core'
2
+ require 'fileutils'
2
3
 
3
- CURRENT_DIRECTORY = File.dirname(File.dirname(__FILE__))
4
+ SPEC_DIRECTORY = File.dirname(__FILE__)
4
5
 
5
- describe 'Dockerfile' do
6
- include_context 'with a docker image'
7
- include_context 'with a docker container' do
8
- def docker_run_options
9
- '--entrypoint /bin/bash'
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
- describe 'uses the correct version of Ubuntu' do
14
- it_should_behave_like 'a running container', 'cat /etc/lsb-release', nil, 'Ubuntu 16.04'
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
- describe 'has puppet-agent installed' do
18
- it_should_behave_like 'a running container', 'dpkg -l puppet-agent', 0
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
- describe 'has /opt/puppetlabs/puppet/bin/r10k' do
22
- it_should_behave_like 'a running container', 'stat -L /opt/puppetlabs/puppet/bin/r10k', 0, 'Access: \(0755\/\-rwxr\-xr\-x\)'
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