Skip to content

Commit

Permalink
M2K workflow - use K_SINK to produce event instead of rest request to…
Browse files Browse the repository at this point in the history
… broker
  • Loading branch information
gabriel-farache committed Jan 30, 2024
1 parent 4fae4bd commit 4f67e96
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 31 deletions.
2 changes: 2 additions & 0 deletions local_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
buildah build --format=docker -f pipeline/workflow-builder.Dockerfile -t quay.io/gfarache/serverless-workflow-move2kube:test --build-arg WF_RESOURCES=move2kube/ --build-arg QUARKUS_ADD_EXTENSIONS_ARGS=org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:999-SNAPSHOT --ulimit nofile=4096:4096 . && \
buildah push quay.io/gfarache/serverless-workflow-move2kube:test
41 changes: 11 additions & 30 deletions move2kube/m2k.sw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ events:
- name: transformationSavedEvent
source: ''
type: transformation_saved
- name: saveTransformationEvent
source: ''
type: save-transformation
functions:
- name: systemOut
type: custom
Expand All @@ -25,9 +28,6 @@ functions:
- name: startTransformation
type: rest
operation: specs/move2kube.yaml#start-transformation
- name: sendCloudEvent
type: custom
operation: rest:post:http://broker-ingress.knative-eventing.svc.cluster.local/sonataflow-infra/default
- name: createNotification
operation: 'specs/notifications.yaml#createNotification'
states:
Expand Down Expand Up @@ -99,37 +99,18 @@ states:
actions:
- title: "Move2Kube waiting Q&A"
url: "$SECRET.move2kube_url + \"/workspaces/\"+ .workspaceId + \"/projects/\" + .projectId + \"/outputs/\"+ .transformId "
transition: SaveTransformationOutput
- name: SaveTransformationOutput
type: operation
actions:
- functionRef:
refName: sendCloudEvent
arguments:
HEADER_Ce-Id: $WORKFLOW.instanceId
HEADER_Ce-Specversion: "1.0"
HEADER_Ce-Type: "save-transformation"
HEADER_Ce-Source: "m2k_swf"
HEADER_Content-Type: "application/json"
gitRepo: "(.repositoryURL|sub(\"http(s)?://\";\"ssh://\"))"
branch: .targetBranch
token: .token
workspaceId: .workspaceId
projectId: .projectId
transformId: .transformId
workflowCallerId: $WORKFLOW.instanceId
transition: WaitForSaveTransformationCompletion
- name: WaitForSaveTransformationCompletion
transition:
nextState: WaitForSaveTransformationCompletionEvent
produceEvents:
- eventRef: saveTransformationEvent
data: '${{"gitRepo":".repositoryURL", "branch": ".targetBranch", "token": ".token", "workspaceId": ".workspaceId", "projectId": ".projectId", "transformId": ".transformId ", "workflowCallerId": "$WORKFLOW.instanceId"}}'
- name: WaitForSaveTransformationCompletionEvent
type: switch
eventConditions:
- eventRef: transformationSavedEvent
transition: TransformationSaved
- eventRef: errorEvent
transition: TransformationError
defaultCondition:
transition: TransformationError
timeouts:
eventTimeout: PT3M
- eventRef: transformationSavedEvent
transition: TransformationSaved
- name: TransformationSaved
type: inject
data:
Expand Down
2 changes: 1 addition & 1 deletion pipeline/workflow-builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/kiegroup/kogito-swf-builder-nightly:main-2024-01-24 AS builder
FROM quay.io/kiegroup/kogito-swf-builder-nightly:main-2024-01-29 AS builder

# variables that can be overridden by the builder
# To add a Quarkus extension to your application
Expand Down

0 comments on commit 4f67e96

Please sign in to comment.