This is an automated email from the ASF dual-hosted git repository.
wmedvedeo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new 696f7526f94 incubator-kie-tools-3068: Workflow metadata event must use
the sonataflow.org/name annotation instead of SonataFlow.Name (#3070)
696f7526f94 is described below
commit 696f7526f94c29496a9bec2d66023d0caada451b
Author: Walter Medvedeo <[email protected]>
AuthorDate: Thu Apr 17 08:40:16 2025 +0200
incubator-kie-tools-3068: Workflow metadata event must use the
sonataflow.org/name annotation instead of SonataFlow.Name (#3070)
---
packages/sonataflow-operator/api/v1alpha08/conversion.go | 15 ++++++++++++---
.../internal/controller/workflowdef/events.go | 4 +++-
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/packages/sonataflow-operator/api/v1alpha08/conversion.go
b/packages/sonataflow-operator/api/v1alpha08/conversion.go
index 1d85fc46d8f..c8d2530f5a1 100644
--- a/packages/sonataflow-operator/api/v1alpha08/conversion.go
+++ b/packages/sonataflow-operator/api/v1alpha08/conversion.go
@@ -102,9 +102,18 @@ func ToCNCFWorkflow(workflowCR *SonataFlow, context
context.Context) (*cncfmodel
}
cncfWorkflow.ID = workflowCR.ObjectMeta.Name
- cncfWorkflow.Key = workflowCR.ObjectMeta.Annotations[metadata.Key]
- cncfWorkflow.Description =
workflowCR.ObjectMeta.Annotations[metadata.Description]
- cncfWorkflow.Version =
workflowCR.ObjectMeta.Annotations[metadata.Version]
+ if key, ok := workflowCR.ObjectMeta.Annotations[metadata.Key]; ok {
+ cncfWorkflow.Key = key
+ }
+ if name, ok := workflowCR.ObjectMeta.Annotations[metadata.Name]; ok {
+ cncfWorkflow.Name = name
+ }
+ if description, ok :=
workflowCR.ObjectMeta.Annotations[metadata.Description]; ok {
+ cncfWorkflow.Description = description
+ }
+ if version, ok := workflowCR.ObjectMeta.Annotations[metadata.Version];
ok {
+ cncfWorkflow.Version = version
+ }
cncfWorkflow.SpecVersion = extractSpecVersion(workflowCR)
cncfWorkflow.ExpressionLang =
cncfmodel.ExpressionLangType(extractExpressionLang(workflowCR.ObjectMeta.Annotations))
diff --git
a/packages/sonataflow-operator/internal/controller/workflowdef/events.go
b/packages/sonataflow-operator/internal/controller/workflowdef/events.go
index e9f6d831856..7a041eb3cb4 100644
--- a/packages/sonataflow-operator/internal/controller/workflowdef/events.go
+++ b/packages/sonataflow-operator/internal/controller/workflowdef/events.go
@@ -39,7 +39,9 @@ func NewWorkflowDefinitionAvailabilityEvent(workflow
*operatorapi.SonataFlow, ev
event.SetExtension("partitionkey", workflow.Name)
data := make(map[string]interface{})
data["id"] = workflow.Name
- data["name"] = workflow.Name
+ if name, ok := workflow.ObjectMeta.Annotations[metadata.Name]; ok {
+ data["name"] = name
+ }
version := workflow.ObjectMeta.Annotations[metadata.Version]
data["version"] = version
data["type"] = "SW"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]