Skip to content

Issue-3938 Upgrade the Knative custom functions to have visibility over the returned status code and headers#3939

Open
oEscal wants to merge 47 commits intoapache:mainfrom
oEscal:feature/3938
Open

Issue-3938 Upgrade the Knative custom functions to have visibility over the returned status code and headers#3939
oEscal wants to merge 47 commits intoapache:mainfrom
oEscal:feature/3938

Conversation

@oEscal
Copy link
Copy Markdown
Contributor

@oEscal oEscal commented May 23, 2025

Implementation for the feature proposal #3938.

oEscal added 5 commits May 16, 2025 12:21
Signed-off-by: Pedro Escaleira <pedroescaleira@hotmail.com>
…not fail for error response status code when developers choose to do so

Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
…to not fail for error response status code when developers choose to do so

Signed-off-by: Pedro Escaleira <pedroescaleira@hotmail.com>
@oEscal oEscal marked this pull request as draft May 23, 2025 17:39
@oEscal
Copy link
Copy Markdown
Contributor Author

oEscal commented May 23, 2025

This implementation is still a draft, as I think some tests should be created.

Moreover, it uses the implementation from #3939 and #3927.

oEscal and others added 19 commits May 28, 2025 17:52
…CloudEvents and GET requests; created integration tests accordingly

Signed-off-by: Pedro Escaleira <pedroescaleira@hotmail.com>
Signed-off-by: Pedro Escaleira <pedroescaleira@hotmail.com>
Signed-off-by: Pedro Escaleira <pedroescaleira@hotmail.com>
Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
Signed-off-by: escaleira <escaleira@av.it.pt>
Signed-off-by: escaleira <escaleira@av.it.pt>
Signed-off-by: Pedro Escaleira <escaleira@av.it.pt>
@kie-ci3
Copy link
Copy Markdown
Contributor

kie-ci3 commented Jun 3, 2025

PR job #6 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u #3939 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3939/6/display/redirect

Test results:

  • PASSED: 3603
  • FAILED: 1

Those are the test failures:

