Skip to content

Commit

Permalink
fix(workflow): correct legacy compiler selection in test-legacy-upgra…
Browse files Browse the repository at this point in the history
…de.yaml

- Replace `head -n 2` with `sed -n 2p` for accurate selection of the second compiler
  • Loading branch information
CoMfUcIoS committed Sep 25, 2024
1 parent 957f060 commit 2b7fd6f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test-legacy-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ on:
required: true
default: 'false'
jobs:
convert_compiler:
name: Convert compilers to legacy
upgrade_with_legacy_compilers:
name: Upgrade PE with legacy compilers
runs-on: ubuntu-20.04
env:
BOLT_GEM: true
Expand Down Expand Up @@ -96,14 +96,14 @@ jobs:
run: |
primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .name' spec/fixtures/litmus_inventory.yaml)
compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 1)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 2)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | sed -n 2p)
replica=$(yq '.groups[].targets[] | select(.vars.role == "replica") | .name' spec/fixtures/litmus_inventory.yaml)
echo -n '{ "primary_host": "'$primary'", "replica_host": "'$replica'", "legacy_compilers": ["'$legacy_compiler'"], "compiler_hosts": ["'$compiler'"], "version": "2023.7.0", "console_password": "'${{ secrets.CONSOLE_PASSWORD }}'" }' > params.json
echo -n '{ "download_mode": "direct", "primary_host": "'$primary'", "replica_host": "'$replica'", "legacy_compilers": ["'$legacy_compiler'"], "compiler_hosts": ["'$compiler'"], "version": "2023.7.0", "console_password": "'${{ secrets.CONSOLE_PASSWORD }}'" }' > params.json
- name: Install PE with legacy compilers
timeout-minutes: 120
run: |
echo ::group::params.json
sed -e 's/console_password: .*/console_password: "[redacted]"/' < params.json || true
jq '.console_password = "[redacted]"' params.json || true
echo ::endgroup::
echo ::group::install
bundle exec bolt plan run peadm::install \
Expand All @@ -129,7 +129,7 @@ jobs:
echo ::group::get_peadm_config
primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .name' spec/fixtures/litmus_inventory.yaml)
compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 1)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 2)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | sed -n 2p)
bundle exec bolt task run peadm::get_peadm_config \
--targets $primary \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
Expand All @@ -150,13 +150,13 @@ jobs:
run: |
primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .name' spec/fixtures/litmus_inventory.yaml)
compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 1)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 2)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | sed -n 2p)
replica=$(yq '.groups[].targets[] | select(.vars.role == "replica") | .name' spec/fixtures/litmus_inventory.yaml)
echo -n '{ "primary_host": "'$primary'", "replica_host": "'$replica'", "compiler_hosts": ["'$compiler'", "'$legacy_compiler'"], "version": "2023.8.0"}' > upgrade_params.json
- name: Upgrade PE with legacy compilers
run: |
echo ::group::upgrade_params.json
echo upgrade_params.json
cat upgrade_params.json
echo ::endgroup::
echo ::group::upgrade
bundle exec bolt plan run peadm::upgrade \
Expand All @@ -174,7 +174,7 @@ jobs:
echo ::group::get_peadm_config
primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .name' spec/fixtures/litmus_inventory.yaml)
compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 1)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | head -n 2)
legacy_compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .name' spec/fixtures/litmus_inventory.yaml | sed -n 2p)
bundle exec bolt task run peadm::get_peadm_config \
--targets $primary \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
Expand Down

0 comments on commit 2b7fd6f

Please sign in to comment.