Skip to content

Commit

Permalink
[CAPPL-132] Fetch secrets in workflow engine (#14880)
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-cordenier authored Oct 25, 2024
1 parent 4fdcae8 commit af81323
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 92 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-boxes-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

Implement secrets interpolation with dummy workflow registry syncer #internal
7 changes: 7 additions & 0 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/webhook"
"github.com/smartcontractkit/chainlink/v2/core/services/workflows"
workflowstore "github.com/smartcontractkit/chainlink/v2/core/services/workflows/store"
"github.com/smartcontractkit/chainlink/v2/core/services/workflows/syncer"
"github.com/smartcontractkit/chainlink/v2/core/sessions"
"github.com/smartcontractkit/chainlink/v2/core/sessions/ldapauth"
"github.com/smartcontractkit/chainlink/v2/core/sessions/localauth"
Expand Down Expand Up @@ -212,6 +213,11 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
opts.CapabilitiesRegistry = capabilities.NewRegistry(globalLogger)
}

// TODO: wire this up to config so we only instantiate it
// if a workflow registry address is provided.
workflowRegistrySyncer := syncer.NewWorkflowRegistry()
srvcs = append(srvcs, workflowRegistrySyncer)

var externalPeerWrapper p2ptypes.PeerWrapper
if cfg.Capabilities().Peering().Enabled() {
var dispatcher remotetypes.Dispatcher
Expand Down Expand Up @@ -465,6 +471,7 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
delegates[job.Workflow] = workflows.NewDelegate(
globalLogger,
opts.CapabilitiesRegistry,
workflowRegistrySyncer,
workflowORM,
)

Expand Down
29 changes: 16 additions & 13 deletions core/services/workflows/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import (
)

type Delegate struct {
registry core.CapabilitiesRegistry
logger logger.Logger
store store.Store
registry core.CapabilitiesRegistry
secretsFetcher secretsFetcher
logger logger.Logger
store store.Store
}

var _ job.Delegate = (*Delegate)(nil)
Expand Down Expand Up @@ -47,15 +48,16 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser
}

cfg := Config{
Lggr: d.logger,
Workflow: sdkSpec,
WorkflowID: spec.WorkflowSpec.WorkflowID,
WorkflowOwner: spec.WorkflowSpec.WorkflowOwner,
WorkflowName: spec.WorkflowSpec.WorkflowName,
Registry: d.registry,
Store: d.store,
Config: []byte(spec.WorkflowSpec.Config),
Binary: binary,
Lggr: d.logger,
Workflow: sdkSpec,
WorkflowID: spec.WorkflowSpec.WorkflowID,
WorkflowOwner: spec.WorkflowSpec.WorkflowOwner,
WorkflowName: spec.WorkflowSpec.WorkflowName,
Registry: d.registry,
Store: d.store,
Config: []byte(spec.WorkflowSpec.Config),
Binary: binary,
SecretsFetcher: d.secretsFetcher,
}
engine, err := NewEngine(cfg)
if err != nil {
Expand All @@ -67,9 +69,10 @@ func (d *Delegate) ServicesForSpec(ctx context.Context, spec job.Job) ([]job.Ser
func NewDelegate(
logger logger.Logger,
registry core.CapabilitiesRegistry,
secretsFetcher secretsFetcher,
store store.Store,
) *Delegate {
return &Delegate{logger: logger, registry: registry, store: store}
return &Delegate{logger: logger, registry: registry, secretsFetcher: secretsFetcher, store: store}
}

func ValidatedWorkflowJobSpec(ctx context.Context, tomlString string) (job.Job, error) {
Expand Down
Loading

0 comments on commit af81323

Please sign in to comment.