Skip to content

Commit 1ade58e

Browse files
authored
Merge pull request #20 from Tradeshift/update_to_v7
Update to v7
2 parents ad8f74a + 6839339 commit 1ade58e

File tree

164 files changed

+5359
-2536
lines changed

Some content is hidden

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

164 files changed

+5359
-2536
lines changed

.devcontainer/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM puppet/pdk:latest
2+
3+
# [Optional] Uncomment this section to install additional packages.
4+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5+
# && apt-get -y install --no-install-recommends <your-package-list-here>
6+

.devcontainer/devcontainer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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
3+
{
4+
"name": "Puppet Development Kit (Community)",
5+
"dockerFile": "Dockerfile",
6+
7+
// Set *default* container specific settings.json values on container create.
8+
"settings": {
9+
"terminal.integrated.shell.linux": "/bin/bash"
10+
},
11+
12+
// Add the IDs of extensions you want installed when the container is created.
13+
"extensions": [
14+
"puppet.puppet-vscode",
15+
"rebornix.Ruby"
16+
]
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",
23+
}

.fixtures.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
fixtures:
22
repositories:
33
apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
4-
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
5-
firewall: "https://github.com/puppetlabs/puppetlabs-firewall.git"
4+
augeas_core:
5+
repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git"
6+
puppet_version: ">= 6.0.0"
67
concat: "https://github.com/puppetlabs/puppetlabs-concat.git"
8+
facts: 'https://github.com/puppetlabs/puppetlabs-facts.git'
9+
firewall: "https://github.com/puppetlabs/puppetlabs-firewall.git"
10+
provision: "https://github.com/puppetlabs/provision.git"
11+
puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
12+
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
713
yumrepo_core:
814
repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git"
915
puppet_version: ">= 6.0.0"
10-
augeas_core:
11-
repo: "https://github.com/puppetlabs/puppetlabs-augeas_core.git"
12-
puppet_version: ">= 6.0.0"
1316
symlinks:
1417
postgresql: "#{source_dir}"

.github/workflows/auto_release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: "Auto release"
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 6'
6+
workflow_dispatch:
7+
8+
env:
9+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
10+
HONEYCOMB_DATASET: litmus tests
11+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
13+
jobs:
14+
auto_release:
15+
name: "Automatic release prep"
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
- name: "Honeycomb: Start recording"
20+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
21+
with:
22+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
23+
dataset: ${{ env.HONEYCOMB_DATASET }}
24+
job-status: ${{ job.status }}
25+
26+
- name: "Honeycomb: start first step"
27+
run: |
28+
echo STEP_ID="auto-release" >> $GITHUB_ENV
29+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
30+
31+
- name: "Checkout Source"
32+
if: ${{ github.repository_owner == 'puppetlabs' }}
33+
uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 0
36+
persist-credentials: false
37+
38+
- name: "PDK Release prep"
39+
uses: docker://puppet/pdk:nightly
40+
with:
41+
args: 'release prep --force'
42+
env:
43+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: "Get Version"
46+
if: ${{ github.repository_owner == 'puppetlabs' }}
47+
id: gv
48+
run: |
49+
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
50+
51+
- name: "Commit changes"
52+
if: ${{ github.repository_owner == 'puppetlabs' }}
53+
run: |
54+
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
55+
git config --local user.name "GitHub Action"
56+
git add .
57+
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
58+
59+
- name: Create Pull Request
60+
id: cpr
61+
uses: puppetlabs/peter-evans-create-pull-request@v3
62+
if: ${{ github.repository_owner == 'puppetlabs' }}
63+
with:
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
66+
branch: "release-prep"
67+
delete-branch: true
68+
title: "Release prep v${{ steps.gv.outputs.ver }}"
69+
body: "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 }}"
70+
labels: "maintenance"
71+
72+
- name: PR outputs
73+
if: ${{ github.repository_owner == 'puppetlabs' }}
74+
run: |
75+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
76+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
77+
78+
- name: "Honeycomb: Record finish step"
79+
if: ${{ always() }}
80+
run: |
81+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'

