|
| 1 | +--- |
| 2 | +name: Convert 1 compiler to legacy |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - .github/workflows/**/* |
| 7 | + - spec/**/* |
| 8 | + - lib/**/* |
| 9 | + - tasks/**/* |
| 10 | + - functions/**/* |
| 11 | + - types/**/* |
| 12 | + - plans/**/* |
| 13 | + - hiera/**/* |
| 14 | + - manifests/**/* |
| 15 | + - templates/**/* |
| 16 | + - files/**/* |
| 17 | + - metadata.json |
| 18 | + - Rakefile |
| 19 | + - Gemfile |
| 20 | + - provision.yaml |
| 21 | + - .rspec |
| 22 | + - .rubocop.yml |
| 23 | + - .puppet-lint.rc |
| 24 | + - .fixtures.yml |
| 25 | + branches: [main] |
| 26 | + workflow_dispatch: |
| 27 | + inputs: |
| 28 | + ssh-debugging: |
| 29 | + description: Boolean; whether or not to pause for ssh debugging |
| 30 | + required: true |
| 31 | + default: 'false' |
| 32 | +jobs: |
| 33 | + install: |
| 34 | + name: Install and convert compilers to legacy |
| 35 | + runs-on: ubuntu-20.04 |
| 36 | + env: |
| 37 | + BOLT_GEM: true |
| 38 | + BOLT_DISABLE_ANALYTICS: true |
| 39 | + LANG: en_US.UTF-8 |
| 40 | + steps: |
| 41 | + - name: Start SSH session |
| 42 | + if: ${{ github.event.inputs.ssh-debugging == 'true' }} |
| 43 | + uses: luchihoratiu/debug-via-ssh@main |
| 44 | + with: |
| 45 | + NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} |
| 46 | + SSH_PASS: ${{ secrets.SSH_PASS }} |
| 47 | + - name: Checkout Source |
| 48 | + uses: actions/checkout@v2 |
| 49 | + - name: Activate Ruby 2.7 |
| 50 | + uses: ruby/setup-ruby@v1 |
| 51 | + with: |
| 52 | + ruby-version: '2.7' |
| 53 | + bundler-cache: true |
| 54 | + - name: Print bundle environment |
| 55 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 56 | + run: | |
| 57 | + echo ::group::info:bundler |
| 58 | + bundle env |
| 59 | + echo ::endgroup:: |
| 60 | + - name: Provision test cluster |
| 61 | + timeout-minutes: 15 |
| 62 | + run: | |
| 63 | + echo ::group::prepare |
| 64 | + mkdir -p $HOME/.ssh |
| 65 | + echo 'Host *' > $HOME/.ssh/config |
| 66 | + echo ' ServerAliveInterval 150' >> $HOME/.ssh/config |
| 67 | + echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config |
| 68 | + bundle exec rake spec_prep |
| 69 | + echo ::endgroup:: |
| 70 | + echo ::group::provision |
| 71 | + bundle exec bolt plan run peadm_spec::provision_test_cluster \ |
| 72 | + --modulepath spec/fixtures/modules \ |
| 73 | + provider=provision_service \ |
| 74 | + image=almalinux-cloud/almalinux-8 \ |
| 75 | + architecture=large-with-dr |
| 76 | + echo ::endgroup:: |
| 77 | + echo ::group::certnames |
| 78 | + bundle exec bolt plan run peadm_spec::add_inventory_hostnames \ |
| 79 | + --modulepath spec/fixtures/modules \ |
| 80 | + --no-host-key-check \ |
| 81 | + inventory_file=spec/fixtures/litmus_inventory.yml |
| 82 | + echo ::endgroup:: |
| 83 | + echo ::group::info:request |
| 84 | + cat request.json || true; echo |
| 85 | + echo ::endgroup:: |
| 86 | + echo ::group::info:inventory |
| 87 | + sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true |
| 88 | + echo ::endgroup:: |
| 89 | + - name: Set up yq |
| 90 | + uses: frenck/action-setup-yq@v1 |
| 91 | + with: |
| 92 | + version: v4.30.5 |
| 93 | + - name: Install PE on test cluster |
| 94 | + timeout-minutes: 120 |
| 95 | + run: | |
| 96 | + bundle exec bolt plan run peadm_spec::install_test_cluster \ |
| 97 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 98 | + --modulepath spec/fixtures/modules \ |
| 99 | + architecture=large-with-dr \ |
| 100 | + console_password=${{ secrets.CONSOLE_PASSWORD }} \ |
| 101 | + version=2023.7.0 |
| 102 | + - name: Wait as long as the file ${HOME}/pause file is present |
| 103 | + if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }} |
| 104 | + run: | |
| 105 | + while [ -f "${HOME}/pause" ] ; do |
| 106 | + echo "${HOME}/pause present, sleeping for 60 seconds..." |
| 107 | + sleep 60 |
| 108 | + done |
| 109 | + echo "${HOME}/pause absent, continuing workflow." |
| 110 | + - name: Convert one compiler to legacy |
| 111 | + timeout-minutes: 120 |
| 112 | + run: | |
| 113 | + primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory.yaml) |
| 114 | + compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .uri' spec/fixtures/litmus_inventory.yaml | head -n 1) |
| 115 | + echo ::group::convert_compiler_to_legacy |
| 116 | + bundle exec bolt plan run peadm::convert_compiler_to_legacy \ |
| 117 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 118 | + --modulepath spec/fixtures/modules \ |
| 119 | + --no-host-key-check \ |
| 120 | + primary_host=$primary \ |
| 121 | + legacy_hosts=$compiler \ |
| 122 | + --stream |
| 123 | + ec:qho ::endgroup:: |
| 124 | + - name: Check if compiler is converted |
| 125 | + timeout-minutes: 120 |
| 126 | + run: | |
| 127 | + primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory.yaml) |
| 128 | + compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .uri' spec/fixtures/litmus_inventory.yaml | head -n 1) |
| 129 | + legacy_compiler=$(yq '.items[0].value.params.legacy_compilers[0]' bolt task run peadm::get_peadm_config -t $primary --no-host-key-check --format json) |
| 130 | + if [ "$compiler" != "$legacy_compiler" ]; then |
| 131 | + echo "Compiler conversion failed" |
| 132 | + exit 1 |
| 133 | + fi |
| 134 | + - name: Tear down test cluster |
| 135 | + if: ${{ always() }} |
| 136 | + continue-on-error: true |
| 137 | + run: |- |
| 138 | + if [ -f spec/fixtures/litmus_inventory.yaml ]; then |
| 139 | + echo ::group::tear_down |
| 140 | + bundle exec rake 'litmus:tear_down' |
| 141 | + echo ::endgroup:: |
| 142 | + echo ::group::info:request |
| 143 | + cat request.json || true; echo |
| 144 | + echo ::endgroup:: |
| 145 | + fi |
0 commit comments