tripleo-common/workbooks/validations.yaml
Jose Luis Franco Arza 1d17a99925 Improve validations output for troubleshooting.
Currently, the tripleo validations are being used to
evaluate the status of the environment before/after
certain steps (post-deploy, pre-upgrade, post-upgrade)
However, when obtaining the workflow execution output,
if some of the validations failed there is no information
about which one, and the reason behind.

This patch allows identifying the validation being run
in the run_validation action and publishes the results
for the group or list of validations being run in the
run_validations and run_validation_group workflows.

Change-Id: I81ba3a8c287712e0248476e64da0136fc09e26d5
Story: #2002911
2018-10-07 03:09:11 +00:00

323 lines
9.0 KiB
YAML

---
version: '2.0'
name: tripleo.validations.v1
description: TripleO Validations Workflows v1
workflows:
run_validation:
input:
- validation_name
- plan: overcloud
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
notify_running:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: RUNNING
execution: <% execution() %>
plan_name: <% $.plan %>
payload:
validation_name: <% $.validation_name %>
plan: <% $.plan %>
on-complete: run_validation
run_validation:
on-success: send_message
on-error: set_status_failed
action: tripleo.validations.run_validation validation=<% $.validation_name %> plan=<% $.plan %>
publish:
status: SUCCESS
validation: <% $.validation_name %>
stdout: <% task().result.stdout %>
stderr: <% task().result.stderr %>
set_status_failed:
on-complete: send_message
publish:
status: FAILED
validation: <% $.validation_name %>
stdout: <% task(run_validation).result.stdout %>
stderr: <% task(run_validation).result.stderr %>
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
execution: <% execution() %>
plan_name: <% $.plan %>
payload:
validation_name: <% $.validation_name %>
plan: <% $.plan %>
stdout: <% $.stdout %>
stderr: <% $.stderr %>
run_validations:
input:
- validation_names: []
- plan: overcloud
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
notify_running:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: RUNNING
execution: <% execution() %>
plan_name: <% $.plan %>
payload:
validation_names: <% $.validation_names %>
plan: <% $.plan %>
on-complete: run_validations
run_validations:
on-success: send_message
on-error: set_status_failed
workflow: tripleo.validations.v1.run_validation
input:
validation_name: <% $.validation %>
plan: <% $.plan %>
queue_name: <% $.queue_name %>
with-items: validation in <% $.validation_names %>
publish:
status: SUCCESS
message: <% task().result %>
set_status_failed:
on-complete: send_message
publish:
status: FAILED
message: <% task(run_validations).result.where($.status = 'FAILED') %>
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
plan_name: <% $.plan %>
payload:
validation_names: <% $.validation_names %>
plan: <% $.plan %>
run_groups:
input:
- group_names: []
- plan: overcloud
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
find_validations:
on-success: notify_running
action: tripleo.validations.list_validations plan=<% $.plan %> groups=<% $.group_names %>
publish:
validations: <% task().result %>
notify_running:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: RUNNING
execution: <% execution() %>
plan_name: <% $.plan %>
payload:
group_names: <% $.group_names %>
validation_names: <% $.validations %>
plan: <% $.plan %>
on-complete: run_validation_group
run_validation_group:
on-success: send_message
on-error: set_status_failed
workflow: tripleo.validations.v1.run_validation
input:
validation_name: <% $.validation %>
plan: <% $.plan %>
queue_name: <% $.queue_name %>
with-items: validation in <% $.validations.id %>
publish:
status: SUCCESS
message: <% task().result %>
set_status_failed:
on-complete: send_message
publish:
status: FAILED
message: <% task(run_validation_group).result.where($.status = 'FAILED') %>
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
plan_name: <% $.plan %>
payload:
group_names: <% $.group_names %>
validation_names: <% $.validations %>
plan: <% $.plan %>
list:
input:
- group_names: []
- plan: overcloud
output:
validations: <% $.validations %>
tags:
- tripleo-common-managed
tasks:
find_validations:
on-success: send_message
action: tripleo.validations.list_validations plan=<% $.plan %> groups=<% $.group_names %>
publish:
status: SUCCESS
message: <% task().result %>
validations: <% task().result %>
publish-on-error:
status: FAILED
message: <% task().result %>
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution() %>
status: <% $.status %>
message: <% $.get('message', '') %>
payload:
validations: <% $.get('validations', []) %>
list_groups:
input:
- plan: overcloud
output:
groups: <% task(find_groups).result %>
tags:
- tripleo-common-managed
tasks:
find_groups:
action: tripleo.validations.list_groups plan=<% $.plan %>
add_validation_ssh_key_parameter:
input:
- container
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
test_validations_enabled:
action: tripleo.validations.enabled
on-success: get_pubkey
on-error: unset_validation_key_parameter
get_pubkey:
action: tripleo.validations.get_pubkey
on-success: set_validation_key_parameter
publish:
pubkey: <% task().result %>
set_validation_key_parameter:
action: tripleo.parameters.update
input:
parameters:
node_admin_extra_ssh_keys: <% $.pubkey %>
container: <% $.container %>
# NOTE(shadower): We need to clear keys from a previous deployment
unset_validation_key_parameter:
action: tripleo.parameters.update
input:
parameters:
node_admin_extra_ssh_keys: ""
container: <% $.container %>
copy_ssh_key:
input:
# FIXME: we should stop using heat-admin as e.g. split-stack
# environments (where Nova didn't create overcloud nodes) don't
# have it present
- overcloud_admin: heat-admin
- queue_name: tripleo
tags:
- tripleo-common-managed
tasks:
get_servers:
action: nova.servers_list
on-success: get_pubkey
publish:
servers: <% task().result._info %>
get_pubkey:
action: tripleo.validations.get_pubkey
on-success: deploy_ssh_key
publish:
pubkey: <% task().result %>
deploy_ssh_key:
workflow: tripleo.deployment.v1.deploy_on_server
with-items: server in <% $.servers %>
input:
server_name: <% $.server.name %>
server_uuid: <% $.server.id %>
config: |
#!/bin/bash
if ! grep "<% $.pubkey %>" /home/<% $.overcloud_admin %>/.ssh/authorized_keys; then
echo "<% $.pubkey %>" >> /home/<% $.overcloud_admin %>/.ssh/authorized_keys
fi
config_name: copy_ssh_key
group: script
queue_name: <% $.queue_name %>
upload_validations:
tags:
- tripleo-common-managed
input:
- queue_name: tripleo
tasks:
upload_validations:
action: tripleo.validations.upload
on-complete: send_message
publish-on-error:
status: FAILED
message: <% task().result %>
publish:
status: SUCCESS
message: <% task().result %>
send_message:
workflow: tripleo.messaging.v1.send
input:
queue_name: <% $.queue_name %>
type: <% execution().name %>
status: <% $.status %>
execution: <% execution() %>
message: <% $.get('message', '') %>