.github/workflows/nightly.yml

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
name: "nightly"
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
7+
env:
8+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
9+
HONEYCOMB_DATASET: litmus tests
10+
11+
jobs:
12+
setup_matrix:
13+
name: "Setup Test Matrix"
14+
runs-on: ubuntu-20.04
15+
outputs:
16+
matrix: ${{ steps.get-matrix.outputs.matrix }}
17+
18+
steps:
19+
- name: "Honeycomb: Start recording"
20+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
21+
with:
22+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
23+
dataset: ${{ env.HONEYCOMB_DATASET }}
24+
job-status: ${{ job.status }}
25+
26+
- name: "Honeycomb: Start first step"
27+
run: |
28+
echo STEP_ID=setup-environment >> $GITHUB_ENV
29+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
30+
31+
- name: Checkout Source
32+
uses: actions/checkout@v2
33+
if: ${{ github.repository_owner == 'puppetlabs' }}
34+
35+
- name: Activate Ruby 2.7
36+
uses: ruby/setup-ruby@v1
37+
if: ${{ github.repository_owner == 'puppetlabs' }}
38+
with:
39+
ruby-version: "2.7"
40+
bundler-cache: true
41+
42+
- name: Print bundle environment
43+
if: ${{ github.repository_owner == 'puppetlabs' }}
44+
run: |
45+
echo ::group::bundler environment
46+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
47+
echo ::endgroup::
48+
49+
- name: "Honeycomb: Record Setup Environment time"
50+
if: ${{ github.repository_owner == 'puppetlabs' }}
51+
run: |
52+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
53+
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
54+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
55+
56+
- name: Setup Acceptance Test Matrix
57+
id: get-matrix
58+
if: ${{ github.repository_owner == 'puppetlabs' }}
59+
run: |
60+
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
61+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
62+
else
63+
echo "::set-output name=matrix::{}"
64+
fi
65+
66+
- name: "Honeycomb: Record Setup Test Matrix time"
67+
if: ${{ always() }}
68+
run: |
69+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
70+
71+
Acceptance:
72+
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
73+
needs:
74+
- setup_matrix
75+
76+
runs-on: ubuntu-20.04
77+
strategy:
78+
fail-fast: false
79+
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
80+
81+
env:
82+
BUILDEVENT_FILE: '../buildevents.txt'
83+
84+
steps:
85+
- run: |
86+
echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE
87+
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
88+
echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
89+
90+
91+
- name: "Honeycomb: Start recording"
92+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
93+
with:
94+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
95+
dataset: ${{ env.HONEYCOMB_DATASET }}
96+
job-status: ${{ job.status }}
97+
matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }}
98+
99+
- name: "Honeycomb: start first step"
100+
run: |
101+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
102+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
103+
104+
- name: Checkout Source
105+
uses: actions/checkout@v2
106+
107+
- name: Activate Ruby 2.7
108+
uses: ruby/setup-ruby@v1
109+
with:
110+
ruby-version: "2.7"
111+
bundler-cache: true
112+
113+
- name: Print bundle environment
114+
run: |
115+
echo ::group::bundler environment
116+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
117+
echo ::endgroup::
118+
119+
- name: "Honeycomb: Record Setup Environment time"
120+
if: ${{ always() }}
121+
run: |
122+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
123+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
124+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
125+
126+
- name: Provision test environment
127+
run: |
128+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
129+
echo ::group::=== REQUEST ===
130+
cat request.json || true
131+
echo
132+
echo ::endgroup::
133+
echo ::group::=== INVENTORY ===
134+
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
135+
echo ::endgroup::
136+
137+
- name: Install agent
138+
run: |
139+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
140+
141+
- name: Install module
142+
run: |
143+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
144+
145+
- name: "Honeycomb: Record deployment times"
146+
if: ${{ always() }}
147+
run: |
148+
echo ::group::honeycomb step
149+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
150+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
151+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
152+
echo ::endgroup::
153+
154+
- name: Run acceptance tests
155+
run: |
156+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
157+
158+
- name: "Honeycomb: Record acceptance testing times"
159+
if: ${{ always() }}
160+
run: |
161+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
162+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
163+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
164+
165+
- name: Remove test environment
166+
if: ${{ always() }}
167+
continue-on-error: true
168+
run: |
169+
if [ -f inventory.yaml ]; then
170+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
171+
echo ::group::=== REQUEST ===
172+
cat request.json || true
173+
echo
174+
echo ::endgroup::
175+
fi
176+
177+
- name: "Honeycomb: Record removal times"
178+
if: ${{ always() }}
179+
run: |
180+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'
181+
182+
slack-workflow-status:
183+
if: always()
184+
name: Post Workflow Status To Slack
185+
needs:
186+
- Acceptance
187+
runs-on: ubuntu-20.04
188+
steps:
189+
- name: Slack Workflow Notification
190+
uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1
191+
with:
192+
# Required Input
193+
repo_token: ${{ secrets.GITHUB_TOKEN }}
194+
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
195+
# Optional Input
196+
channel: '#team-ia-bots'
197+
name: 'GABot'

0 commit comments

Comments
 (0)