1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-10-30 23:57:50 +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
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.