Skip to content

Commit 91823b9

Browse files
maxcaskmaxcaskGooglom
authored
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 <[email protected]> Co-authored-by: Googlom <[email protected]>
1 parent e462d32 commit 91823b9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

pkg/config/config.go

+11
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ func (c *Config) ApplyAliasConfig(parameters []StepParameters, secrets []StepSec
7272
if c.Steps[stepName] != nil {
7373
c.Steps[stepName] = setParamValueFromAlias(stepName, c.Steps[stepName], filters.Steps, p.Name, p.Aliases)
7474
}
75+
if centralBuild, ok := c.Stages["Central Build"]; ok {
76+
c.Stages["Build"] = centralBuild
77+
delete(c.Stages, "Central Build")
78+
}
7579
}
7680
for _, s := range secrets {
7781
c.General = setParamValueFromAlias(stepName, c.General, filters.General, s.Name, s.Aliases)
@@ -81,6 +85,10 @@ func (c *Config) ApplyAliasConfig(parameters []StepParameters, secrets []StepSec
8185
if c.Steps[stepName] != nil {
8286
c.Steps[stepName] = setParamValueFromAlias(stepName, c.Steps[stepName], filters.Steps, s.Name, s.Aliases)
8387
}
88+
if centralBuild, ok := c.Stages["Central Build"]; ok {
89+
c.Stages["Build"] = centralBuild
90+
delete(c.Stages, "Central Build")
91+
}
8492
}
8593
}
8694

@@ -185,6 +193,9 @@ func (c *Config) GetStepConfig(flagValues map[string]interface{}, paramJSON stri
185193
}
186194

187195
c.ApplyAliasConfig(parameters, secrets, filters, stageName, stepName, stepAliases)
196+
if stageName == "Central Build" {
197+
stageName = "Build"
198+
}
188199

189200
// initialize with defaults from step.yaml
190201
stepConfig.mixInStepDefaults(parameters)

vars/commonPipelineEnvironment.groovy

+3
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ class commonPipelineEnvironment implements Serializable {
192192

193193
Map getStepConfiguration(stepName, stageName = env.STAGE_NAME, includeDefaults = true) {
194194
Map defaults = [:]
195+
if (stageName == 'Central Build') {
196+
stageName = 'Build'
197+
}
195198
if (includeDefaults) {
196199
defaults = ConfigurationLoader.defaultGeneralConfiguration()
197200
defaults = ConfigurationMerger.merge(ConfigurationLoader.defaultStepConfiguration(null, stepName), null, defaults)

0 commit comments

Comments
 (0)