Skip to content

multinode: Add SSH key check and Slack alert #3

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

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/multinode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ on:
ssh_key:
description: SSH public key to authorise on Ansible control host
type: string
enable_slack_alert:
description: Whether to send a Slack message to a channel if the job fails
type: boolean
default: false
secrets:
KAYOBE_VAULT_PASSWORD_CI_MULTINODE:
required: true
Expand All @@ -75,6 +79,8 @@ on:
required: true
OS_APPLICATION_CREDENTIAL_SECRET:
required: true
SLACK_WEBHOOK_URL:
required: false

jobs:
multinode:
Expand All @@ -93,6 +99,12 @@ jobs:
exit 1
if: ${{ inputs.upgrade && inputs.stackhpc_kayobe_config_previous_version == '' }}

- name: Fail if no SSH key is provided for break_on
run: |
echo "break_on is set to ${{ inputs.break_on }} but an SSH public key has not been provided"
exit 1
if: ${{ inputs.break_on != 'never' && inputs.ssh_key == '' }}

- name: Install Package
uses: ConorMacBride/install-package@main
with:
Expand Down Expand Up @@ -353,13 +365,47 @@ jobs:
if: ${{ always() && steps.config_ach.outcome == 'success' }}

- name: Upload test result artifacts
id: upload-results
uses: actions/upload-artifact@v4
with:
name: test-results-multinode-${{ inputs.os_distribution }}-${{ inputs.os_release }}-${{ inputs.neutron_plugin }}${{ inputs.upgrade && '-upgrade' || '' }}
path: |
${{ github.workspace }}/logs/
if: ${{ always() && steps.config_ach.outcome == 'success' }}

- name: Send message to Slack via Workflow Builder
uses: slackapi/[email protected]
with:
payload: |
{
"channel-id": "${{ env.SLACK_CHANNEL_ID }}",
"inputs": "${{ env.INPUTS }}",
"message": "${{ env.MESSAGE }}",
"results-url": "${{ env.RESULTS_URL }}",
"workflow-url": "${{ env.WORKFLOW_URL }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# #release-train-alerts
SLACK_CHANNEL_ID: C03B28HRP53
INPUTS: >-
name: ${{ inputs.multinode_name }}\n
controllers: ${{ inputs.multinode_controller_count }}\n
computes: ${{ inputs.multinode_compute_count }}\n
storage: ${{ inputs.multinode_storage_count }}\n
os_distribution: ${{ inputs.os_distribution }}\n
os_release: ${{ inputs.os_release }}\n
ssh_username: ${{ inputs.ssh_username }}\n
neutron_plugin: ${{ inputs.neutron_plugin }}\n
stackhpc_kayobe_config_version: ${{ inputs.stackhpc_kayobe_config_version }}\n
stackhpc_kayobe_config_previous_version: ${{ inputs.stackhpc_kayobe_config_previous_version }}\n
terraform_kayobe_multinode_version: ${{ inputs.terraform_kayobe_multinode_version }}\n
upgrade: ${{ inputs.upgrade }}\n
MESSAGE: "Multinode workflow failed :sob:"
RESULTS_URL: "${{ steps.upload-results.outputs.artifact-url || 'N/A' }}"
WORKFLOW_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if: ${{ failure() && inputs.enable_slack_alert }}

- name: Break on failure
run: |
sleep ${{ inputs.break_duration }}m
Expand Down