tripleo-common/workbooks/validations.yaml
Gael Chamoulaud 5762772fdf Make validation inputs configurable via Mistral
The validations have certain values (e.g. the amount of RAM necessary
for the undercloud node) configurable, but these were not exposed
through Mistral.

This adds a new `--inputs` parameter to the `run-validation` script
which takes a path to a YAML or JSON file with the additional
inputs (i.e. Ansible extra-args) defined.

And the `run_validation` action now optionally takes an `inputs`
dictionary which gets passed to `run-validation`.

Closes-Bug: #1625547
Implements: blueprint validation-framework
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>

Change-Id: I8944cf7133d47869d26974fd123cd93c98425f17
Co-authored: Tomas Sedovic <tsedovic@redhat.com>
2019-04-01 10:43:11 +00:00

330 lines
9.3 KiB
YAML

---
version: '2.0'
name: tripleo.validations.v1
description: TripleO Validations Workflows v1
workflows:
run_validation:
input:
- validation_name
- plan: overcloud
- validation_inputs: {}
- 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 %> inputs=<% $.validation_inputs %>
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
- validation_inputs: {}
- 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 %>
validation_inputs: <% $.validation_inputs %>
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
- validation_inputs: {}
- 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 %>
validation_inputs: <% $.validation_inputs %>
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
- queue_name: tripleo
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().name %>
execution: <% 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', '') %>