Skip to content

Commit 5f93382

Browse files
Updating to latest PDK version
1 parent bc7bc0e commit 5f93382

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+575
-456
lines changed

.devcontainer/README.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# devcontainer
2+
3+
4+
For format details, see https://aka.ms/devcontainer.json.
5+
6+
For config options, see the README at:
7+
https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet
8+
9+
``` json
10+
{
11+
"name": "Puppet Development Kit (Community)",
12+
"dockerFile": "Dockerfile",
13+
14+
// Set *default* container specific settings.json values on container create.
15+
"settings": {
16+
"terminal.integrated.profiles.linux": {
17+
"bash": {
18+
"path": "bash",
19+
}
20+
}
21+
},
22+
23+
// Add the IDs of extensions you want installed when the container is created.
24+
"extensions": [
25+
"puppet.puppet-vscode",
26+
"rebornix.Ruby"
27+
],
28+
29+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
30+
"forwardPorts": [],
31+
32+
// Use 'postCreateCommand' to run commands after the container is created.
33+
"postCreateCommand": "pdk --version",
34+
}
35+
```
36+
37+
38+

.devcontainer/devcontainer.json

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2-
// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet
31
{
42
"name": "Puppet Development Kit (Community)",
53
"dockerFile": "Dockerfile",
64

7-
// Set *default* container specific settings.json values on container create.
85
"settings": {
9-
"terminal.integrated.shell.linux": "/bin/bash"
6+
"terminal.integrated.profiles.linux": {
7+
"bash": {
8+
"path": "bash"
9+
}
10+
}
1011
},
1112

12-
// Add the IDs of extensions you want installed when the container is created.
1313
"extensions": [
1414
"puppet.puppet-vscode",
1515
"rebornix.Ruby"
1616
]
17-
18-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
19-
// "forwardPorts": [],
20-
21-
// Use 'postCreateCommand' to run commands after the container is created.
22-
// "postCreateCommand": "pdk --version",
2317
}

