Skip to content

Commit 58e1235

Browse files
authored
Merge pull request #364 from carabasdaniel/pdkupdate
PDK Update for GA workflows
2 parents ab36e5c + 6be489f commit 58e1235

File tree

4 files changed

+236
-60
lines changed

4 files changed

+236
-60
lines changed

.github/workflows/nightly.yml

Lines changed: 115 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: "nightly"
33
on:
44
schedule:
55
- cron: '0 0 * * *'
6-
workflow_dispatch:
76

87
env:
98
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
@@ -16,35 +15,63 @@ jobs:
1615
runs-on: ubuntu-20.04
1716
outputs:
1817
matrix: ${{ steps.get-matrix.outputs.matrix }}
18+
1919
steps:
20+
- name: "Honeycomb: Start recording"
21+
uses: kvrhdn/gha-buildevents@v1.0.2
22+
with:
23+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
24+
dataset: ${{ env.HONEYCOMB_DATASET }}
25+
job-status: ${{ job.status }}
26+
27+
- name: "Honeycomb: Start first step"
28+
run: |
29+
echo STEP_ID=0 >> $GITHUB_ENV
30+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
31+
2032
- name: Checkout Source
2133
uses: actions/checkout@v2
34+
if: ${{ github.repository_owner == 'puppetlabs' }}
2235

2336
- name: Activate Ruby 2.7
2437
uses: actions/setup-ruby@v1
38+
if: ${{ github.repository_owner == 'puppetlabs' }}
2539
with:
2640
ruby-version: "2.7"
2741

2842
- name: Cache gems
2943
uses: actions/cache@v2
44+
if: ${{ github.repository_owner == 'puppetlabs' }}
3045
with:
3146
path: vendor/gems
32-
key: ${{ runner.os }}-nightly-${{ hashFiles('**/Gemfile') }}
47+
key: ${{ runner.os }}-${{ github.event_name }}-${{ hashFiles('**/Gemfile') }}
3348
restore-keys: |
34-
${{ runner.os }}-nightly-
49+
${{ runner.os }}-${{ github.event_name }}-
3550
${{ runner.os }}-
3651
3752
- name: Install gems
53+
if: ${{ github.repository_owner == 'puppetlabs' }}
3854
run: |
39-
bundle config path vendor/gems
40-
bundle config jobs 8
41-
bundle config retry 3
42-
bundle install
43-
bundle clean
55+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config path vendor/gems' -- bundle config path vendor/gems
56+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config jobs 8' -- bundle config jobs 8
57+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config retry 3' -- bundle config retry 3
58+
buildevents cmd $TRACE_ID $STEP_ID 'bundle install' -- bundle install
59+
buildevents cmd $TRACE_ID $STEP_ID 'bundle clean' -- bundle clean
4460
4561
- name: Setup Acceptance Test Matrix
4662
id: get-matrix
47-
run: "bundle exec matrix_from_metadata"
63+
if: ${{ github.repository_owner == 'puppetlabs' }}
64+
run: |
65+
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
66+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata
67+
else
68+
echo "::set-output name=matrix::{}"
69+
fi
70+
71+
- name: "Honeycomb: Record setup time"
72+
if: ${{ always() }}
73+
run: |
74+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
4875
4976
Acceptance:
5077
needs:
@@ -55,7 +82,27 @@ jobs:
5582
fail-fast: false
5683
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
5784

85+
env:
86+
BUILDEVENT_FILE: '../buildevents.txt'
87+
5888
steps:
89+
- run: |
90+
echo 'platform=${{ matrix.platform }}' >> $BUILDEVENT_FILE
91+
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
92+
93+
- name: "Honeycomb: Start recording"
94+
uses: kvrhdn/gha-buildevents@v1.0.2
95+
with:
96+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
97+
dataset: ${{ env.HONEYCOMB_DATASET }}
98+
job-status: ${{ job.status }}
99+
matrix-key: ${{ matrix.platform }}-${{ matrix.collection }}
100+
101+
- name: "Honeycomb: start first step"
102+
run: |
103+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
104+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
105+
59106
- name: Checkout Source
60107
uses: actions/checkout@v2
61108

