1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

fix(config): move Central Build stage config to Build stage for custom defaults (#5182)

* rename stage on ApplyAliasConfig func rename stage after applying alias

---------

Co-authored-by: maxcask <maxcask@gmail.com>
Co-authored-by: Googlom <alimovgb@gmail.com>
This commit is contained in:
maxcask
2024-11-27 11:48:54 +04:00
committed by GitHub
parent e462d324e4
commit 91823b9e08
2 changed files with 14 additions and 0 deletions

View File

@@ -72,6 +72,10 @@ func (c *Config) ApplyAliasConfig(parameters []StepParameters, secrets []StepSec
if c.Steps[stepName] != nil {
c.Steps[stepName] = setParamValueFromAlias(stepName, c.Steps[stepName], filters.Steps, p.Name, p.Aliases)
}
if centralBuild, ok := c.Stages["Central Build"]; ok {
c.Stages["Build"] = centralBuild
delete(c.Stages, "Central Build")
}
}
for _, s := range secrets {
c.General = setParamValueFromAlias(stepName, c.General, filters.General, s.Name, s.Aliases)
@@ -81,6 +85,10 @@ func (c *Config) ApplyAliasConfig(parameters []StepParameters, secrets []StepSec
if c.Steps[stepName] != nil {
c.Steps[stepName] = setParamValueFromAlias(stepName, c.Steps[stepName], filters.Steps, s.Name, s.Aliases)
}
if centralBuild, ok := c.Stages["Central Build"]; ok {
c.Stages["Build"] = centralBuild
delete(c.Stages, "Central Build")
}
}
}
@@ -185,6 +193,9 @@ func (c *Config) GetStepConfig(flagValues map[string]interface{}, paramJSON stri
}
c.ApplyAliasConfig(parameters, secrets, filters, stageName, stepName, stepAliases)
if stageName == "Central Build" {
stageName = "Build"
}
// initialize with defaults from step.yaml
stepConfig.mixInStepDefaults(parameters)

View File

@@ -192,6 +192,9 @@ class commonPipelineEnvironment implements Serializable {
Map getStepConfiguration(stepName, stageName = env.STAGE_NAME, includeDefaults = true) {
Map defaults = [:]
if (stageName == 'Central Build') {
stageName = 'Build'
}
if (includeDefaults) {
defaults = ConfigurationLoader.defaultGeneralConfiguration()
defaults = ConfigurationMerger.merge(ConfigurationLoader.defaultStepConfiguration(null, stepName), null, defaults)