|
| 1 | +--- |
| 2 | +name: "Upgrade PE with one legacy compiler" |
| 3 | + |
| 4 | +on: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - ".github/workflows/**/*" |
| 8 | + - "spec/**/*" |
| 9 | + - "lib/**/*" |
| 10 | + - "tasks/**/*" |
| 11 | + - "functions/**/*" |
| 12 | + - "types/**/*" |
| 13 | + - "plans/**/*" |
| 14 | + - "hiera/**/*" |
| 15 | + - "manifests/**/*" |
| 16 | + - "templates/**/*" |
| 17 | + - "files/**/*" |
| 18 | + - "metadata.json" |
| 19 | + - "Rakefile" |
| 20 | + - "Gemfile" |
| 21 | + - "provision.yaml" |
| 22 | + - ".rspec" |
| 23 | + - ".rubocop.yml" |
| 24 | + - ".puppet-lint.rc" |
| 25 | + - ".fixtures.yml" |
| 26 | + branches: [main] |
| 27 | + workflow_dispatch: |
| 28 | + ssh-debugging: |
| 29 | + description: "Boolean; whether or not to pause for ssh debugging" |
| 30 | + required: true |
| 31 | + default: "false" |
| 32 | + |
| 33 | +jobs: |
| 34 | + test-install: |
| 35 | + name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}" |
| 36 | + runs-on: ubuntu-20.04 |
| 37 | + env: |
| 38 | + BOLT_GEM: true |
| 39 | + BOLT_DISABLE_ANALYTICS: true |
| 40 | + LANG: "en_US.UTF-8" |
| 41 | + strategy: |
| 42 | + fail-fast: false |
| 43 | + matrix: |
| 44 | + architecture: |
| 45 | + - "large-with-two-compilers" |
| 46 | + image: |
| 47 | + - "almalinux-cloud/almalinux-8" |
| 48 | + version: |
| 49 | + - "2023.6.0" |
| 50 | + to_version: |
| 51 | + - "2023.7.0" |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: "Start SSH session" |
| 55 | + if: ${{ github.event.inputs.ssh-debugging == 'true' }} |
| 56 | + uses: luchihoratiu/debug-via-ssh@main |
| 57 | + with: |
| 58 | + NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} |
| 59 | + SSH_PASS: ${{ secrets.SSH_PASS }} |
| 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 | + bundle env |
| 75 | + echo ::endgroup:: |
| 76 | +
|
| 77 | + - name: "Provision test cluster" |
| 78 | + timeout-minutes: 15 |
| 79 | + run: | |
| 80 | + echo ::group::prepare |
| 81 | + mkdir -p $HOME/.ssh |
| 82 | + echo 'Host *' > $HOME/.ssh/config |
| 83 | + echo ' ServerAliveInterval 150' >> $HOME/.ssh/config |
| 84 | + echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config |
| 85 | + bundle exec rake spec_prep |
| 86 | + echo ::endgroup:: |
| 87 | +
|
| 88 | + echo ::group::provision |
| 89 | + bundle exec bolt plan run peadm_spec::provision_test_cluster \ |
| 90 | + --modulepath spec/fixtures/modules \ |
| 91 | + provider=provision_service \ |
| 92 | + image=${{ matrix.image }} \ |
| 93 | + architecture=${{ matrix.architecture }} |
| 94 | + echo ::endgroup:: |
| 95 | +
|
| 96 | + echo ::group::info:request |
| 97 | + cat request.json || true; echo |
| 98 | + echo ::endgroup:: |
| 99 | +
|
| 100 | + echo ::group::info:inventory |
| 101 | + sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true |
| 102 | + echo ::endgroup:: |
| 103 | +
|
| 104 | + - name: Set up yq |
| 105 | + uses: frenck/action-setup-yq@v1 |
| 106 | + with: |
| 107 | + version: v4.30.5 |
| 108 | + |
| 109 | + - name: 'Install PE on test cluster' |
| 110 | + timeout-minutes: 120 |
| 111 | + run: | |
| 112 | + bundle exec bolt plan run peadm_spec::install_test_cluster \ |
| 113 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 114 | + --modulepath spec/fixtures/modules \ |
| 115 | + architecture="large" \ |
| 116 | + version=${{ matrix.version }} |
| 117 | +
|
| 118 | + - name: 'Wait as long as the file ${HOME}/pause file is present' |
| 119 | + if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }} |
| 120 | + run: | |
| 121 | + while [ -f "${HOME}/pause" ] ; do |
| 122 | + echo "${HOME}/pause present, sleeping for 60 seconds..." |
| 123 | + sleep 60 |
| 124 | + done |
| 125 | + echo "${HOME}/pause absent, continuing workflow." |
| 126 | +
|
| 127 | + - name: 'Convert one compiler to legacy' |
| 128 | + timeout-minutes: 120 |
| 129 | + run: | |
| 130 | + primary=$(yq '.groups[].targets[] | select(.vars.role == "primary") | .uri' spec/fixtures/litmus_inventory.yaml) |
| 131 | + compiler=$(yq '.groups[].targets[] | select(.vars.role == "compiler") | .uri' spec/fixtures/litmus_inventory.yaml | head -n 1) |
| 132 | +
|
| 133 | + bundle exec bolt plan run peadm::convert_compiler_to_legacy \ |
| 134 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 135 | + --modulepath spec/fixtures/modules \ |
| 136 | + --no-host-key-check \ |
| 137 | + primary_host=$primary \ |
| 138 | + legacy_hosts=$compiler |
| 139 | +
|
| 140 | +
|
| 141 | + - name: 'Upgrade PE on test cluster' |
| 142 | + timeout-minutes: 120 |
| 143 | + run: | |
| 144 | + bundle exec bolt plan run peadm_spec::upgrade_test_cluster \ |
| 145 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 146 | + --modulepath spec/fixtures/modules \ |
| 147 | + --no-host-key-check \ |
| 148 | + architecture="large" \ |
| 149 | + version=${{ matrix.to_version }} |
| 150 | +
|
| 151 | + - name: "Tear down test cluster" |
| 152 | + if: ${{ always() }} |
| 153 | + continue-on-error: true |
| 154 | + run: | |
| 155 | + if [ -f spec/fixtures/litmus_inventory.yaml ]; then |
| 156 | + echo ::group::tear_down |
| 157 | + bundle exec rake 'litmus:tear_down' |
| 158 | + echo ::endgroup:: |
| 159 | +
|
| 160 | + echo ::group::info:request |
| 161 | + cat request.json || true; echo |
| 162 | + echo ::endgroup:: |
| 163 | + fi |
0 commit comments