@@ -68,26 +115,39 @@ jobs:
68115
uses: actions/cache@v2
69116
with:
70117
path: vendor/gems
71-
key: ${{ runner.os }}-nightly-${{ hashFiles('**/Gemfile') }}
118+
key: ${{ runner.os }}-${{ github.event_name }}-${{ hashFiles('**/Gemfile') }}
72119
restore-keys: |
73-
${{ runner.os }}-nightly-
120+
${{ runner.os }}-${{ github.event_name }}-
74121
${{ runner.os }}-
75122
76-
- name: Install gems
123+
- name: "Honeycomb: Record cache setup time"
124+
if: ${{ always() }}
125+
run: |
126+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Cache retrieval'
127+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
128+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
129+
130+
- name: Bundler Setup
77131
run: |
78-
bundle config path vendor/gems
79-
bundle config jobs 8
80-
bundle config retry 3
81-
bundle install
82-
bundle clean
132+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config path vendor/gems' -- bundle config path vendor/gems
133+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config jobs 8' -- bundle config jobs 8
134+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config retry 3' -- bundle config retry 3
135+
buildevents cmd $TRACE_ID $STEP_ID 'bundle install' -- bundle install
136+
buildevents cmd $TRACE_ID $STEP_ID 'bundle clean' -- bundle clean
137+
echo ::group::bundler environment
138+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
139+
echo ::endgroup::
83140
84-
- name: bundler environment
141+
- name: "Honeycomb: Record Bundler Setup time"
142+
if: ${{ always() }}
85143
run: |
86-
bundle env
144+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Bundler Setup'
145+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
146+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
87147
88148
- name: Provision test environment
89149
run: |
90-
bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]'
150+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platform }}' -- bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]'
91151
echo ::group::=== REQUEST ===
92152
cat request.json || true
93153
echo
@@ -105,29 +165,53 @@ jobs:
105165
timeout_minutes: 30
106166
max_attempts: 5
107167
retry_wait_seconds: 60
108-
command: bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
168+
command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
109169

110170
# The agent installer on windows does not finish in time for this to work. To
111171
# work around this for now, retry after a minute if installing the module failed.
112172
- name: Install module
113173
uses: nick-invision/retry@v1
114174
with:
115175
timeout_minutes: 30
116-
max_attempts: 5
176+
max_attempts: 2
117177
retry_wait_seconds: 60
118-
command: bundle exec rake 'litmus:install_module'
178+
command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
179+
180+
- name: "Honeycomb: Record deployment times"
181+
if: ${{ always() }}
182+
run: |
183+
echo ::group::honeycomb step
184+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
185+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
186+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
187+
echo ::endgroup::
119188
120189
- name: Run acceptance tests
121-
run: bundle exec rake 'litmus:acceptance:parallel'
190+
run: |
191+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
192+
193+
- name: "Honeycomb: Record acceptance testing times"
194+
if: ${{ always() }}
195+
run: |
196+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
197+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-5 >> $GITHUB_ENV
198+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
122199
123200
- name: Remove test environment
124201
if: ${{ always() }}
125202
run: |
126-
bundle exec rake 'litmus:tear_down'
127-
echo ::group::=== REQUEST ===
128-
cat request.json || true
129-
echo
130-
echo ::endgroup::
203+
if [ -f inventory.yaml ]; then
204+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
205+
echo ::group::=== REQUEST ===
206+
cat request.json || true
207+
echo
208+
echo ::endgroup::
209+
fi
210+
211+
- name: "Honeycomb: Record removal times"
212+
if: ${{ always() }}
213+
run: |
214+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'
131215
132216
slack-workflow-status:
133217
if: always()
@@ -140,8 +224,8 @@ jobs:
140224
uses: Gamesight/slack-workflow-status@master
141225
with:
142226
# Required Input
143-
repo_token: ${{secrets.GITHUB_TOKEN}}
144-
slack_webhook_url: ${{secrets.SLACK_WEBHOOK}}
227+
repo_token: ${{ secrets.GITHUB_TOKEN }}
228+
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
145229
# Optional Input
146230
channel: '#team-ia-bots'
147231
name: 'GABot'

0 commit comments

Comments
 (0)