|
|
|
@ -6,16 +6,17 @@
|
|
|
|
|
"version": 1,
|
|
|
|
|
"tasks": [
|
|
|
|
|
{
|
|
|
|
|
"name": "LAMBDA_TASK",
|
|
|
|
|
"name": "INLINE_TASK",
|
|
|
|
|
"taskReferenceName": "init",
|
|
|
|
|
"inputParameters": {
|
|
|
|
|
"keycloak": "{{ keycloak }}/{{ keycloak_realm }}",
|
|
|
|
|
"keycloak_admin": "{{ keycloak_admin }}/{{ keycloak_realm }}",
|
|
|
|
|
"ctx": "${workflow.input.context}",
|
|
|
|
|
"jupyterhub_clientid" : "jupyterhub-prod",
|
|
|
|
|
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.ctx)) throw('Context must not be empty'); else return { encoded_context : $.ctx.replaceAll('/', '%2F')}"
|
|
|
|
|
"evaluatorType" : "javascript",
|
|
|
|
|
"expression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; function f(){if(e($.ctx)) throw('Context must not be empty'); else return { encoded_context : $.ctx.replaceAll('/', '%2F')}} f()"
|
|
|
|
|
},
|
|
|
|
|
"type": "LAMBDA",
|
|
|
|
|
"type": "INLINE",
|
|
|
|
|
"decisionCases": {},
|
|
|
|
|
"defaultCase": [],
|
|
|
|
|
"forkTasks": [],
|
|
|
|
@ -247,13 +248,14 @@
|
|
|
|
|
"loopOver": []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"name": "LAMBDA_TASK",
|
|
|
|
|
"name": "INLINE_TASK",
|
|
|
|
|
"taskReferenceName": "check",
|
|
|
|
|
"inputParameters": {
|
|
|
|
|
"evaluatorType" : "javascript",
|
|
|
|
|
"param": "ok",
|
|
|
|
|
"scriptExpression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; if(e($.param)) throw('Param must not be empty'); else return $.param"
|
|
|
|
|
"expression": "function e(v){ return (v == null || (v.trim && v.trim() === ''))}; function(){if(e($.param)) throw('Param must not be empty'); else return $.param} f()"
|
|
|
|
|
},
|
|
|
|
|
"type": "LAMBDA",
|
|
|
|
|
"type": "INLINE",
|
|
|
|
|
"decisionCases": {},
|
|
|
|
|
"defaultCase": [],
|
|
|
|
|
"forkTasks": [],
|
|
|
|
@ -265,15 +267,16 @@
|
|
|
|
|
"loopOver": []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"name": "LAMBDA_TASK",
|
|
|
|
|
"name": "INLINE_TASK",
|
|
|
|
|
"taskReferenceName": "filter_and_update",
|
|
|
|
|
"inputParameters": {
|
|
|
|
|
"evaluatorType" : "javascript",
|
|
|
|
|
"allowed": "${extract_authids.output.result}",
|
|
|
|
|
"res": "${lookup_jupyterhub_resources.output.body}",
|
|
|
|
|
"ctx": "${init.output.result.encoded_context}",
|
|
|
|
|
"scriptExpression": "var ret = []; for(var r=0; r < $.res.length; r++){ if($.allowed.indexOf($.res[r].name) !== -1){ $.res[r].attributes[$.ctx] = Java.to(['true'], 'java.lang.String[]'); ret.push($.res[r]) } } return Java.to(ret, 'java.util.Map[]')"
|
|
|
|
|
"expression": "var ret = []; function() f(){for(var r=0; r < $.res.length; r++){ if($.allowed.indexOf($.res[r].name) !== -1){ $.res[r].attributes[$.ctx] = Java.to(['true'], 'java.lang.String[]'); ret.push($.res[r]) } } return Java.to(ret, 'java.util.Map[]')} f()"
|
|
|
|
|
},
|
|
|
|
|
"type": "LAMBDA",
|
|
|
|
|
"type": "INLINE",
|
|
|
|
|
"decisionCases": {},
|
|
|
|
|
"defaultCase": [],
|
|
|
|
|
"forkTasks": [],
|
|
|
|
@ -285,14 +288,15 @@
|
|
|
|
|
"loopOver": []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"name": "LAMBDA_TASK",
|
|
|
|
|
"name": "INLINE_TASK",
|
|
|
|
|
"taskReferenceName": "build_parallel_tasks",
|
|
|
|
|
"inputParameters": {
|
|
|
|
|
"evaluatorType" : "javascript",
|
|
|
|
|
"res": "${filter_and_update.output.result}",
|
|
|
|
|
"url": "${init.input.keycloak_admin}/clients/${lookup_jupyterhub.output.body[0].id}/authz/resource-server/resource/",
|
|
|
|
|
"scriptExpression": "inputs = {}, tasks = [];for (var i = 0; i < $.res.length; i++){s = $.res[i];tasks.push({name: 'pyrest',type: 'SIMPLE',taskReferenceName: 't' + i});inputs['t' + i] = {url: $.url + $.res[i]._id,method: 'PUT', body: $.res[i], headers: {Authorization: 'Bearer ${authorize.output.body.access_token}', 'Content-Type': 'application/json'}}};return {tasks: Java.to(tasks, 'java.util.Map[]'),inputs: inputs};"
|
|
|
|
|
"expression": "inputs = {}, tasks = [];function(){for (var i = 0; i < $.res.length; i++){s = $.res[i];tasks.push({name: 'pyrest',type: 'SIMPLE',taskReferenceName: 't' + i});inputs['t' + i] = {url: $.url + $.res[i]._id,method: 'PUT', body: $.res[i], headers: {Authorization: 'Bearer ${authorize.output.body.access_token}', 'Content-Type': 'application/json'}}};return {tasks: Java.to(tasks, 'java.util.Map[]'),inputs: inputs};} f()"
|
|
|
|
|
},
|
|
|
|
|
"type": "LAMBDA",
|
|
|
|
|
"type": "INLINE",
|
|
|
|
|
"decisionCases": {},
|
|
|
|
|
"defaultCase": [],
|
|
|
|
|
"forkTasks": [],
|
|
|
|
@ -335,8 +339,9 @@
|
|
|
|
|
"inputParameters": {
|
|
|
|
|
"tasks": "${join_parallel_tasks.input.*}"
|
|
|
|
|
},
|
|
|
|
|
"type": "DECISION",
|
|
|
|
|
"caseExpression": "($.tasks.length > 0 ? 'true' : 'false')",
|
|
|
|
|
"type": "SWITCH",
|
|
|
|
|
"evaluatorType" : "javascript",
|
|
|
|
|
"expression": "($.tasks.length > 0 ? 'true' : 'false')",
|
|
|
|
|
"decisionCases": {
|
|
|
|
|
"true": [
|
|
|
|
|
{
|
|
|
|
|