Skip to content

Commit

Permalink
allow reconfiguration of provider (#4776)
Browse files Browse the repository at this point in the history
Co-authored-by: Gulom Alimov <[email protected]>
  • Loading branch information
Googlom and Gulom Alimov authored Jan 15, 2024
1 parent 70b860f commit 9074822
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions pkg/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,22 @@ func GetOrchestratorConfigProvider(opts *Options) (ConfigProvider, error) {
provider = newUnknownOrchestratorConfigProvider()
err = errors.New("unable to detect a supported orchestrator (Azure DevOps, GitHub Actions, Jenkins)")
}
})
if err != nil {
return provider, err
}

if opts == nil {
log.Entry().Debug("ConfigProvider initialized without options. Some data may be unavailable")
return
}
if opts == nil {
log.Entry().Debug("ConfigProvider options are not set. Provider configuration is skipped.")
return provider, nil
}

if cfgErr := provider.Configure(opts); cfgErr != nil {
err = errors.Wrap(cfgErr, "provider configuration failed")
}
})
// This allows configuration of the provider during initialization and/or after it (reconfiguration)
if cfgErr := provider.Configure(opts); cfgErr != nil {
return provider, errors.Wrap(cfgErr, "provider configuration failed")
}

return provider, err
return provider, nil
}

// DetectOrchestrator function determines in which orchestrator Piper is running by examining environment variables.
Expand Down

0 comments on commit 9074822

Please sign in to comment.