Skip to content

Commit 596309a

Browse files
authored
Merge pull request #173 from puppetlabs/release_3_0_0
update pdk template
2 parents 7420657 + 93131c4 commit 596309a

File tree

9 files changed

+176
-13
lines changed

9 files changed

+176
-13
lines changed

.github/workflows/auto_release.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
- name: "Honeycomb: Start recording"
18+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
19+
with:
20+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
21+
dataset: ${{ env.HONEYCOMB_DATASET }}
22+
job-status: ${{ job.status }}
23+
24+
- name: "Honeycomb: start first step"
25+
run: |
26+
echo STEP_ID="auto-release" >> $GITHUB_ENV
27+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
28+
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: "Commit changes"
50+
if: ${{ github.repository_owner == 'puppetlabs' }}
51+
run: |
52+
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
53+
git config --local user.name "GitHub Action"
54+
git add .
55+
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
56+
57+
- name: Create Pull Request
58+
id: cpr
59+
uses: puppetlabs/peter-evans-create-pull-request@v3
60+
if: ${{ github.repository_owner == 'puppetlabs' }}
61+
with:
62+
token: ${{ secrets.GITHUB_TOKEN }}
63+
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
64+
branch: "release-prep"
65+
delete-branch: true
66+
title: "Release prep v${{ steps.gv.outputs.ver }}"
67+
body: |
68+
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 }}.
69+
Please verify before merging:
70+
- [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
71+
- [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
72+
- [ ] 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
73+
labels: "maintenance"
74+
75+
- name: PR outputs
76+
if: ${{ github.repository_owner == 'puppetlabs' }}
77+
run: |
78+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
79+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
80+
81+
- name: "Honeycomb: Record finish step"
82+
if: ${{ always() }}
83+
run: |
84+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Publish module"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
create-github-release:
8+
name: Deploy GitHub Release
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
with:
14+
ref: ${{ github.ref }}
15+
clean: true
16+
fetch-depth: 0
17+
- name: Get Version
18+
id: gv
19+
run: |
20+
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
21+
- name: Create Release
22+
uses: actions/create-release@v1
23+
id: create_release
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
tag_name: "v${{ steps.gv.outputs.ver }}"
28+
draft: false
29+
prerelease: false
30+
31+
deploy-forge:
32+
name: Deploy to Forge
33+
runs-on: ubuntu-20.04
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v2
37+
with:
38+
ref: ${{ github.ref }}
39+
clean: true
40+
- name: "PDK Build"
41+
uses: docker://puppet/pdk:nightly
42+
with:
43+
args: 'build'
44+
- name: "Push to Forge"
45+
uses: docker://puppet/pdk:nightly
46+
with:
47+
args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force'

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@
2525
.project
2626
.envrc
2727
/inventory.yaml
28+
/spec/fixtures/litmus_inventory.yaml
2829
.rerun.json
2930
*.tar.gz
3031
.modules/
3132
.plan_cache.json
3233
.resource_types/
3334
bolt-debug.log
35+
!spec/fixtures/modules
36+
spec/fixtures/modules/*
37+
!spec/fixtures/modules/peadm_spec

.gitlab-ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,19 @@ parallel_spec-Ruby 2.5.7-Puppet ~> 6:
3535
variables:
3636
PUPPET_GEM_VERSION: '~> 6'
3737

38+
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.7.2-Puppet ~> 7:
39+
stage: syntax
40+
image: ruby:2.7.2
41+
script:
42+
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
43+
variables:
44+
PUPPET_GEM_VERSION: '~> 7'
45+
46+
parallel_spec-Ruby 2.7.2-Puppet ~> 7:
47+
stage: unit
48+
image: ruby:2.7.2
49+
script:
50+
- bundle exec rake parallel_spec
51+
variables:
52+
PUPPET_GEM_VERSION: '~> 7'
53+

.pdkignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
.project
2626
.envrc
2727
/inventory.yaml
28+
/spec/fixtures/litmus_inventory.yaml
2829
/appveyor.yml
30+
/.editorconfig
2931
/.fixtures.yml
3032
/Gemfile
3133
/.gitattributes
@@ -42,3 +44,4 @@
4244
/spec/
4345
/.vscode/
4446
/.sync.yml
47+
/.devcontainer/

.sync.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gemfile:
55
- gem: 'puppet-debugger'
66
version: '>= 0.18.0'
77
- gem: 'bolt'
8-
version: '>= 2.42.0'
8+
version: '>= 3.10.0'
99
optional:
1010
':development':
1111
- gem: 'github_changelog_generator'
@@ -26,3 +26,10 @@ spec/spec_helper.rb:
2626
- '.plan_cache.json'
2727
- '.resource_types/'
2828
- 'bolt-debug.log'
29+
- '!spec/fixtures/modules' # Have to reset this one to correctly not ignore peadm_spec
30+
- 'spec/fixtures/modules/*'
31+
- '!spec/fixtures/modules/peadm_spec'
32+
.github/workflows/auto_release.yml:
33+
unmanaged: false
34+
.github/workflows/release.yml:
35+
unmanaged: false

Gemfile

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ gems['puppet'] = location_for(puppet_version)
4747
gems['facter'] = location_for(facter_version) if facter_version
4848
gems['hiera'] = location_for(hiera_version) if hiera_version
4949

50-
if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
51-
# If we're using a Puppet gem on Windows which handles its own win32-xxx gem
52-
# dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
53-
gems['win32-dir'] = ['<= 0.4.9', require: false]
54-
gems['win32-eventlog'] = ['<= 0.6.5', require: false]
55-
gems['win32-process'] = ['<= 0.7.5', require: false]
56-
gems['win32-security'] = ['<= 0.2.5', require: false]
57-
gems['win32-service'] = ['0.8.8', require: false]
58-
end
59-
6050
gems.each do |gem_name, gem_params|
6151
gem gem_name, *gem_params
6252
end

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@
6363
}
6464
],
6565
"pdk-version": "2.1.0",
66-
"template-url": "https://github.com/puppetlabs/pdk-templates.git#2.0.0",
67-
"template-ref": "tags/2.0.0-0-ge838f1d"
66+
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
67+
"template-ref": "tags/2.1.1-0-g03daa92"
6868
}

spec/spec_helper.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@
4747
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
4848
c.after(:suite) do
4949
end
50+
51+
# Filter backtrace noise
52+
backtrace_exclusion_patterns = [
53+
%r{spec_helper},
54+
%r{gems},
55+
]
56+
57+
if c.respond_to?(:backtrace_exclusion_patterns)
58+
c.backtrace_exclusion_patterns = backtrace_exclusion_patterns
59+
elsif c.respond_to?(:backtrace_clean_patterns)
60+
c.backtrace_clean_patterns = backtrace_exclusion_patterns
61+
end
5062
end
5163

5264
# Ensures that a module is defined

0 commit comments

Comments
 (0)