Skip to content

Commit

Permalink
fix: Collect local configuration right after JXSCM is registered in C…
Browse files Browse the repository at this point in the history
…onfigurationProvider

```
Error: cannot push dependencies to ConfigurationController: cannot push PFConfig to IndexedDocumentStore: component 'jxscm' has no registered its schema
```
  • Loading branch information
keskad committed Nov 3, 2023
1 parent 8162c48 commit 15c658c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkgs/app/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ func (app *PipelinesFeedbackApp) Run() error {
return errors.Wrap(err, "cannot inject dependencies to GenericController")
}

// collect configuration initially right after all components are injected (and registered in ConfigurationProvider)
if err := app.ConfigController.CollectInitially(app.ConfigCollector); err != nil {
return errors.Wrap(err, "cannot initially collect configuration")
}

// register controllers
if err = app.JobController.SetupWithManager(mgr); err != nil {
app.Logger.Error(err, "unable to setup job controller", "controller")
Expand Down
4 changes: 2 additions & 2 deletions pkgs/controller/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (cc *ConfigurationController) Initialize(kubeConfig *rest.Config, collector
}

cc.client = client.PipelinesfeedbackV1alpha1()
return cc.collectInitially(collector)
return nil
}

func (cc *ConfigurationController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand All @@ -74,7 +74,7 @@ func (cc *ConfigurationController) SetupWithManager(mgr ctrl.Manager) error {
Complete(cc)
}

func (cc *ConfigurationController) collectInitially(collector config.ConfigurationCollector) error {
func (cc *ConfigurationController) CollectInitially(collector config.ConfigurationCollector) error {
docs, err := collector.CollectInitially()
if err != nil {
return errors.Wrap(err, "cannot initially read configuration")
Expand Down

0 comments on commit 15c658c

Please sign in to comment.