.github/workflows/auto_release.yml

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "Auto release"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
8+
HONEYCOMB_DATASET: litmus tests
9+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10+
11+
jobs:
12+
auto_release:
13+
name: "Automatic release prep"
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
18+
- name: "Honeycomb: Start recording"
19+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
20+
with:
21+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
22+
dataset: ${{ env.HONEYCOMB_DATASET }}
23+
job-status: ${{ job.status }}
24+
25+
- name: "Honeycomb: start first step"
26+
run: |
27+
echo STEP_ID="auto-release" >> $GITHUB_ENV
28+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
29+
- name: "Checkout Source"
30+
if: ${{ github.repository_owner == 'puppetlabs' }}
31+
uses: actions/checkout@v2
32+
with:
33+
fetch-depth: 0
34+
persist-credentials: false
35+
36+
- name: "PDK Release prep"
37+
uses: docker://puppet/iac_release:ci
38+
with:
39+
args: 'release prep --force'
40+
env:
41+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: "Get Version"
44+
if: ${{ github.repository_owner == 'puppetlabs' }}
45+
id: gv
46+
run: |
47+
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
48+
49+
- name: "Check if a release is necessary"
50+
if: ${{ github.repository_owner == 'puppetlabs' }}
51+
id: check
52+
run: |
53+
git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true"
54+
55+
- name: "Commit changes"
56+
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
57+
run: |
58+
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
59+
git config --local user.name "GitHub Action"
60+
git add .
61+
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
62+
63+
- name: Create Pull Request
64+
id: cpr
65+
uses: puppetlabs/peter-evans-create-pull-request@v3
66+
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
67+
with:
68+
token: ${{ secrets.GITHUB_TOKEN }}
69+
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
70+
branch: "release-prep"
71+
delete-branch: true
72+
title: "Release prep v${{ steps.gv.outputs.ver }}"
73+
body: |
74+
Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb) from commit ${{ github.sha }}.
75+
Please verify before merging:
76+
- [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
77+
- [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
78+
- [ ] Ensure the [changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) version and [metadata](https://github.com/${{ github.repository }}/blob/release-prep/metadata.json) version match
79+
labels: "maintenance"
80+
81+
- name: PR outputs
82+
if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }}
83+
run: |
84+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
85+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
86+
87+
- name: "Honeycomb: Record finish step"
88+
if: ${{ always() }}
89+
run: |
90+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,3 @@
3232
.plan_cache.json
3333
.resource_types/
3434
bolt-debug.log
35-
spec/docker/**/*.tar.gz
36-
spec/docker/**/*.asc
37-
spec/docker/**/files/puppet-enterprise*
38-
spec/docker/.task_cache.json

.puppet-lint.rc

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
--relative
2+
--no-strict_indent-check

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require:
44
- rubocop-rspec
55
AllCops:
66
DisplayCopNames: true
7-
TargetRubyVersion: '2.4'
7+
TargetRubyVersion: '2.5'
88
Include:
99
- "**/*.rb"
1010
Exclude:

.sync.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Gemfile:
33
required:
44
':development':
5-
- gem: 'puppet-debugger'
6-
version: '>= 0.18.0'
75
- gem: 'bolt'
86
version: '>= 3.10.0'
97
optional:
@@ -13,6 +11,7 @@ Gemfile:
1311
version: '4.21.0' # Locked due to https://github.com/octokit/octokit.rb/issues/1391
1412
Rakefile:
1513
changelog_since_tag: '2.5.0'
14+
default_disabled_lint_checks: ['strict_indent']
1615
extras:
1716
- 'PuppetSyntax.exclude_paths = ["plans/**/*.pp", "spec/acceptance/**/plans/**/*.pp", "vendor/**/*"]'
1817
spec/spec_helper.rb:

Gemfile

+25-16
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,34 @@ def location_for(place_or_version, fake_version = nil)
1313
end
1414
end
1515

16-
ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
17-
minor_version = ruby_version_segments[0..1].join('.')
18-
1916
group :development do
20-
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
21-
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
22-
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
23-
gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
24-
gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
25-
gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
26-
gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
27-
gem "puppet-debugger", '>= 0.18.0', require: false
28-
gem "bolt", '>= 3.17.0', require: false
29-
gem "github_changelog_generator", '>= 1.16.4', require: false
30-
gem "octokit", '4.21.0', require: false
17+
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
18+
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
19+
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
20+
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
21+
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
22+
gem "voxpupuli-puppet-lint-plugins", '~> 3.1', require: false
23+
gem "facterdb", '~> 1.18', require: false
24+
gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false
25+
gem "puppetlabs_spec_helper", '>= 3.0.0', '< 5.0.0', require: false
26+
gem "rspec-puppet-facts", '~> 2.0', require: false
27+
gem "codecov", '~> 0.2', require: false
28+
gem "dependency_checker", '~> 0.2', require: false
29+
gem "parallel_tests", '~> 3.4', require: false
30+
gem "pry", '~> 0.10', require: false
31+
gem "simplecov-console", '~> 0.5', require: false
32+
gem "puppet-debugger", '~> 1.0', require: false
33+
gem "rubocop", '= 1.6.1', require: false
34+
gem "rubocop-performance", '= 1.9.1', require: false
35+
gem "rubocop-rspec", '= 2.0.1', require: false
36+
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
37+
gem "bolt", '>= 3.10.0', require: false
38+
gem "github_changelog_generator", require: false
39+
gem "octokit", '4.21.0', require: false
3140
end
3241
group :system_tests do
33-
gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby]
34-
gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw]
42+
gem "puppet_litmus", '< 1.0.0', require: false, platforms: [:ruby]
43+
gem "serverspec", '~> 2.41', require: false
3544
end
3645

3746
puppet_version = ENV['PUPPET_GEM_VERSION']

