Multinode #287
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # This workflow provides a workflow_dispatch (manual) trigger to deploy a | |
| # multi-node test cluster. | |
| name: Multinode | |
| 'on': | |
| workflow_dispatch: | |
| # NOTE: workflow_dispatch is limited to 10 inputs. | |
| inputs: | |
| multinode_name: | |
| description: Multinode cluster name | |
| type: string | |
| required: true | |
| os_distribution: | |
| description: Host OS distribution | |
| type: choice | |
| default: rocky | |
| options: | |
| - rocky | |
| - ubuntu | |
| neutron_plugin: | |
| description: Neutron ML2 plugin | |
| type: choice | |
| default: ovn | |
| options: | |
| - ovn | |
| - ovs | |
| upgrade: | |
| description: Whether to perform an upgrade | |
| default: none | |
| type: choice | |
| options: | |
| - none | |
| - minor | |
| - major | |
| break_on: | |
| description: When to break execution for manual interaction | |
| type: choice | |
| default: never | |
| options: | |
| - always | |
| - failure | |
| - never | |
| - success | |
| break_duration: | |
| description: How long to break execution for (minutes) (note that instances are cleaned up after 12h) | |
| type: number | |
| default: 60 | |
| use_my_ssh_key: | |
| description: authorise my github ssh keys on Ansible control host | |
| default: 'false' | |
| type: boolean | |
| ssh_key: | |
| description: SSH public key to authorise on Ansible control host (if different from github ssh keys) | |
| type: string | |
| terraform_kayobe_multinode_version: | |
| description: terraform-kayobe-multinode version | |
| type: string | |
| default: main | |
| small_cluster: | |
| description: Create cluster with only 1 controller, 1 compute | |
| default: 'false' | |
| type: boolean | |
| jobs: | |
| github_user_ssh_keys: | |
| name: Retrieve actor github ssh keys | |
| runs-on: ubuntu-latest | |
| # Map a step output to a job output, this allows other jobs to be gated on the filter results | |
| outputs: | |
| ssh_keys: ${{ steps.compute_ssh_keys.outputs.ssh_keys }} | |
| steps: | |
| - name: Retrieve github user ssh keys or use provided ones | |
| id: compute_ssh_keys | |
| run: | | |
| # encode array using jq: https://jstrieb.github.io/posts/github-actions-multiline-outputs/ | |
| if ${{ inputs.use_my_ssh_key }} && [ -z "${{ inputs.ssh_key }}" ]; then | |
| echo "Fetching ssh keys for ${{ github.actor }}" | |
| ssh_keys="$(gh api /users/${{ github.actor }}/keys --jq '[.[].key]' | jq --compact-output)" | |
| if [ -z "${ssh_keys}" ]; then | |
| echo "E: Unable to get '${{ github.actor }}' ssh keys (quotes added for clarity)" | |
| exit 1 | |
| fi | |
| elif [ -n "${{ inputs.ssh_key }}" ]; then | |
| # single string to JSON array | |
| ssh_keys="$(jq --raw-input --compact-output '.|[.]' <<<"${{ inputs.ssh_key }}")" | |
| else | |
| ssh_keys='' | |
| fi | |
| echo "ssh_keys=${ssh_keys}" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Show ssh_keys | |
| run: | | |
| echo "${{ steps.compute_ssh_keys.outputs.ssh_keys }}" | |
| multinode: | |
| name: Multinode | |
| needs: github_user_ssh_keys | |
| uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@multi_ssh_keys | |
| with: | |
| multinode_name: ${{ inputs.multinode_name }} | |
| os_distribution: ${{ inputs.os_distribution }} | |
| os_release: ${{ inputs.os_distribution == 'rocky' && '9' || 'noble' }} | |
| ssh_username: ${{ inputs.os_distribution == 'rocky' && 'cloud-user' || 'ubuntu' }} | |
| neutron_plugin: ${{ inputs.neutron_plugin }} | |
| upgrade: ${{ inputs.upgrade }} | |
| break_on: ${{ inputs.break_on }} | |
| # Workaround loss of number type using fromJSON: https://github.com/orgs/community/discussions/67182 | |
| break_duration: ${{ fromJSON(inputs.break_duration) }} | |
| ssh_keys: ${{ needs.github_user_ssh_keys.outputs.ssh_keys }} | |
| stackhpc_kayobe_config_version: ${{ github.ref_name }} | |
| # NOTE(upgrade): Reference the PREVIOUS and CURRENT releases here. | |
| stackhpc_kayobe_config_previous_version: ${{ inputs.upgrade == 'major' && 'stackhpc/2024.1' || 'stackhpc/2025.1' }} | |
| terraform_kayobe_multinode_version: ${{ inputs.terraform_kayobe_multinode_version }} | |
| multinode_controller_count: ${{ inputs.small_cluster && 1 || 3 }} | |
| multinode_compute_count: ${{ inputs.small_cluster && 1 || 3 }} | |
| secrets: inherit |