Skip to content

Commit 0170314

Browse files
author
carabasdaniel
authored
Merge pull request #1142 from DavidS/cloudci
Add Content Cloud CI workflows
2 parents 121c5eb + 73ab8ae commit 0170314

File tree

5 files changed

+459
-4
lines changed

5 files changed

+459
-4
lines changed

.github/workflows/nightly.yml

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
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: kvrhdn/gha-buildevents@v1.0.2
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=0 >> $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: actions/setup-ruby@v1
37+
if: ${{ github.repository_owner == 'puppetlabs' }}
38+
with:
39+
ruby-version: "2.7"
40+
41+
- name: Cache gems
42+
uses: actions/cache@v2
43+
if: ${{ github.repository_owner == 'puppetlabs' }}
44+
with:
45+
path: vendor/gems
46+
key: ${{ runner.os }}-${{ github.event_name }}-${{ hashFiles('**/Gemfile') }}
47+
restore-keys: |
48+
${{ runner.os }}-${{ github.event_name }}-
49+
${{ runner.os }}-
50+
51+
- name: Install gems
52+
if: ${{ github.repository_owner == 'puppetlabs' }}
53+
run: |
54+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config path vendor/gems' -- bundle config path vendor/gems
55+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config jobs 8' -- bundle config jobs 8
56+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config retry 3' -- bundle config retry 3
57+
buildevents cmd $TRACE_ID $STEP_ID 'bundle install' -- bundle install
58+
buildevents cmd $TRACE_ID $STEP_ID 'bundle clean' -- bundle clean
59+
60+
- name: Setup Acceptance Test Matrix
61+
id: get-matrix
62+
if: ${{ github.repository_owner == 'puppetlabs' }}
63+
run: |
64+
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
65+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata
66+
else
67+
echo "::set-output name=matrix::{}"
68+
fi
69+
70+
- name: "Honeycomb: Record setup time"
71+
if: ${{ always() }}
72+
run: |
73+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
74+
75+
Acceptance:
76+
needs:
77+
- setup_matrix
78+
79+
runs-on: ubuntu-20.04
80+
strategy:
81+
fail-fast: false
82+
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
83+
84+
env:
85+
BUILDEVENT_FILE: '../buildevents.txt'
86+
87+
steps:
88+
- run: |
89+
echo 'platform=${{ matrix.platform }}' >> $BUILDEVENT_FILE
90+
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
91+
92+
- name: "Honeycomb: Start recording"
93+
uses: kvrhdn/gha-buildevents@v1.0.2
94+
with:
95+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
96+
dataset: ${{ env.HONEYCOMB_DATASET }}
97+
job-status: ${{ job.status }}
98+
matrix-key: ${{ matrix.platform }}-${{ matrix.collection }}
99+
100+
- name: "Honeycomb: start first step"
101+
run: |
102+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
103+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
104+
105+
- name: Checkout Source
106+
uses: actions/checkout@v2
107+
108+
- name: Activate Ruby 2.7
109+
uses: actions/setup-ruby@v1
110+
with:
111+
ruby-version: "2.7"
112+
113+
- name: Cache gems
114+
uses: actions/cache@v2
115+
with:
116+
path: vendor/gems
117+
key: ${{ runner.os }}-${{ github.event_name }}-${{ hashFiles('**/Gemfile') }}
118+
restore-keys: |
119+
${{ runner.os }}-${{ github.event_name }}-
120+
${{ runner.os }}-
121+
122+
- name: "Honeycomb: Record cache setup time"
123+
if: ${{ always() }}
124+
run: |
125+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Cache retrieval'
126+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
127+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
128+
129+
- name: Bundler Setup
130+
run: |
131+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config path vendor/gems' -- bundle config path vendor/gems
132+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config jobs 8' -- bundle config jobs 8
133+
buildevents cmd $TRACE_ID $STEP_ID 'bundle config retry 3' -- bundle config retry 3
134+
buildevents cmd $TRACE_ID $STEP_ID 'bundle install' -- bundle install
135+
buildevents cmd $TRACE_ID $STEP_ID 'bundle clean' -- bundle clean
136+
echo ::group::bundler environment
137+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
138+
echo ::endgroup::
139+
140+
- name: "Honeycomb: Record Bundler Setup time"
141+
if: ${{ always() }}
142+
run: |
143+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Bundler Setup'
144+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
145+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
146+
147+
- name: Provision test environment
148+
run: |
149+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platform }}' -- bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]'
150+
echo ::group::=== REQUEST ===
151+
cat request.json || true
152+
echo
153+
echo ::endgroup::
154+
echo ::group::=== INVENTORY ===
155+
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
156+
echo ::endgroup::
157+
158+
# The provision service hands out machines as soon as they're provisioned.
159+
# The GCP VMs might still take a while to spool up and configure themselves fully.
160+
# This retry loop spins until all agents have been installed successfully.
161+
- name: Install agent
162+
uses: nick-invision/retry@v1
163+
with:
164+
timeout_minutes: 30
165+
max_attempts: 5
166+
retry_wait_seconds: 60
167+
command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
168+
169+
# The agent installer on windows does not finish in time for this to work. To
170+
# work around this for now, retry after a minute if installing the module failed.
171+
- name: Install module
172+
uses: nick-invision/retry@v1
173+
with:
174+
timeout_minutes: 30
175+
max_attempts: 2
176+
retry_wait_seconds: 60
177+
command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
178+
179+
- name: "Honeycomb: Record deployment times"
180+
if: ${{ always() }}
181+
run: |
182+
echo ::group::honeycomb step
183+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
184+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
185+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
186+
echo ::endgroup::
187+
188+
- name: Run acceptance tests
189+
run: |
190+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
191+
192+
- name: "Honeycomb: Record acceptance testing times"
193+
if: ${{ always() }}
194+
run: |
195+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
196+
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-5 >> $GITHUB_ENV
197+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
198+
199+
- name: Remove test environment
200+
if: ${{ always() }}
201+
run: |
202+
if [ -f inventory.yaml ]; then
203+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
204+
echo ::group::=== REQUEST ===
205+
cat request.json || true
206+
echo
207+
echo ::endgroup::
208+
fi
209+
210+
- name: "Honeycomb: Record removal times"
211+
if: ${{ always() }}
212+
run: |
213+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'
214+
215+
slack-workflow-status:
216+
if: always()
217+
name: Post Workflow Status To Slack
218+
needs:
219+
- Acceptance
220+
runs-on: ubuntu-20.04
221+
steps:
222+
- name: Slack Workflow Notification
223+
uses: Gamesight/slack-workflow-status@master
224+
with:
225+
# Required Input
226+
repo_token: ${{ secrets.GITHUB_TOKEN }}
227+
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
228+
# Optional Input
229+
channel: '#team-ia-bots'
230+
name: 'GABot'

0 commit comments

Comments
 (0)