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

fix(getConfig): custom metadata (#3047)

* fix(getConfig): custom metadata

when re-using getConfig it is now possible to provide a custom metadata resolver

* clean up coding
This commit is contained in:
Oliver Nocon 2021-08-12 14:54:46 +02:00 committed by GitHub
parent 2d412d9f3c
commit 481f0a1282
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -240,7 +240,10 @@ func resolveMetadata() (config.StepData, error) {
}
} else {
if configOptions.stepName != "" {
metadataMap := GetAllStepMetadata()
if GeneralConfig.MetaDataResolver == nil {
GeneralConfig.MetaDataResolver = GetAllStepMetadata
}
metadataMap := GeneralConfig.MetaDataResolver()
var ok bool
metadata, ok = metadataMap[configOptions.stepName]
if !ok {

View File

@ -41,6 +41,7 @@ type GeneralConfigOptions struct {
VaultNamespace string
VaultPath string
HookConfig HookConfiguration
MetaDataResolver func() map[string]config.StepData
}
// HookConfiguration contains the configuration for supported hooks, so far Sentry and Splunk are supported.