The genericConfig steps are utility steps for the generic config mechanism.
This step will load a generic configuration yaml from the provided
path
. The yaml will then be parsed using the GenericConfigParser
.
With the pattern-matching mechanism the
step will then retrieve the best matching GenericConfig
for the
searchValue
.
When a resultKey
is provided the result will be wrapped into the
resultKey
.
In this example the content of the config
section of the matched
GenericConfig (mattermost.yaml) is returned without modification.
import io.wcm.devops.jenkins.pipeline.config.GenericConfigConstants
Map yamlConfig = genericConfig.load('jenkins-pipeline-library/config/notify/mattermost.yaml', '[email protected]:/team-a/project1')
// result:
yamlConfig = [
"endpointCredentialId" : "default.credential.id",
"channel" : "team-a-jenkins-build-notifications"
]
In this example the content of the config
section of the matched
GenericConfig
(mattermost.yaml)
is placed inside the notifyMattermost
key.
import io.wcm.devops.jenkins.pipeline.config.GenericConfigConstants
Map yamlConfig = genericConfig.load('jenkins-pipeline-library/config/notify/mattermost.yaml', '[email protected]:/team-a/project1', "notifyMattermost")
// result:
yamlConfig = [
"notifyMattermost" : [
"endpointCredentialId" : "default.credential.id",
"channel" : "team-a-jenkins-build-notifications"
]
]