diff --git a/pkg/capabilities/capabilities.go b/pkg/capabilities/capabilities.go index a06cf8fce0..7724051775 100644 --- a/pkg/capabilities/capabilities.go +++ b/pkg/capabilities/capabilities.go @@ -106,8 +106,11 @@ type RequestMetadata struct { // Use DecodedWorkflowName if the human readable name needs to be exposed, such as for logging purposes. DecodedWorkflowName string // SpendLimits is expected to be an array of tuples of spend type and limit. i.e. CONSENSUS -> 100_000 - SpendLimits []SpendLimit - WorkflowTag string + SpendLimits []SpendLimit + WorkflowTag string + WorkflowRegistryChainSelector string + WorkflowRegistryAddress string + EngineVersion string } func (m *RequestMetadata) ContextWithCRE(ctx context.Context) context.Context { diff --git a/pkg/capabilities/pb/capabilities.pb.go b/pkg/capabilities/pb/capabilities.pb.go index f0e7b347c3..55ae62cb19 100644 --- a/pkg/capabilities/pb/capabilities.pb.go +++ b/pkg/capabilities/pb/capabilities.pb.go @@ -220,19 +220,22 @@ func (x *SpendLimit) GetLimit() string { } type RequestMetadata struct { - state protoimpl.MessageState `protogen:"open.v1"` - WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` - WorkflowExecutionId string `protobuf:"bytes,2,opt,name=workflow_execution_id,json=workflowExecutionId,proto3" json:"workflow_execution_id,omitempty"` - WorkflowOwner string `protobuf:"bytes,3,opt,name=workflow_owner,json=workflowOwner,proto3" json:"workflow_owner,omitempty"` - WorkflowName string `protobuf:"bytes,4,opt,name=workflow_name,json=workflowName,proto3" json:"workflow_name,omitempty"` - WorkflowDonId uint32 `protobuf:"varint,6,opt,name=workflow_don_id,json=workflowDonId,proto3" json:"workflow_don_id,omitempty"` - WorkflowDonConfigVersion uint32 `protobuf:"varint,7,opt,name=workflow_don_config_version,json=workflowDonConfigVersion,proto3" json:"workflow_don_config_version,omitempty"` - ReferenceId string `protobuf:"bytes,8,opt,name=reference_id,json=referenceId,proto3" json:"reference_id,omitempty"` - DecodedWorkflowName string `protobuf:"bytes,9,opt,name=decoded_workflow_name,json=decodedWorkflowName,proto3" json:"decoded_workflow_name,omitempty"` - SpendLimits []*SpendLimit `protobuf:"bytes,10,rep,name=spend_limits,json=spendLimits,proto3" json:"spend_limits,omitempty"` - WorkflowTag string `protobuf:"bytes,11,opt,name=workflow_tag,json=workflowTag,proto3" json:"workflow_tag,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + WorkflowId string `protobuf:"bytes,1,opt,name=workflow_id,json=workflowId,proto3" json:"workflow_id,omitempty"` + WorkflowExecutionId string `protobuf:"bytes,2,opt,name=workflow_execution_id,json=workflowExecutionId,proto3" json:"workflow_execution_id,omitempty"` + WorkflowOwner string `protobuf:"bytes,3,opt,name=workflow_owner,json=workflowOwner,proto3" json:"workflow_owner,omitempty"` + WorkflowName string `protobuf:"bytes,4,opt,name=workflow_name,json=workflowName,proto3" json:"workflow_name,omitempty"` + WorkflowDonId uint32 `protobuf:"varint,6,opt,name=workflow_don_id,json=workflowDonId,proto3" json:"workflow_don_id,omitempty"` + WorkflowDonConfigVersion uint32 `protobuf:"varint,7,opt,name=workflow_don_config_version,json=workflowDonConfigVersion,proto3" json:"workflow_don_config_version,omitempty"` + ReferenceId string `protobuf:"bytes,8,opt,name=reference_id,json=referenceId,proto3" json:"reference_id,omitempty"` + DecodedWorkflowName string `protobuf:"bytes,9,opt,name=decoded_workflow_name,json=decodedWorkflowName,proto3" json:"decoded_workflow_name,omitempty"` + SpendLimits []*SpendLimit `protobuf:"bytes,10,rep,name=spend_limits,json=spendLimits,proto3" json:"spend_limits,omitempty"` + WorkflowTag string `protobuf:"bytes,11,opt,name=workflow_tag,json=workflowTag,proto3" json:"workflow_tag,omitempty"` + WorkflowRegistryChainSelector string `protobuf:"bytes,12,opt,name=workflow_registry_chain_selector,json=workflowRegistryChainSelector,proto3" json:"workflow_registry_chain_selector,omitempty"` + WorkflowRegistryAddress string `protobuf:"bytes,13,opt,name=workflow_registry_address,json=workflowRegistryAddress,proto3" json:"workflow_registry_address,omitempty"` + EngineVersion string `protobuf:"bytes,14,opt,name=engine_version,json=engineVersion,proto3" json:"engine_version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RequestMetadata) Reset() { @@ -335,6 +338,27 @@ func (x *RequestMetadata) GetWorkflowTag() string { return "" } +func (x *RequestMetadata) GetWorkflowRegistryChainSelector() string { + if x != nil { + return x.WorkflowRegistryChainSelector + } + return "" +} + +func (x *RequestMetadata) GetWorkflowRegistryAddress() string { + if x != nil { + return x.WorkflowRegistryAddress + } + return "" +} + +func (x *RequestMetadata) GetEngineVersion() string { + if x != nil { + return x.EngineVersion + } + return "" +} + type CapabilityRequest struct { state protoimpl.MessageState `protogen:"open.v1"` Metadata *RequestMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"` @@ -1196,7 +1220,7 @@ const file_capabilities_proto_rawDesc = "" + "SpendLimit\x12\x1d\n" + "\n" + "spend_type\x18\x01 \x01(\tR\tspendType\x12\x14\n" + - "\x05limit\x18\x02 \x01(\tR\x05limit\"\xd6\x03\n" + + "\x05limit\x18\x02 \x01(\tR\x05limit\"\x82\x05\n" + "\x0fRequestMetadata\x12\x1f\n" + "\vworkflow_id\x18\x01 \x01(\tR\n" + "workflowId\x122\n" + @@ -1209,7 +1233,10 @@ const file_capabilities_proto_rawDesc = "" + "\x15decoded_workflow_name\x18\t \x01(\tR\x13decodedWorkflowName\x12;\n" + "\fspend_limits\x18\n" + " \x03(\v2\x18.capabilities.SpendLimitR\vspendLimits\x12!\n" + - "\fworkflow_tag\x18\v \x01(\tR\vworkflowTagJ\x04\b\x05\x10\x06\"\xc6\x02\n" + + "\fworkflow_tag\x18\v \x01(\tR\vworkflowTag\x12G\n" + + " workflow_registry_chain_selector\x18\f \x01(\tR\x1dworkflowRegistryChainSelector\x12:\n" + + "\x19workflow_registry_address\x18\r \x01(\tR\x17workflowRegistryAddress\x12%\n" + + "\x0eengine_version\x18\x0e \x01(\tR\rengineVersionJ\x04\b\x05\x10\x06\"\xc6\x02\n" + "\x11CapabilityRequest\x129\n" + "\bmetadata\x18\x01 \x01(\v2\x1d.capabilities.RequestMetadataR\bmetadata\x12&\n" + "\x06config\x18\x02 \x01(\v2\x0e.values.v1.MapR\x06config\x12&\n" + diff --git a/pkg/capabilities/pb/capabilities.proto b/pkg/capabilities/pb/capabilities.proto index 6ba4e53150..e0210650ec 100644 --- a/pkg/capabilities/pb/capabilities.proto +++ b/pkg/capabilities/pb/capabilities.proto @@ -48,6 +48,9 @@ message RequestMetadata { string decoded_workflow_name = 9; repeated SpendLimit spend_limits = 10; string workflow_tag = 11; + string workflow_registry_chain_selector = 12; + string workflow_registry_address = 13; + string engine_version = 14; } message CapabilityRequest { diff --git a/pkg/capabilities/pb/capabilities_helpers.go b/pkg/capabilities/pb/capabilities_helpers.go index 8c03be56d7..37226f1712 100644 --- a/pkg/capabilities/pb/capabilities_helpers.go +++ b/pkg/capabilities/pb/capabilities_helpers.go @@ -314,16 +314,19 @@ func TriggerRegistrationRequestToProto(req capabilities.TriggerRegistrationReque return &TriggerRegistrationRequest{ TriggerId: req.TriggerID, Metadata: &RequestMetadata{ - WorkflowId: md.WorkflowID, - WorkflowExecutionId: md.WorkflowExecutionID, - WorkflowOwner: md.WorkflowOwner, - WorkflowName: md.WorkflowName, - WorkflowDonId: md.WorkflowDonID, - WorkflowDonConfigVersion: md.WorkflowDonConfigVersion, - ReferenceId: md.ReferenceID, - DecodedWorkflowName: md.DecodedWorkflowName, - SpendLimits: spendLimitsToProto(md.SpendLimits), - WorkflowTag: md.WorkflowTag, + WorkflowId: md.WorkflowID, + WorkflowExecutionId: md.WorkflowExecutionID, + WorkflowOwner: md.WorkflowOwner, + WorkflowName: md.WorkflowName, + WorkflowDonId: md.WorkflowDonID, + WorkflowDonConfigVersion: md.WorkflowDonConfigVersion, + ReferenceId: md.ReferenceID, + DecodedWorkflowName: md.DecodedWorkflowName, + SpendLimits: spendLimitsToProto(md.SpendLimits), + WorkflowTag: md.WorkflowTag, + WorkflowRegistryChainSelector: md.WorkflowRegistryChainSelector, + WorkflowRegistryAddress: md.WorkflowRegistryAddress, + EngineVersion: md.EngineVersion, }, Config: values.ProtoMap(config), Payload: req.Payload, @@ -361,16 +364,19 @@ func TriggerRegistrationRequestFromProto(req *TriggerRegistrationRequest) (capab return capabilities.TriggerRegistrationRequest{ TriggerID: req.TriggerId, Metadata: capabilities.RequestMetadata{ - WorkflowID: md.WorkflowId, - WorkflowOwner: md.WorkflowOwner, - WorkflowExecutionID: md.WorkflowExecutionId, - WorkflowName: md.WorkflowName, - WorkflowDonID: md.WorkflowDonId, - WorkflowDonConfigVersion: md.WorkflowDonConfigVersion, - ReferenceID: md.ReferenceId, - DecodedWorkflowName: md.DecodedWorkflowName, - SpendLimits: spendLimitsFromProto(md.SpendLimits), - WorkflowTag: md.WorkflowTag, + WorkflowID: md.WorkflowId, + WorkflowOwner: md.WorkflowOwner, + WorkflowExecutionID: md.WorkflowExecutionId, + WorkflowName: md.WorkflowName, + WorkflowDonID: md.WorkflowDonId, + WorkflowDonConfigVersion: md.WorkflowDonConfigVersion, + ReferenceID: md.ReferenceId, + DecodedWorkflowName: md.DecodedWorkflowName, + SpendLimits: spendLimitsFromProto(md.SpendLimits), + WorkflowTag: md.WorkflowTag, + WorkflowRegistryChainSelector: md.WorkflowRegistryChainSelector, + WorkflowRegistryAddress: md.WorkflowRegistryAddress, + EngineVersion: md.EngineVersion, }, Config: config, Payload: req.Payload, diff --git a/pkg/workflows/events/trigger_events.go b/pkg/workflows/events/trigger_events.go index 6e02ece869..392373903f 100644 --- a/pkg/workflows/events/trigger_events.go +++ b/pkg/workflows/events/trigger_events.go @@ -15,14 +15,17 @@ import ( // Label keys for trigger events const ( - KeyTriggerID = "trigger_id" - KeyWorkflowID = "workflow_id" - KeyWorkflowOwner = "workflow_owner" - KeyWorkflowName = "workflow_name" - KeyWorkflowExecutionID = "workflow_execution_id" - KeyDonID = "don_id" - KeyDonVersion = "don_version" - KeyOrganizationID = "organization_id" + KeyTriggerID = "trigger_id" + KeyWorkflowID = "workflow_id" + KeyWorkflowOwner = "workflow_owner" + KeyWorkflowName = "workflow_name" + KeyWorkflowExecutionID = "workflow_execution_id" + KeyDonID = "don_id" + KeyDonVersion = "don_version" + KeyOrganizationID = "organization_id" + KeyWorkflowRegistryChainSelector = "workflow_registry_chain_selector" + KeyWorkflowRegistryAddress = "workflow_registry_address" + KeyEngineVersion = "engine_version" ) // EmitTriggerExecutionStarted emits a TriggerExecutionStarted event using the provided labeler @@ -68,6 +71,18 @@ func EmitTriggerExecutionStarted(ctx context.Context, labeler custmsg.MessageEmi } } + if workflowRegistryChainSelector, exists := labels[KeyWorkflowRegistryChainSelector]; exists { + event.CreInfo.WorkflowRegistryChain = workflowRegistryChainSelector + } + + if workflowRegistryAddress, exists := labels[KeyWorkflowRegistryAddress]; exists { + event.CreInfo.WorkflowRegistryAddress = workflowRegistryAddress + } + + if engineVersion, exists := labels[KeyEngineVersion]; exists { + event.CreInfo.EngineVersion = engineVersion + } + b, err := proto.Marshal(event) if err != nil { return fmt.Errorf("failed to marshal TriggerExecutionStarted event: %w", err)