|
| 1 | +--- |
| 2 | +name: Upgrade test |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + image: |
| 7 | + description: GCP image for test cluster |
| 8 | + required: true |
| 9 | + default: almalinux-cloud/almalinux-8 |
| 10 | + architecture: |
| 11 | + type: choice |
| 12 | + required: true |
| 13 | + default: standard |
| 14 | + description: PE architecture to test |
| 15 | + options: |
| 16 | + - standard |
| 17 | + - standard-with-dr |
| 18 | + - large |
| 19 | + - large-with-dr |
| 20 | + - extra-large |
| 21 | + - extra-large-with-dr |
| 22 | + version: |
| 23 | + description: PE version to install initially |
| 24 | + required: true |
| 25 | + default: 2021.7.9 |
| 26 | + upgrade_version: |
| 27 | + description: PE version to upgrade to |
| 28 | + required: true |
| 29 | + default: 2023.8.6 |
| 30 | + ssh-debugging: |
| 31 | + description: Boolean; whether or not to pause for ssh debugging |
| 32 | + required: true |
| 33 | + default: 'false' |
| 34 | +jobs: |
| 35 | + test-upgrade: |
| 36 | + name: PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }} |
| 37 | + runs-on: ubuntu-latest |
| 38 | + env: |
| 39 | + BOLT_GEM: true |
| 40 | + BOLT_DISABLE_ANALYTICS: true |
| 41 | + LANG: en_US.UTF-8 |
| 42 | + strategy: |
| 43 | + fail-fast: false |
| 44 | + matrix: |
| 45 | + download_mode: [direct] |
| 46 | + architecture: ['${{ github.event.inputs.architecture }}'] |
| 47 | + version: ['${{ github.event.inputs.version }}'] |
| 48 | + version_to_upgrade: ['${{ github.event.inputs.upgrade_version }}'] |
| 49 | + image: ['${{ github.event.inputs.image }}'] |
| 50 | + steps: |
| 51 | + - name: Checkout Source |
| 52 | + uses: actions/checkout@v4 |
| 53 | + - name: Activate Ruby 3.1 |
| 54 | + uses: ruby/setup-ruby@v1 |
| 55 | + with: |
| 56 | + ruby-version: '3.1' |
| 57 | + bundler-cache: true |
| 58 | + - name: Print bundle environment |
| 59 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 60 | + run: | |
| 61 | + echo ::group::info:bundler |
| 62 | + bundle env |
| 63 | + echo ::endgroup:: |
| 64 | + - name: Provision test cluster |
| 65 | + timeout-minutes: 15 |
| 66 | + run: | |
| 67 | + echo ::group::prepare |
| 68 | + mkdir -p $HOME/.ssh |
| 69 | + echo 'Host *' > $HOME/.ssh/config |
| 70 | + echo ' ServerAliveInterval 150' >> $HOME/.ssh/config |
| 71 | + echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config |
| 72 | + bundle exec rake spec_prep |
| 73 | + echo ::endgroup:: |
| 74 | + echo ::group::provision |
| 75 | + bundle exec bolt plan run peadm_spec::provision_test_cluster \ |
| 76 | + --modulepath spec/fixtures/modules \ |
| 77 | + provider=provision_service \ |
| 78 | + image=${{ matrix.image }} \ |
| 79 | + architecture=${{ matrix.architecture }} |
| 80 | + echo ::endgroup:: |
| 81 | + echo ::group::info:request |
| 82 | + cat request.json || true; echo |
| 83 | + echo ::endgroup:: |
| 84 | + echo ::group::info:inventory |
| 85 | + sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true |
| 86 | + echo ::endgroup:: |
| 87 | + - name: Echo Install PE on test cluster command |
| 88 | + timeout-minutes: 120 |
| 89 | + run: | |
| 90 | + echo bundle exec bolt plan run peadm_spec::install_test_cluster \ |
| 91 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 92 | + --modulepath spec/fixtures/modules \ |
| 93 | + architecture=${{ matrix.architecture }} \ |
| 94 | + version=${{ matrix.version }} \ |
| 95 | + console_password=${{ secrets.CONSOLE_PASSWORD }} |
| 96 | + - name: Start SSH session |
| 97 | + if: ${{ github.event.inputs.ssh-debugging == 'true' }} |
| 98 | + uses: luchihoratiu/debug-via-ssh@main |
| 99 | + with: |
| 100 | + NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} |
| 101 | + SSH_PASS: ${{ secrets.SSH_PASS2 }} |
| 102 | + - name: Install PE on test cluster |
| 103 | + timeout-minutes: 120 |
| 104 | + run: | |
| 105 | + bundle exec bolt plan run peadm_spec::install_test_cluster \ |
| 106 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 107 | + --modulepath spec/fixtures/modules \ |
| 108 | + architecture=${{ matrix.architecture }} \ |
| 109 | + version=${{ matrix.version }} \ |
| 110 | + console_password=${{ secrets.CONSOLE_PASSWORD }} |
| 111 | + - name: Wait as long as the file ${HOME}/pause file is present |
| 112 | + if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }} |
| 113 | + run: | |
| 114 | + while [ -f "${HOME}/pause" ] ; do |
| 115 | + echo "${HOME}/pause present, sleeping for 60 seconds..." |
| 116 | + sleep 60 |
| 117 | + done |
| 118 | + echo "${HOME}/pause absent, continuing workflow." |
| 119 | + - name: Upgrade PE on test cluster |
| 120 | + timeout-minutes: 120 |
| 121 | + run: | |
| 122 | + bundle exec bolt plan run peadm_spec::upgrade_test_cluster \ |
| 123 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 124 | + --modulepath spec/fixtures/modules \ |
| 125 | + architecture=${{ matrix.architecture }} \ |
| 126 | + download_mode=${{ matrix.download_mode }} \ |
| 127 | + version=${{ matrix.version_to_upgrade }} |
| 128 | + - name: Tear down test cluster |
| 129 | + if: ${{ always() }} |
| 130 | + continue-on-error: true |
| 131 | + run: |- |
| 132 | + if [ -f spec/fixtures/litmus_inventory.yaml ]; then |
| 133 | + echo ::group::tear_down |
| 134 | + bundle exec rake 'litmus:tear_down' |
| 135 | + echo ::endgroup:: |
| 136 | + echo ::group::info:request |
| 137 | + cat request.json || true; echo |
| 138 | + echo ::endgroup:: |
| 139 | + fi |
0 commit comments