Rakefile

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def changelog_future_release
4242
end
4343

4444
PuppetLint.configuration.send('disable_relative')
45+
PuppetLint.configuration.send('disable_strict_indent')
4546

4647

4748
if Bundler.rubygems.find_name('github_changelog_generator').any?

examples/haproxy/compiler.pp

+6-8
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,20 @@
22
#
33
# lint:ignore:autoloader_layout
44
class examples::compiler {
5-
6-
@@haproxy::balancermember { "${::clientcert}_puppetserver_listener":
5+
@@haproxy::balancermember { "${facts['clientcert']}_puppetserver_listener":
76
listening_service => 'puppetserver',
8-
server_names => $::fqdn,
9-
ipaddresses => $::ipaddress,
7+
server_names => $facts['networking']['fqdn'],
8+
ipaddresses => $facts['networking']['ip'],
109
ports => '8140',
1110
options => 'check',
1211
}
1312

14-
@@haproxy::balancermember { "${::clientcert}_pcp-broker_listener":
13+
@@haproxy::balancermember { "${facts['clientcert']}_pcp-broker_listener":
1514
listening_service => 'pcp-broker',
16-
server_names => $::fqdn,
17-
ipaddresses => $::ipaddress,
15+
server_names => $facts['networking']['fqdn'],
16+
ipaddresses => $facts['networking']['ip'],
1817
ports => '8142',
1918
options => 'check',
2019
}
21-
2220
}
2321
# lint:endignore

examples/haproxy/load_balancer.pp

+6-8
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
#
66
# lint:ignore:autoloader_layout
77
class examples::load_balancer {
8-
98
class { 'haproxy':
109
global_options => {
11-
'log' => "${::ipaddress} local2",
10+
'log' => "${facts['facts[\'networking\'][\'ip\']']} local2",
1211
'chroot' => '/var/lib/haproxy',
1312
'pidfile' => '/var/run/haproxy.pid',
1413
'maxconn' => 5000,
@@ -24,14 +23,14 @@
2423
'client 2m',
2524
'server 2m',
2625
'http-request 120s',
27-
]
28-
}
26+
],
27+
},
2928
}
3029

3130
haproxy::listen { 'puppetserver':
3231
collect_exported => true,
3332
mode => 'tcp',
34-
ipaddress => $::ipaddress,
33+
ipaddress => $facts['networking']['ip'],
3534
ports => '8140',
3635
options => {
3736
option => ['tcplog'],
@@ -42,7 +41,7 @@
4241
haproxy::listen { 'pcp-broker':
4342
collect_exported => true,
4443
mode => 'tcp',
45-
ipaddress => $::ipaddress,
44+
ipaddress => $facts['networking']['ip'],
4645
ports => '8142',
4746
options => {
4847
option => ['tcplog'],
@@ -57,10 +56,9 @@
5756
# TODO: split load balancing into two pools, A and B
5857
haproxy::listen { 'puppetdb':
5958
collect_exported => true,
60-
ipaddress => $::ipaddress,
59+
ipaddress => $facts['networking']['ip'],
6160
ports => '8081',
6261
options => {},
6362
}
64-
6563
}
6664
# lint:endignore

examples/haproxy/puppetdb.pp

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
#
33
# lint:ignore:autoloader_layout
44
class examples::puppetdb {
5-
65
# TODO: split load balancing into two pools, A and B
7-
@@haproxy::balancermember { "${::clientcert}_puppetdb_listener":
6+
@@haproxy::balancermember { "${facts['clientcert']}_puppetdb_listener":
87
listening_service => 'puppetdb',
9-
server_names => $::fqdn,
10-
ipaddresses => $::ipaddress,
8+
server_names => $facts['networking']['fqdn'],
9+
ipaddresses => $facts['networking']['ip'],
1110
ports => '8081',
1211
options => 'check',
1312
}
14-
1513
}
1614
# lint:endignore

0 commit comments

Comments
 (0)