Skip to content

Commit 4c54dc6

Browse files
authored
Merge pull request #168 from puppetlabs/add_test_add_replica
add GA workflow for testing adding the replica
2 parents 3d7344b + 9e13397 commit 4c54dc6

File tree

1 file changed

+178
-0
lines changed

1 file changed

+178
-0
lines changed
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
name: "Test add_replica plan"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
image:
8+
description: 'GCP image for test cluster'
9+
required: true
10+
default: 'centos-7'
11+
architecture:
12+
description: 'PE architecture to test'
13+
required: true
14+
default: 'standard'
15+
version:
16+
description: 'PE version to install'
17+
required: true
18+
default: '2019.8.5'
19+
20+
env:
21+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
22+
HONEYCOMB_DATASET: litmus tests
23+
24+
jobs:
25+
smoke-test:
26+
name: "${{ matrix.architecture }}, ${{ matrix.image }}, PE ${{ matrix.version }}"
27+
runs-on: ubuntu-20.04
28+
env:
29+
BOLT_GEM: true
30+
BOLT_DISABLE_ANALYTICS: true
31+
BUILDEVENT_FILE: '../buildevents.txt'
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
architecture:
36+
- "${{ github.event.inputs.architecture }}"
37+
version:
38+
- "${{ github.event.inputs.version }}"
39+
image:
40+
- "${{ github.event.inputs.image }}"
41+
42+
steps:
43+
- name: 'Start SSH session'
44+
uses: luchihoratiu/debug-via-ssh@main
45+
with:
46+
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
47+
SSH_PASS: ${{ secrets.SSH_PASS }}
48+
49+
- name: "Honeycomb: Start recording"
50+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
51+
with:
52+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
53+
dataset: ${{ env.HONEYCOMB_DATASET }}
54+
job-status: ${{ job.status }}
55+
56+
- name: "Honeycomb: Start first step"
57+
run: |
58+
echo STEP_ID=setup-test-cluster >> $GITHUB_ENV
59+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
60+
61+
- name: "Checkout Source"
62+
uses: actions/checkout@v2
63+
64+
- name: "Activate Ruby 2.7"
65+
uses: ruby/setup-ruby@v1
66+
with:
67+
ruby-version: "2.7"
68+
bundler-cache: true
69+
70+
- name: "Print bundle environment"
71+
if: ${{ github.repository_owner == 'puppetlabs' }}
72+
run: |
73+
echo ::group::info:bundler
74+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
75+
echo ::endgroup::
76+
77+
- name: "Honeycomb: Record environment setup time"
78+
if: ${{ always() }}
79+
run: |
80+
echo ::group::honeycomb
81+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Set up environment'
82+
echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-provision >> $GITHUB_ENV
83+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
84+
echo ::endgroup::
85+
86+
- name: 'Provision test cluster'
87+
timeout-minutes: 15
88+
run: |
89+
echo ::group::prepare
90+
mkdir -p $HOME/.ssh
91+
echo 'Host *' > $HOME/.ssh/config
92+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
93+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
94+
buildevents cmd $TRACE_ID $STEP_ID 'rake spec_prep' -- bundle exec rake spec_prep
95+
echo ::endgroup::
96+
97+
echo ::group::provision
98+
buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::provision_test_cluster' -- \
99+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
100+
--modulepath spec/fixtures/modules \
101+
provider=provision_service \
102+
image=${{ matrix.image }} \
103+
architecture=${{ matrix.architecture }}-with-dr
104+
echo ::endgroup::
105+
106+
echo ::group::info:request
107+
cat request.json || true; echo
108+
echo ::endgroup::
109+
110+
echo ::group::info:inventory
111+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
112+
echo ::endgroup::
113+
114+
- name: "Honeycomb: Record provision time"
115+
if: ${{ always() }}
116+
run: |
117+
echo ::group::honeycomb
118+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Provision test cluster'
119+
echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-install >> $GITHUB_ENV
120+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
121+
echo ::endgroup::
122+
123+
- name: 'Install PE on test cluster'
124+
timeout-minutes: 120
125+
run: |
126+
buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::install_test_cluster' -- \
127+
bundle exec bolt plan run peadm_spec::install_test_cluster \
128+
--inventoryfile spec/fixtures/litmus_inventory.yaml \
129+
--modulepath spec/fixtures/modules \
130+
architecture=${{ matrix.architecture }} \
131+
version=${{ matrix.version }}
132+
133+
- name: "Honeycomb: Record install time"
134+
if: ${{ always() }}
135+
run: |
136+
echo ::group::honeycomb
137+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Install PE on test cluster'
138+
echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-tear_down >> $GITHUB_ENV
139+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
140+
echo ::endgroup::
141+
142+
- name: 'Run add_replica plan'
143+
timeout-minutes: 10
144+
run: |
145+
buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::add_replica' -- \
146+
bundle exec bolt plan run peadm_spec::add_replica \
147+
--inventoryfile spec/fixtures/litmus_inventory.yaml \
148+
--modulepath spec/fixtures/modules
149+
150+
- name: 'Wait as long as the file ${HOME}/pause file is present'
151+
if: ${{ always() }}
152+
run: |
153+
while [ -f "${HOME}/pause" ] ; do
154+
echo "${HOME}/pause present, sleeping for 60 seconds..."
155+
sleep 60
156+
done
157+
echo "${HOME}/pause absent, continuing workflow."
158+
159+
- name: 'Tear down test cluster'
160+
if: ${{ always() }}
161+
continue-on-error: true
162+
run: |
163+
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
164+
echo ::group::tear_down
165+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
166+
echo ::endgroup::
167+
168+
echo ::group::info:request
169+
cat request.json || true; echo
170+
echo ::endgroup::
171+
fi
172+
173+
- name: "Honeycomb: Record tear down time"
174+
if: ${{ always() }}
175+
run: |
176+
echo ::group::honeycomb
177+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Tear down test cluster'
178+
echo ::endgroup::

0 commit comments

Comments
 (0)