-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Supporting Private Workflow Registry #20708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
c60eee1
5ed54bc
ba21308
8377374
358fadd
9ac9032
5076067
89e1c14
986a8cf
a117d58
5700b11
f385cf3
f24657f
bb2098f
5f1f8af
1626e3a
9ac7f2c
1204d1f
d170011
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2197,16 +2197,60 @@ func (s *WorkflowStorage) ValidateConfig() error { | |
| return nil | ||
| } | ||
|
|
||
| // AlternativeWorkflowSource represents a single alternative workflow metadata source | ||
| // configured via TOML. This allows workflows to be loaded from sources other than | ||
| // the on-chain registry contract (e.g., a GRPC service). | ||
| type AlternativeWorkflowSource struct { | ||
| URL *string `toml:"URL"` | ||
| TLSEnabled *bool `toml:"TLSEnabled"` | ||
| Name *string `toml:"Name"` // Human-readable name for logging | ||
| } | ||
|
|
||
| func (a *AlternativeWorkflowSource) setFrom(f *AlternativeWorkflowSource) { | ||
| if f.URL != nil { | ||
| a.URL = f.URL | ||
| } | ||
| if f.TLSEnabled != nil { | ||
| a.TLSEnabled = f.TLSEnabled | ||
| } | ||
| if f.Name != nil { | ||
| a.Name = f.Name | ||
| } | ||
| } | ||
|
|
||
| // GetURL implements config.AlternativeWorkflowSource. | ||
| func (a AlternativeWorkflowSource) GetURL() string { | ||
| if a.URL == nil { | ||
| return "" | ||
| } | ||
| return *a.URL | ||
| } | ||
|
|
||
| func (a AlternativeWorkflowSource) GetTLSEnabled() bool { | ||
| if a.TLSEnabled == nil { | ||
| return true // Default to enabled | ||
| } | ||
| return *a.TLSEnabled | ||
| } | ||
|
|
||
| func (a AlternativeWorkflowSource) GetName() string { | ||
| if a.Name == nil { | ||
| return "GRPCWorkflowSource" | ||
| } | ||
| return *a.Name | ||
| } | ||
|
|
||
| type WorkflowRegistry struct { | ||
| Address *string | ||
| NetworkID *string | ||
| ChainID *string | ||
| ContractVersion *string | ||
| MaxBinarySize *utils.FileSize | ||
| MaxEncryptedSecretsSize *utils.FileSize | ||
| MaxConfigSize *utils.FileSize | ||
| SyncStrategy *string | ||
| WorkflowStorage WorkflowStorage | ||
| Address *string | ||
| NetworkID *string | ||
| ChainID *string | ||
| ContractVersion *string | ||
| MaxBinarySize *utils.FileSize | ||
| MaxEncryptedSecretsSize *utils.FileSize | ||
| MaxConfigSize *utils.FileSize | ||
| SyncStrategy *string | ||
| WorkflowStorage WorkflowStorage | ||
| AlternativeSourcesConfig []AlternativeWorkflowSource `toml:"AlternativeSources"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally we would deprecate the old fields (Address, NetworkID, ContractVersion, ChainID) Everywhere else in the application uses sources going forward
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will schedule for a follow up ticket, good idea.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will be hard to keep all sources together because config format is very different. How about a split into OnchainSources and OffchainSources? Potentially add XYZSources in the future. |
||
| } | ||
|
|
||
| func (r *WorkflowRegistry) setFrom(f *WorkflowRegistry) { | ||
|
|
@@ -2243,6 +2287,49 @@ func (r *WorkflowRegistry) setFrom(f *WorkflowRegistry) { | |
| } | ||
|
|
||
| r.WorkflowStorage.setFrom(&f.WorkflowStorage) | ||
|
|
||
| if len(f.AlternativeSourcesConfig) > 0 { | ||
| r.AlternativeSourcesConfig = make([]AlternativeWorkflowSource, len(f.AlternativeSourcesConfig)) | ||
| for i := range f.AlternativeSourcesConfig { | ||
| r.AlternativeSourcesConfig[i].setFrom(&f.AlternativeSourcesConfig[i]) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // MaxAlternativeSources is the maximum number of alternative workflow sources | ||
| const MaxAlternativeSources = 5 | ||
|
|
||
| func (r *WorkflowRegistry) ValidateConfig() error { | ||
| if err := r.WorkflowStorage.ValidateConfig(); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if len(r.AlternativeSourcesConfig) > MaxAlternativeSources { | ||
| return configutils.ErrInvalid{ | ||
| Name: "AlternativeSources", | ||
| Value: len(r.AlternativeSourcesConfig), | ||
| Msg: fmt.Sprintf("maximum %d alternative sources supported", MaxAlternativeSources), | ||
| } | ||
| } | ||
|
|
||
| // Validate each source has a URL | ||
| for i, src := range r.AlternativeSourcesConfig { | ||
| if src.URL == nil || *src.URL == "" { | ||
| return configutils.ErrMissing{Name: fmt.Sprintf("AlternativeSources[%d].URL", i)} | ||
| } | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| // AlternativeSources returns the list of alternative workflow sources. | ||
| // Implements config.CapabilitiesWorkflowRegistry. | ||
| func (r WorkflowRegistry) AlternativeSources() []config.AlternativeWorkflowSource { | ||
| result := make([]config.AlternativeWorkflowSource, len(r.AlternativeSourcesConfig)) | ||
| for i := range r.AlternativeSourcesConfig { | ||
| result[i] = r.AlternativeSourcesConfig[i] | ||
| } | ||
| return result | ||
| } | ||
|
|
||
| type Dispatcher struct { | ||
|
|
||
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.
Is Additional a better name here? (Alternative to me implies "replacement of", whereas we want to read from both)
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.
hmm. we have to keep TOML backwards compatible, so it will take a few node revisions to deprecate the old TOML config section in favor of a more flexible section name like [[Capabilities.WorkflowRegistry.Source]] - i wanted to handle any such migration later on once we see usage.
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'm with Cedric on this. How about "Offchain Sources"?