org.kie.kogito.codegen.rules.PublishEventBusinessRuleIT.testBusinessRuleProcessStartToEndWithVariableTracked
Expected size: 10 but was: 21 in:
[ProcessInstanceStateDataEvent {specVersion=1.0, id='af588a8e-9ced-4411-809f-6ac97b9bd118', source=http://myhost/TimerProcess, type='ProcessInstanceStateDataEvent', time=2025-06-03T12:44:22.400061170-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, processVersion=1.0, processType=BPMN, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, businessKey=null, processName=TimerProcess, parentInstanceId=null, rootProcessId=null, rootProcessInstanceId=null, state=1, roles=null, cloudEventId=null ,cloudEventSource=null], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='4e0d8e2c-9beb-4e30-b752-950f56bd5cac', source=http://myhost/TimerProcess, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.397191147-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, processVersion=1.0, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, connectionNodeInstanceId=null, nodeDefinitionId=_F9AC8B12-8E75-49B5-B799-292F66270627, nodeName=start, nodeType=StartNode, nodeInstanceId=a1107256-135d-4ac1-bba8-ee7e8c95e64f, data={}], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='d6230edc-fd05-43b6-adea-b4114b0b8642', source=http://myhost/TimerProcess, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.397400240-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, processVersion=1.0, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, connectionNodeInstanceId=SequenceFlow_2, nodeDefinitionId=_E76AD186-6FA6-4378-B45B-C8F73E2C497C, nodeName=timer fired, nodeType=ActionNode, nodeInstanceId=724557b0-7dda-48e1-878a-3dd48897f03d, data={}], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='2205fe24-c3ee-4939-8945-6d7a2c6f96ac', source=http://myhost/TimerProcess, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.397697502-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=defaultPackage.TimerProcess, processVersion=1.0, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, connectionNodeInstanceId=SequenceFlow_1, nodeDefinitionId=UserTask_1, nodeName=User Task 1, nodeType=HumanTaskNode, nodeInstanceId=d6572aab-1ab2-4eeb-af0e-11c65f8b0edb, data={}], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test}},
UserTaskInstanceStateDataEvent {specVersion=1.0, id='f2782372-98aa-43ac-b623-6be6ff734db5', source=/process/null, type='UserTaskInstanceStateDataEvent', time=2025-06-03T12:44:22.398387939-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=UserTaskInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, userTaskDefinitionId=UserTask_1, userTaskInstanceId=d7c1987a-c75d-42e8-8da4-78d481339714, userTaskName=Task Name, userTaskDescription=null, userTaskPriority=1, userTaskReferenceName=User Task 1, state=Created, actualOwner=null, processInstanceId=null, slaDueDate=null], kogitoProcessInstanceId='null', kogitoRootProcessInstanceId='null', kogitoProcessId='null', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitousertaskist=Created, kogitoprocrefid=User Task 1, kogitoprocist=null, kogitoaddons=test, kogitousertaskiid=d7c1987a-c75d-42e8-8da4-78d481339714}},
UserTaskInstanceStateDataEvent {specVersion=1.0, id='f039c0cc-520c-4f79-96f6-314c5b135045', source=/process/null, type='UserTaskInstanceStateDataEvent', time=2025-06-03T12:44:22.398568748-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=UserTaskInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, userTaskDefinitionId=UserTask_1, userTaskInstanceId=d7c1987a-c75d-42e8-8da4-78d481339714, userTaskName=Task Name, userTaskDescription=null, userTaskPriority=1, userTaskReferenceName=User Task 1, state=Created, actualOwner=null, processInstanceId=null, slaDueDate=null], kogitoProcessInstanceId='null', kogitoRootProcessInstanceId='null', kogitoProcessId='null', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitousertaskist=Created, kogitoprocrefid=User Task 1, kogitoprocist=null, kogitoaddons=test, kogitousertaskiid=d7c1987a-c75d-42e8-8da4-78d481339714}},
UserTaskInstanceStateDataEvent {specVersion=1.0, id='c9b5f10f-ac95-404c-b416-0f90189d7e50', source=/process/null, type='UserTaskInstanceStateDataEvent', time=2025-06-03T12:44:22.398735431-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=UserTaskInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, userTaskDefinitionId=UserTask_1, userTaskInstanceId=d7c1987a-c75d-42e8-8da4-78d481339714, userTaskName=Task Name, userTaskDescription=null, userTaskPriority=1, userTaskReferenceName=User Task 1, state=Created, actualOwner=null, processInstanceId=null, slaDueDate=null], kogitoProcessInstanceId='null', kogitoRootProcessInstanceId='null', kogitoProcessId='null', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitousertaskist=Created, kogitoprocrefid=User Task 1, kogitoprocist=null, kogitoaddons=test, kogitousertaskiid=d7c1987a-c75d-42e8-8da4-78d481339714}},
UserTaskInstanceStateDataEvent {specVersion=1.0, id='c2af4b76-10a5-45b5-b6fc-01151dd58f11', source=http://myhost/TimerProcess, type='UserTaskInstanceStateDataEvent', time=2025-06-03T12:44:22.398993017-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=UserTaskInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, userTaskDefinitionId=UserTask_1, userTaskInstanceId=d7c1987a-c75d-42e8-8da4-78d481339714, userTaskName=Task Name, userTaskDescription=null, userTaskPriority=1, userTaskReferenceName=User Task 1, state=Created, actualOwner=null, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, slaDueDate=null], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitousertaskist=Created, kogitoprocrefid=User Task 1, kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test, kogitousertaskiid=d7c1987a-c75d-42e8-8da4-78d481339714}},
UserTaskInstanceStateDataEvent {specVersion=1.0, id='6183ac9e-bfa4-46a9-89bc-2de0ab0c73ee', source=http://myhost/TimerProcess, type='UserTaskInstanceStateDataEvent', time=2025-06-03T12:44:22.399483662-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=UserTaskInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, userTaskDefinitionId=UserTask_1, userTaskInstanceId=d7c1987a-c75d-42e8-8da4-78d481339714, userTaskName=Task Name, userTaskDescription=null, userTaskPriority=1, userTaskReferenceName=User Task 1, state=Ready, actualOwner=null, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, slaDueDate=null], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitousertaskist=Ready, kogitoprocrefid=User Task 1, kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test, kogitousertaskiid=d7c1987a-c75d-42e8-8da4-78d481339714}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='61cf8e33-a879-4da6-a12d-7a91a80dfb59', source=http://myhost/TimerProcess, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.399774879-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=2, processId=defaultPackage.TimerProcess, processVersion=1.0, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, connectionNodeInstanceId=SequenceFlow_1, nodeDefinitionId=_E76AD186-6FA6-4378-B45B-C8F73E2C497C, nodeName=timer fired, nodeType=ActionNode, nodeInstanceId=724557b0-7dda-48e1-878a-3dd48897f03d, data={}], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='44924884-e8b3-436c-b27d-c145dc069669', source=http://myhost/TimerProcess, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.399923905-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=2, processId=defaultPackage.TimerProcess, processVersion=1.0, processInstanceId=2c005c38-45c3-408c-8ae6-1e3486d89c9d, connectionNodeInstanceId=SequenceFlow_2, nodeDefinitionId=_F9AC8B12-8E75-49B5-B799-292F66270627, nodeName=start, nodeType=StartNode, nodeInstanceId=a1107256-135d-4ac1-bba8-ee7e8c95e64f, data={}], kogitoProcessInstanceId='2c005c38-45c3-408c-8ae6-1e3486d89c9d', kogitoRootProcessInstanceId='null', kogitoProcessId='defaultPackage.TimerProcess', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=2c005c38-45c3-408c-8ae6-1e3486d89c9d, kogitoprocist=1, kogitoprocversion=1.0, kogitoprocid=defaultPackage.TimerProcess, kogitoaddons=test}},
ProcessInstanceStateDataEvent {specVersion=1.0, id='610b2556-feac-43de-96db-6bafd5522f17', source=http://myhost/BusinessRuleTask, type='ProcessInstanceStateDataEvent', time=2025-06-03T12:44:22.722363903-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=BusinessRuleTask, processVersion=1, processType=BPMN, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, businessKey=null, processName=Default Process, parentInstanceId=null, rootProcessId=null, rootProcessInstanceId=null, state=1, roles=null, cloudEventId=null ,cloudEventSource=null], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=2, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceVariableDataEvent {specVersion=1.0, id='ed82f224-8009-4d1a-8e0f-562fe92c622f', source=http://myhost/BusinessRuleTask, type='ProcessInstanceVariableDataEvent', time=2025-06-03T12:44:22.385535015-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceVariableEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, nodeContainerDefinitionId=null, nodeContainerInstanceId=null, variableId=person, variableName=person, variableValue=Person{name='john', age=25, adult=true}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=0, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='4d708aae-28a5-40aa-984e-dff403615038', source=http://myhost/BusinessRuleTask, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.386360060-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, connectionNodeInstanceId=null, nodeDefinitionId=StartEvent_1, nodeName=Start, nodeType=StartNode, nodeInstanceId=e8da7fe7-a75c-4d18-a807-896a9f988163, data={}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=1, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='3361a36d-5108-4253-b9f0-47d2d3e86f63', source=http://myhost/BusinessRuleTask, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.386620573-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, connectionNodeInstanceId=SequenceFlow_2, nodeDefinitionId=BusinessRuleTask_2, nodeName=Business Rule Task, nodeType=RuleSetNode, nodeInstanceId=e39144aa-2bcb-43ab-b0fe-1489ca7d2b4c, data={}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=1, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceVariableDataEvent {specVersion=1.0, id='f019cc9d-5b3a-4145-81d1-1dfee42572e0', source=http://myhost/BusinessRuleTask, type='ProcessInstanceVariableDataEvent', time=2025-06-03T12:44:22.720180906-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceVariableEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, nodeContainerDefinitionId=null, nodeContainerInstanceId=null, variableId=person, variableName=person, variableValue=Person{name='john', age=25, adult=true}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=1, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='aa3d1314-61c2-4398-b2d9-d03d03668d01', source=http://myhost/BusinessRuleTask, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.720465395-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=1, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, connectionNodeInstanceId=SequenceFlow_1, nodeDefinitionId=EndEvent_1, nodeName=End, nodeType=EndNode, nodeInstanceId=adbe5dd1-097c-4249-9a2e-0e24be89793d, data={}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=1, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='3906cbb9-e37b-41c0-949d-8e395d224ebd', source=http://myhost/BusinessRuleTask, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.720828262-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=2, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, connectionNodeInstanceId=null, nodeDefinitionId=EndEvent_1, nodeName=End, nodeType=EndNode, nodeInstanceId=adbe5dd1-097c-4249-9a2e-0e24be89793d, data={}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=2, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='18381e9e-42b5-4483-95fd-c75a87a35a3c', source=http://myhost/BusinessRuleTask, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.720958486-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=2, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, connectionNodeInstanceId=SequenceFlow_1, nodeDefinitionId=BusinessRuleTask_2, nodeName=Business Rule Task, nodeType=RuleSetNode, nodeInstanceId=e39144aa-2bcb-43ab-b0fe-1489ca7d2b4c, data={}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=2, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceNodeDataEvent {specVersion=1.0, id='75b1eb3d-552c-4ebb-9e67-aaa350bc4ec3', source=http://myhost/BusinessRuleTask, type='ProcessInstanceNodeDataEvent', time=2025-06-03T12:44:22.722243553-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceNodeEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=2, processId=BusinessRuleTask, processVersion=1, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, connectionNodeInstanceId=SequenceFlow_2, nodeDefinitionId=StartEvent_1, nodeName=Start, nodeType=StartNode, nodeInstanceId=e8da7fe7-a75c-4d18-a807-896a9f988163, data={}], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=2, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}},
ProcessInstanceStateDataEvent {specVersion=1.0, id='df598170-5f2e-4c77-a15a-604b46b09caa', source=http://myhost/BusinessRuleTask, type='ProcessInstanceStateDataEvent', time=2025-06-03T12:44:22.720707990-04:00, subject='null', dataContentType='application/json', dataSchema=null, data=ProcessInstanceStateEventBody [eventDate=Tue Jun 03 12:44:22 EDT 2025, eventUser=null, eventType=2, processId=BusinessRuleTask, processVersion=1, processType=BPMN, processInstanceId=b316cfbb-7d06-42e4-b546-fddc798ccb67, businessKey=null, processName=Default Process, parentInstanceId=null, rootProcessId=null, rootProcessInstanceId=null, state=2, roles=null, cloudEventId=null ,cloudEventSource=null], kogitoProcessInstanceId='b316cfbb-7d06-42e4-b546-fddc798ccb67', kogitoRootProcessInstanceId='null', kogitoProcessId='BusinessRuleTask', kogitoRootProcessId='null', kogitoAddons='test', kogitoIdentity='null', extensionAttributes={kogitoproctype=BPMN, kogitoprocinstanceid=b316cfbb-7d06-42e4-b546-fddc798ccb67, kogitoprocist=2, kogitoprocversion=1, kogitoprocid=BusinessRuleTask, kogitoaddons=test}}]

Signed-off-by: oEscal <pedroescaleira@hotmail.com>
Signed-off-by: oEscal <pedroescaleira@hotmail.com>
Signed-off-by: oEscal <pedroescaleira@hotmail.com>
…time/src/main/java/org/kie/kogito/serverless/workflow/rest/JsonNodeResultHandler.java

Signed-off-by: oEscal <pedroescaleira@hotmail.com>
…ndler to use the JsonNodeResultHandlerSupplier

Signed-off-by: oEscal <pedroescaleira@hotmail.com>
Signed-off-by: oEscal <pedroescaleira@hotmail.com>
@oEscal oEscal marked this pull request as ready for review October 29, 2025 17:01
@oEscal
Copy link
Copy Markdown
Contributor Author

oEscal commented Oct 29, 2025

The main comment for the PR is in the quarkus/addons/knative/serving/deployment/src/main/java/org/kie/kogito/addons/quarkus/knative/serving/deployment/customfunctions/KnativeTypeHandler.java file.

The other modifications in the PR allow for injecting any headers and queries from the previous state or action. For example, if the prior action's data contains the key HEADER_customheader, HEADER_customheader will not be sent in the request body to the current action. Instead, the action will receive the customheader header. This behavior was partially implemented in the PR, but there, the headers and queries can only be defined within the workflow as developer-provided arguments (the developer must select them before the query or its values).

@kie-ci3
Copy link
Copy Markdown
Contributor

kie-ci3 commented Nov 3, 2025

PR job #1 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-runtimes -u #3939 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/__dev/job/lightguardjp/job/main/job/pullrequest_jobs/job/kogito-runtimes-pr/job/PR-3939/1/display/redirect

Test results:

  • PASSED: 3095
  • FAILED: 2

Those are the test failures:

org.kie.kogito.addons.quarkus.knative.serving.customfunctions.it.KnativeServingAddonIT.(?) java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor#startKeycloakContainer threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image quay.io/keycloak/keycloak:26.1.3
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:250)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
at io.quarkus.builder.BuildContext.run(BuildContext.java:255)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
at java.base/java.lang.Thread.run(Thread.java:840)
at org.jboss.threads.JBossThread.run(JBossThread.java:499)
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image quay.io/keycloak/keycloak:26.1.3
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:346)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.lambda$startContainer$4(KeycloakDevServicesProcessor.java:421)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.startContainer(KeycloakDevServicesProcessor.java:447)
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:200)
... 10 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:331)
... 15 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:551)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:341)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
... 16 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '.*Keycloak.*started.*'
at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:47)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52)
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:904)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:487)
... 18 more
org.kie.kogito.addons.quarkus.kubernetes.ConfigValueExpanderIT.test java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor#startKeycloakContainer threw an exception: java.lang.RuntimeException: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image quay.io/keycloak/keycloak:26.1.3
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:250)
at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856)
at io.quarkus.builder.BuildContext.run(BuildContext.java:255)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
at java.base/java.lang.Thread.run(Thread.java:840)
at org.jboss.threads.JBossThread.run(JBossThread.java:499)
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image quay.io/keycloak/keycloak:26.1.3
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:346)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.lambda$startContainer$4(KeycloakDevServicesProcessor.java:421)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.startContainer(KeycloakDevServicesProcessor.java:447)
at io.quarkus.devservices.keycloak.KeycloakDevServicesProcessor.startKeycloakContainer(KeycloakDevServicesProcessor.java:200)
... 10 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:331)
... 15 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:551)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:341)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
... 16 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for log output matching '.*Keycloak.*started.*'
at org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy.waitUntilReady(LogMessageWaitStrategy.java:47)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52)
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:904)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:487)
... 18 more

