orchestrator-setup/resources/workflows/ccp_demo/build-runtimes.json

90 lines
2.3 KiB
JSON

{
"ownerApp" : "Cloud Computation Platform",
"name" : "ccp_build_runtime",
"createBy" : "Marco Lettere",
"description": "Build a runtime to be used in the gCube Cloud Computation Platform",
"version" : 10,
"ownerEmail" : "m.lettere@gmail.com",
"inputParameters" : ["runtime", "runtime-descriptor-endpoint", "runtime-status-endpoint"],
"tasks" : [
{
"name": "LAMBDA_TASK",
"taskReferenceName": "init",
"type": "LAMBDA",
"inputParameters": {
"descriptor_url" : "${workflow.input.runtime-descriptor-endpoint}",
"scriptExpression": "1"
}
},
{
"name" : "pyrest",
"taskReferenceName" : "update_status_building",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${workflow.input.runtime-status-endpoint}",
"method" : "put",
"body" : { "status" : "BUILDING"}
}
},
{
"name" : "pyexec",
"taskReferenceName" : "fetch_descriptor_and_build",
"type" : "SIMPLE",
"inputParameters" : {
"operation" : "Shell",
"commands" : [
{ "line" : "curl ${init.input.descriptor_url} -o /tmp/runtime${workflow.input.runtime}.json"},
{ "line" : "sudo packer build /tmp/runtime${workflow.input.runtime}.json"}
]
}
},
{
"name": "decide_task",
"taskReferenceName": "decide1",
"inputParameters": {
"case_value_param": "${fetch_descriptor_and_build.output.status}"
},
"type": "DECISION",
"caseValueParam": "case_value_param",
"defaultCase" : [
{
"name" : "pyrest",
"taskReferenceName" : "update_status_ready",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${workflow.input.runtime-status-endpoint}",
"method" : "put",
"body" : { "status" : "NONE"}
}
}
],
"decisionCases": {
"COMPLETED": [
{
"name" : "pyrest",
"taskReferenceName" : "update_status_ready",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${workflow.input.runtime-status-endpoint}",
"method" : "put",
"body" : { "status" : "READY"}
}
}
],
"FAILED": [
{
"name" : "pyrest",
"taskReferenceName" : "update_status_failed",
"type" : "SIMPLE",
"inputParameters" : {
"url" : "${workflow.input.runtime-status-endpoint}",
"method" : "put",
"body" : { "status" : "FAILED"}
}
}
]
}
}
]
}