-
Notifications
You must be signed in to change notification settings - Fork 23
Multinode workflow: use github user's ssh key #2036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
elelaysh
wants to merge
3
commits into
stackhpc/2025.1
Choose a base branch
from
feat/workflow-multinode-github-user
base: stackhpc/2025.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+38
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,17 +46,52 @@ name: Multinode | |
| 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: 'true' | ||
| type: boolean | ||
| ssh_key: | ||
| description: SSH public key to authorise on Ansible control host | ||
| 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 | ||
| 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 | ||
| uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.5.0 | ||
| needs: github_user_ssh_keys | ||
| uses: stackhpc/stackhpc-openstack-gh-workflows/.github/workflows/multinode.yml@1.6.0 | ||
| with: | ||
| multinode_name: ${{ inputs.multinode_name }} | ||
| os_distribution: ${{ inputs.os_distribution }} | ||
|
|
@@ -67,7 +102,7 @@ jobs: | |
| 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_key: ${{ inputs.ssh_key }} | ||
| ssh_keys: ${{ needs.github_user_ssh_keys.outputs.ssh_keys }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we're no longer passing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 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' }} | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an important change going under the radar. What's actually included here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the support for the
ssh_keysinput in our multinode generic workflow.Please see stackhpc/stackhpc-openstack-gh-workflows#17