1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

allow reconfiguration of provider (#4776)

Co-authored-by: Gulom Alimov <gulomjon.alimov@sap.com>
This commit is contained in:
Googlom 2024-01-15 17:51:32 +05:00 committed by GitHub
parent 70b860f47f
commit 9074822e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 opts == nil {
log.Entry().Debug("ConfigProvider initialized without options. Some data may be unavailable")
return
}
if cfgErr := provider.Configure(opts); cfgErr != nil {
err = errors.Wrap(cfgErr, "provider configuration failed")
}
})
if err != nil {
return provider, err
}
return provider, err
if opts == nil {
log.Entry().Debug("ConfigProvider options are not set. Provider configuration is skipped.")
return provider, nil
}
// 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, nil
}
// DetectOrchestrator function determines in which orchestrator Piper is running by examining environment variables.