Skip to content

Commit bf023c3

Browse files
committed
feat(workflow): add job to install PE with legacy compilers
- Renamed job `install` to `convert_compiler` for clarity. - Added new job `install` to install PE with legacy compilers. - Included steps to start SSH session, checkout source, activate Ruby 2.7, provision test cluster, set up yq, create params.json file, install PE, wait for SSH debugging, and tear down test cluster.
1 parent fe534b5 commit bf023c3

File tree

1 file changed

+107
-3
lines changed

1 file changed

+107
-3
lines changed

.github/workflows/test-upgrade-legacy.yaml renamed to .github/workflows/test-convert-to-legacy.yaml

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Convert 1 compiler to legacy
2+
name: Convert compiler to legacy
33
on:
44
pull_request:
55
paths:
@@ -31,8 +31,8 @@ on:
3131
required: true
3232
default: 'false'
3333
jobs:
34-
install:
35-
name: Install and convert compilers to legacy
34+
convert_compiler:
35+
name: Convert compilers to legacy
3636
runs-on: ubuntu-20.04
3737
env:
3838
BOLT_GEM: true
@@ -159,3 +159,107 @@ jobs:
159159
cat request.json || true; echo
160160
echo ::endgroup::
161161
fi
162+
install:
163+
name: Install PE with legacy compilers
164+
runs-on: ubuntu-20.04
165+
env:
166+
BOLT_GEM: true
167+
BOLT_DISABLE_ANALYTICS: true
168+
LANG: en_US.UTF-8
169+
steps:
170+
- name: Start SSH session
171+
if: ${{ github.event.inputs.ssh-debugging == 'true' }}
172+
uses: luchihoratiu/debug-via-ssh@main
173+
with:
174+
NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }}
175+
SSH_PASS: ${{ secrets.SSH_PASS }}
176+
- name: Checkout Source
177+
uses: actions/checkout@v2
178+
- name: Activate Ruby 2.7
179+
uses: ruby/setup-ruby@v1
180+
with:
181+
ruby-version: '2.7'
182+
bundler-cache: true
183+
- name: Print bundle environment
184+
if: ${{ github.repository_owner == 'puppetlabs' }}
185+
run: |
186+
echo ::group::info:bundler
187+
bundle env
188+
echo ::endgroup::
189+
- name: Provision test cluster
190+
timeout-minutes: 15
191+
run: |
192+
echo ::group::prepare
193+
mkdir -p $HOME/.ssh
194+
echo 'Host *' > $HOME/.ssh/config
195+
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
196+
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
197+
bundle exec rake spec_prep
198+
echo ::endgroup::
199+
echo ::group::provision
200+
bundle exec bolt plan run peadm_spec::provision_test_cluster \
201+
--modulepath spec/fixtures/modules \
202+
provider=provision_service \
203+
image=almalinux-cloud/almalinux-8 \
204+
architecture=large-with-dr
205+
echo ::endgroup::
206+
echo ::group::certnames
207+
bundle exec bolt plan run peadm_spec::add_inventory_hostnames \
208+
--inventory spec/fixtures/litmus_inventory.yaml \
209+
--modulepath spec/fixtures/modules \
210+
--no-host-key-check \
211+
inventory_file=spec/fixtures/litmus_inventory.yaml
212+
echo ::endgroup::
213+
echo ::group::info:request
214+
cat request.json || true; echo
215+
echo ::endgroup::
216+
echo ::group::info:inventory
217+
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
218+
echo ::endgroup::
219+
- name: Set up yq
220+
uses: frenck/action-setup-yq@v1
221+
with:
222+
version: v4.30.5
223+
- name: Create the params.json file
224+
run: |
225+
primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .name' spec/fixtures/litmus_inventory.yaml)
226+
compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 1)
227+
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 2)
228+
jq -n --arg primary_host "$primary" \
229+
--argjson legacy_compilers '[$legacy_compiler]' \
230+
--argjson compiler_hosts '[$compiler]' \
231+
--arg version "2023.8.0" \
232+
--arg console_password "${{ secrets.CONSOLE_PASSWORD }}" \
233+
'{primary_host: $primary_host, legacy_compilers: $legacy_compilers, compiler_hosts: $compiler_hosts, version: $version, console_password: $console_password}' > params.json
234+
- name: Install PE with legacy compilers
235+
timeout-minutes: 120
236+
run: |
237+
echo ::group::params.json
238+
cat params.json
239+
echo ::endgroup::
240+
echo ::group::install
241+
bundle exec bolt plan run peadm::install \
242+
--inventoryfile spec/fixtures/litmus_inventory.yaml \
243+
--modulepath spec/fixtures/modules \
244+
@params.json
245+
echo ::endgroup::
246+
- name: Wait as long as the file ${HOME}/pause file is present
247+
if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }}
248+
run: |
249+
while [ -f "${HOME}/pause" ] ; do
250+
echo "${HOME}/pause present, sleeping for 60 seconds..."
251+
sleep 60
252+
done
253+
echo "${HOME}/pause absent, continuing workflow."
254+
- name: Tear down test cluster
255+
if: ${{ always() }}
256+
continue-on-error: true
257+
run: |-
258+
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
259+
echo ::group::tear_down
260+
bundle exec rake 'litmus:tear_down'
261+
echo ::endgroup::
262+
echo ::group::info:request
263+
cat request.json || true; echo
264+
echo ::endgroup::
265+
fi

0 commit comments

Comments
 (0)