165 lines
5.4 KiB
JSON
165 lines
5.4 KiB
JSON
|
{
|
||
|
"ownerApp": null,
|
||
|
"createTime": 1664528925940,
|
||
|
"updateTime": 1664532689529,
|
||
|
"createdBy": null,
|
||
|
"updatedBy": null,
|
||
|
"name": "example_workflow",
|
||
|
"description": "Publish to Social pushes on code-repo",
|
||
|
"version": 1,
|
||
|
"tasks": [
|
||
|
{
|
||
|
"name": "Init_Variables",
|
||
|
"taskReferenceName": "init_variables",
|
||
|
"description": null,
|
||
|
"inputParameters": {
|
||
|
"context": "%2Fgcube%2Fdevsec%2FdevVRE",
|
||
|
"client_id" : "conductor_playground",
|
||
|
"client_secret" : "o..D"
|
||
|
},
|
||
|
"type": "SET_VARIABLE"
|
||
|
},
|
||
|
{
|
||
|
"name": "fork_join",
|
||
|
"taskReferenceName": "parallel_execution",
|
||
|
"description": "Fork two parallel flos for demonstration purposes",
|
||
|
"inputParameters": {},
|
||
|
"type": "FORK_JOIN",
|
||
|
"forkTasks": [
|
||
|
[
|
||
|
{
|
||
|
"name": "pyrest",
|
||
|
"taskReferenceName": "auth_info",
|
||
|
"description": null,
|
||
|
"inputParameters": {
|
||
|
"url": "https://accounts.dev.d4science.org/auth/realms/d4science/.well-known/openid-configuration",
|
||
|
"method": "GET",
|
||
|
"headers": {
|
||
|
"Accept": "application/json"
|
||
|
}
|
||
|
},
|
||
|
"type": "SIMPLE"
|
||
|
},
|
||
|
{
|
||
|
"name": "pyrest",
|
||
|
"taskReferenceName": "authorize",
|
||
|
"description": null,
|
||
|
"inputParameters": {
|
||
|
"url": "${auth_info.output.body.token_endpoint}",
|
||
|
"method": "POST",
|
||
|
"headers": {
|
||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||
|
"Accept": "application/json"
|
||
|
},
|
||
|
"body": {
|
||
|
"grant_type": "client_credentials",
|
||
|
"client_id": "${workflow.variables.client_id}",
|
||
|
"client_secret": "${workflow.variables.client_secret}"
|
||
|
}
|
||
|
},
|
||
|
"type": "SIMPLE"
|
||
|
},
|
||
|
{
|
||
|
"name": "pyrest",
|
||
|
"taskReferenceName": "token_exchange",
|
||
|
"description": "Exchange playground token for user token",
|
||
|
"inputParameters": {
|
||
|
"url": "${auth_info.output.body.token_endpoint}",
|
||
|
"headers": {
|
||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||
|
"Accept": "application/json"
|
||
|
},
|
||
|
"body": {
|
||
|
"client_id": "${workflow.variables.client_id}",
|
||
|
"client_secret": "${workflow.variables.client_secret}",
|
||
|
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
|
||
|
"requested_subject": "${workflow.input.pusher.username}",
|
||
|
"request_token_type": "urn:ietf:params:oauth:token-type:access_token"
|
||
|
},
|
||
|
"method": "POST"
|
||
|
},
|
||
|
"type": "SIMPLE"
|
||
|
},
|
||
|
{
|
||
|
"name": "pyrest",
|
||
|
"taskReferenceName": "get_uma_ticket",
|
||
|
"description": "Get uma ticket for specific context",
|
||
|
"inputParameters": {
|
||
|
"url": "${auth_info.output.body.token_endpoint}",
|
||
|
"headers": {
|
||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||
|
"Accept": "application/json",
|
||
|
"Authorization": "Bearer ${token_exchange.output.body.access_token}"
|
||
|
},
|
||
|
"body": {
|
||
|
"grant_type": "urn:ietf:params:oauth:grant-type:uma-ticket",
|
||
|
"audience": "${workflow.variables.context}"
|
||
|
},
|
||
|
"method": "POST"
|
||
|
},
|
||
|
"type": "SIMPLE"
|
||
|
}
|
||
|
],
|
||
|
[
|
||
|
{
|
||
|
"name": "inline_task",
|
||
|
"taskReferenceName": "prepare_message",
|
||
|
"description": null,
|
||
|
"inputParameters": {
|
||
|
"evaluatorType": "javascript",
|
||
|
"expression": "function e(){ return { 'text' : 'New commit from ' + $.pusher + ' on repo ' + $.repo } }; e()",
|
||
|
"pusher": "${workflow.input.pusher.full_name}",
|
||
|
"repo": "${workflow.input.repository.name}"
|
||
|
},
|
||
|
"type": "INLINE"
|
||
|
}
|
||
|
]
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "my_join",
|
||
|
"taskReferenceName": "my_join",
|
||
|
"inputParameters": {},
|
||
|
"type": "JOIN",
|
||
|
"joinOn": [
|
||
|
"get_uma_ticket",
|
||
|
"prepare_message"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"name": "pyrest",
|
||
|
"taskReferenceName": "post_social",
|
||
|
"description": "Post to social service",
|
||
|
"inputParameters": {
|
||
|
"url": "https://api.dev.d4science.org/rest/2/posts/write-post-user",
|
||
|
"headers": {
|
||
|
"Content-Type": "application/json",
|
||
|
"Accept": "application/json",
|
||
|
"Authorization": "Bearer ${get_uma_ticket.output.body.access_token}"
|
||
|
},
|
||
|
"body": {
|
||
|
"text": "${prepare_message.output.result.text}",
|
||
|
"preview_description": "New commit on one CCP repository",
|
||
|
"preview_host": null,
|
||
|
"preview_url": null,
|
||
|
"image_url": "${workflow.input.repository.owner.avatar_url}",
|
||
|
"enable_notification": true
|
||
|
},
|
||
|
"method": "POST"
|
||
|
},
|
||
|
"type": "SIMPLE"
|
||
|
}
|
||
|
],
|
||
|
"inputParameters": [],
|
||
|
"outputParameters": {},
|
||
|
"failureWorkflow": null,
|
||
|
"schemaVersion": 2,
|
||
|
"restartable": true,
|
||
|
"workflowStatusListenerEnabled": false,
|
||
|
"ownerEmail": "m.lettere@gmail.com",
|
||
|
"timeoutPolicy": "ALERT_ONLY",
|
||
|
"timeoutSeconds": 0,
|
||
|
"variables": {},
|
||
|
"inputTemplate": {}
|
||
|
}
|