-
Notifications
You must be signed in to change notification settings - Fork 27
Pass context params from an execution to a workfflow exeuction #426
Conversation
Signed-off-by: Roy Golan <rgolan@redhat.com>
Enable using arguments from different another execution to use its execution level parameters. This could be used when an assessment workflow gathers inormation and stores it on the context and then when invoking a follow up workflow from the options of that assessment then the requester can pass the execution ID of the assessment. The data flow looks like that: Start -> Asssessment flow -> addParameter "foo": "bar" to WorkContext -> End with option 1 Start -> Workflow from option 1 -> use Workcontext param "foo" -> work -> End The invoking execution ID isn't stored in the DB, it is just a request argument passed in the POST request for invoking a workflow. Signed-off-by: Roy Golan <rgolan@redhat.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/WIP don't merge yet, needs testing |
/WIP |
/hold needs testing |
@@ -76,9 +77,10 @@ public void createFails() { | |||
public void createCompletes() { | |||
ctx.put("applicationName", APP_NAME); | |||
ctx.put("repositoryURL", REPO_URL); | |||
ctx.put("branch", REPO_URL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be a branch name (e.g. main/dev)
* The ID of the flow that lead to execution of this workflow. Useful for passing | ||
* context from execution to execution | ||
*/ | ||
private UUID invokingExecutionID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls rename to invokingExecutionId (lowe d at the end to match convention projectId
, workflowExecutionId
...)
@@ -66,6 +72,8 @@ public static class WorkRequestDTO { | |||
// recursive works | |||
List<WorkRequestDTO> works; | |||
|
|||
UUID invokingExecutionID; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need it on work-unit level.
The context is expected to be shared - so should be set only on the top level.
*/ | ||
private void mergeContextArgumentsFromExecution(UUID executionId, WorkContext target) { | ||
WorkFlowExecution invokedBy = workFlowRepository.getById(executionId); | ||
if (invokedBy != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest wrapping this with com.redhat.parodos.common.exceptions.ResourceNotFoundException
in case of failure to find it.
the global exception handler will know to handle it properly.
@@ -1603,6 +1603,10 @@ | |||
"$ref" : "#/components/schemas/ArgumentRequestDTO" | |||
} | |||
}, | |||
"invokingExecutionID" : { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the name :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Closed since was merged by #433 |
FLPATH-458