@oEscal oEscal requested a review from ricardozanini March 13, 2026 19:43
@oEscal
Copy link
Copy Markdown
Contributor Author

oEscal commented Mar 13, 2026

@ricardozanini @fjtirado @gmunozfe @wmedvede I think this was lost in the backlog. Could you take a look to know if there is anything missing?

Comment on lines +57 to +86
Map<String, Object> inputModel = new HashMap<>();

Object inputModelObject = parameters.get(MODEL_WORKFLOW_VAR);

ObjectNode inputModelCopy = null;
if (inputModelObject instanceof ObjectNode objectNode) {
ObjectMapper mapper = new ObjectMapper();
objectNode.fields().forEachRemaining(entry -> {
JsonNode value = entry.getValue();
Object rawValue = mapper.convertValue(value, Object.class);
inputModel.put(entry.getKey(), rawValue);
});

try {
inputModelCopy = (ObjectNode) mapper.readTree(objectNode.toString());
} catch (JsonProcessingException e) {
throw new RuntimeException("Failed to copy MODEL_WORKFLOW_VAR", e);
}
}

Set<String> paramsRemove = super.extractHeadersQueries(workItem, inputModel, request);
super.decorate(workItem, parameters, request);

if (inputModelCopy != null) {
// mutate the safe copy
inputModelCopy.remove(paramsRemove);

// replace the original entry in parameters with the copy
parameters.put(MODEL_WORKFLOW_VAR, inputModelCopy);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im unable to understand the purpose of this code.
Why do you need to remove properties from the model?
Why can you extract the header parameters directly from the original?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too confusing.
Basically extradHeadersQueries is called twice over the same request, one withe parameters, one with the model, why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented this a long time ago. But from what I remember, this was to avoid sending the headers and queries from the params (HEADER_* and QUERY_*) as arguments to the service when they are already processed as headers and queries. But yes, I agree with you; this is too confusing at the moment. I will find another way of doing this more cleanly.

context.getContext(), String.class, DEFAULT_REQUEST_TIMEOUT_VALUE);

