|
| 1 | +--- |
| 2 | +name: "Add Compiler test" |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + image: |
| 8 | + description: 'GCP image for test cluster' |
| 9 | + required: true |
| 10 | + default: 'almalinux-cloud/almalinux-8' |
| 11 | + architecture: |
| 12 | + description: 'PE architecture to test' |
| 13 | + required: true |
| 14 | + default: 'large' |
| 15 | + version: |
| 16 | + description: 'PE version to install' |
| 17 | + required: true |
| 18 | + default: '2021.7.0' |
| 19 | + ssh-debugging: |
| 20 | + description: 'Boolean; whether or not to pause for ssh debugging' |
| 21 | + required: true |
| 22 | + default: 'false' |
| 23 | + |
| 24 | +env: |
| 25 | + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 |
| 26 | + HONEYCOMB_DATASET: litmus tests |
| 27 | + |
| 28 | +jobs: |
| 29 | + test-add-compiler: |
| 30 | + name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}" |
| 31 | + runs-on: ubuntu-20.04 |
| 32 | + env: |
| 33 | + BOLT_GEM: true |
| 34 | + BOLT_DISABLE_ANALYTICS: true |
| 35 | + BUILDEVENT_FILE: '../buildevents.txt' |
| 36 | + LANG: 'en_US.UTF-8' |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + architecture: |
| 41 | + - "${{ github.event.inputs.architecture }}" |
| 42 | + version: |
| 43 | + - "${{ github.event.inputs.version }}" |
| 44 | + image: |
| 45 | + - "${{ github.event.inputs.image }}" |
| 46 | + |
| 47 | + steps: |
| 48 | + - name: 'Start SSH session' |
| 49 | + if: ${{ github.event.inputs.ssh-debugging == 'true' }} |
| 50 | + uses: luchihoratiu/debug-via-ssh@main |
| 51 | + with: |
| 52 | + NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} |
| 53 | + SSH_PASS: ${{ secrets.SSH_PASS }} |
| 54 | + |
| 55 | + - name: "Honeycomb: Start recording" |
| 56 | + uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 |
| 57 | + with: |
| 58 | + apikey: ${{ env.HONEYCOMB_WRITEKEY }} |
| 59 | + dataset: ${{ env.HONEYCOMB_DATASET }} |
| 60 | + job-status: ${{ job.status }} |
| 61 | + |
| 62 | + - name: "Honeycomb: Start first step" |
| 63 | + run: | |
| 64 | + echo STEP_ID=setup-test-cluster >> $GITHUB_ENV |
| 65 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 66 | +
|
| 67 | + - name: "Checkout Source" |
| 68 | + uses: actions/checkout@v2 |
| 69 | + |
| 70 | + - name: "Activate Ruby 2.7" |
| 71 | + uses: ruby/setup-ruby@v1 |
| 72 | + with: |
| 73 | + ruby-version: "2.7" |
| 74 | + bundler-cache: true |
| 75 | + |
| 76 | + - name: "Print bundle environment" |
| 77 | + if: ${{ github.repository_owner == 'puppetlabs' }} |
| 78 | + run: | |
| 79 | + echo ::group::info:bundler |
| 80 | + buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env |
| 81 | + echo ::endgroup:: |
| 82 | +
|
| 83 | + - name: "Honeycomb: Record environment setup time" |
| 84 | + if: ${{ always() }} |
| 85 | + run: | |
| 86 | + echo ::group::honeycomb |
| 87 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Set up environment' |
| 88 | + echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-provision >> $GITHUB_ENV |
| 89 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 90 | + echo ::endgroup:: |
| 91 | +
|
| 92 | + - name: 'Provision test cluster (specified architecture with added DR)' |
| 93 | + timeout-minutes: 15 |
| 94 | + run: | |
| 95 | + echo ::group::prepare |
| 96 | + mkdir -p $HOME/.ssh |
| 97 | + echo 'Host *' > $HOME/.ssh/config |
| 98 | + echo ' ServerAliveInterval 150' >> $HOME/.ssh/config |
| 99 | + echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config |
| 100 | + buildevents cmd $TRACE_ID $STEP_ID 'rake spec_prep' -- bundle exec rake spec_prep |
| 101 | + echo ::endgroup:: |
| 102 | +
|
| 103 | + echo ::group::provision |
| 104 | + buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::provision_test_cluster' -- \ |
| 105 | + bundle exec bolt plan run peadm_spec::provision_test_cluster \ |
| 106 | + --modulepath spec/fixtures/modules \ |
| 107 | + provider=provision_service \ |
| 108 | + image=${{ matrix.image }} \ |
| 109 | + architecture=${{ matrix.architecture }}-with-extra-compiler |
| 110 | + echo ::endgroup:: |
| 111 | +
|
| 112 | + echo ::group::info:request |
| 113 | + cat request.json || true; echo |
| 114 | + echo ::endgroup:: |
| 115 | +
|
| 116 | + echo ::group::info:inventory |
| 117 | + sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true |
| 118 | + echo ::endgroup:: |
| 119 | +
|
| 120 | + - name: "Honeycomb: Record provision time" |
| 121 | + if: ${{ always() }} |
| 122 | + run: | |
| 123 | + echo ::group::honeycomb |
| 124 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Provision test cluster' |
| 125 | + echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-install >> $GITHUB_ENV |
| 126 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 127 | + echo ::endgroup:: |
| 128 | +
|
| 129 | + - name: 'Install PE on test cluster' |
| 130 | + timeout-minutes: 120 |
| 131 | + run: | |
| 132 | + buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::install_test_cluster' -- \ |
| 133 | + bundle exec bolt plan run peadm_spec::install_test_cluster \ |
| 134 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 135 | + --modulepath spec/fixtures/modules \ |
| 136 | + architecture=${{ matrix.architecture }} \ |
| 137 | + version=${{ matrix.version }} |
| 138 | +
|
| 139 | + - name: "Honeycomb: Record install time" |
| 140 | + if: ${{ always() }} |
| 141 | + run: | |
| 142 | + echo ::group::honeycomb |
| 143 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Install PE on test cluster' |
| 144 | + echo STEP_ID=${{ matrix.architecture }}-${{ matrix.image }}-tear_down >> $GITHUB_ENV |
| 145 | + echo STEP_START=$(date +%s) >> $GITHUB_ENV |
| 146 | + echo ::endgroup:: |
| 147 | +
|
| 148 | + - name: 'Run add_compiler plan' |
| 149 | + timeout-minutes: 30 |
| 150 | + run: | |
| 151 | + buildevents cmd $TRACE_ID $STEP_ID 'bolt plan run peadm_spec::add_compiler' -- \ |
| 152 | + bundle exec bolt plan run peadm_spec::add_compiler -v \ |
| 153 | + --inventoryfile spec/fixtures/litmus_inventory.yaml \ |
| 154 | + --modulepath spec/fixtures/modules \ |
| 155 | + architecture=${{ matrix.architecture }} |
| 156 | +
|
| 157 | + - name: 'Wait as long as the file ${HOME}/pause file is present' |
| 158 | + if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }} |
| 159 | + run: | |
| 160 | + while [ -f "${HOME}/pause" ] ; do |
| 161 | + echo "${HOME}/pause present, sleeping for 60 seconds..." |
| 162 | + sleep 60 |
| 163 | + done |
| 164 | + echo "${HOME}/pause absent, continuing workflow." |
| 165 | +
|
| 166 | + - name: 'Tear down test cluster' |
| 167 | + if: ${{ always() }} |
| 168 | + continue-on-error: true |
| 169 | + run: | |
| 170 | + if [ -f spec/fixtures/litmus_inventory.yaml ]; then |
| 171 | + echo ::group::tear_down |
| 172 | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down' |
| 173 | + echo ::endgroup:: |
| 174 | +
|
| 175 | + echo ::group::info:request |
| 176 | + cat request.json || true; echo |
| 177 | + echo ::endgroup:: |
| 178 | + fi |
| 179 | +
|
| 180 | + - name: "Honeycomb: Record tear down time" |
| 181 | + if: ${{ always() }} |
| 182 | + run: | |
| 183 | + echo ::group::honeycomb |
| 184 | + buildevents step $TRACE_ID $STEP_ID $STEP_START 'Tear down test cluster' |
| 185 | + echo ::endgroup:: |
0 commit comments