return node.workParameter(RestWorkItemHandler.BODY_BUILDER, new ParamsRestBodyBuilderSupplier())
.workParameter(RestWorkItemHandler.RESULT_HANDLER, new JsonNodeResultHandlerSupplier())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to do that?
How is this change related with the issue description?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was a leftover from the previous implementation where I was not considering the $WORKFLOW variable yet. However, this should be added to the Knative custom function to give control to the developer over the status code, message, and headers. What do you think? Do I create another issue/PR for that?

Copy link
Copy Markdown
Contributor

@fjtirado fjtirado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im unable to see the relationship between these changes and the issue description.
There has to be a far simple way of processing the proposed parameters

Signed-off-by: oEscal <pedroescaleira@hotmail.com>
@oEscal
Copy link
Copy Markdown
Contributor Author

oEscal commented Mar 18, 2026

@fjtirado After studying my implementation with more attention, I now understand what I did better (this was 5 months ago).
The original intention of issue #3938 was to have a way of giving Knative custom functions the visibility over the returned status code (and message), as well as the returned headers. As described in the issue, this could be done using the params failOnStatusError, returnStatusCode, and returnHeaders when defining the function in the workflow, as follows:

"functions": [
    {
      "name": "greet",
      "type": "custom",
      "operation": "knative:services.v1.serving.knative.dev/custom-function-knative-service?failOnStatusError=false&returnStatusCode=true&returnHeaders=false"
    }
  ]

However, after implementing PR #3937, where we discussed using the variable $WORKFLOW to give access to the status code, status message, and response headers, I thought of continuing that implementation here. Therefore, this data could be accessed the same way as with the REST custom function: through the variable $WORKFLOW. Moreover, with the implementation in this PR, we can also define if the function should fail on status code with the key failOnStatusCode defined on the function metadata, as we can already do with the REST custom function. That is the reason for me including this line in the implementation: #3939 (comment).

As for this part of the implementation (#3939 (comment)), I already tried to clarify the implementation and make it more linear. However, this implementation is not completely related to the issue at hand. As I explained in a comment above, it allows to automatically get the HEADER_* or QUERY_* from the body response of the previous function and inject them as headers or queries in the request of the current function. Since this implementation is not completely related to this issue, do you prefer I create another issue that explains it and implement it in a separate PR?

@oEscal oEscal requested a review from fjtirado March 18, 2026 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants