|
8 | 8 |
|
9 | 9 | "github.com/pkg/errors" |
10 | 10 |
|
| 11 | + "github.com/SAP/jenkins-library/pkg/log" |
11 | 12 | "github.com/SAP/jenkins-library/pkg/orchestrator" |
12 | 13 | "github.com/SAP/jenkins-library/pkg/piperutils" |
13 | 14 | ) |
@@ -39,6 +40,9 @@ func (r *RunConfigV1) evaluateConditionsV1(config *Config, utils piperutils.File |
39 | 40 | // to also consider using the technical name. |
40 | 41 | stageName := stage.DisplayName |
41 | 42 |
|
| 43 | + // Central Build in Jenkins was renamed to Build. |
| 44 | + handleLegacyStageNaming(config, currentOrchestrator, stageName) |
| 45 | + |
42 | 46 | // Check #1: Apply explicit activation/deactivation from config file (if any) |
43 | 47 | // and then evaluate stepActive conditions |
44 | 48 | runStep := make(map[string]bool, len(stage.Steps)) |
@@ -305,3 +309,23 @@ func anyOtherStepIsActive(targetStep string, runSteps map[string]bool) bool { |
305 | 309 |
|
306 | 310 | return false |
307 | 311 | } |
| 312 | + |
| 313 | +func handleLegacyStageNaming(c *Config, orchestrator, stageName string) { |
| 314 | + if orchestrator == "Jenkins" && stageName == "Build" { |
| 315 | + _, buildExists := c.Stages["Build"] |
| 316 | + centralBuildStageConfig, centralBuildExists := c.Stages["Central Build"] |
| 317 | + if buildExists && centralBuildExists { |
| 318 | + log.Entry().Warnf("You have 2 entries for build stage in config.yml. " + |
| 319 | + "Parameters defined under 'Central Build' are ignored. " + |
| 320 | + "Please use only 'Build'") |
| 321 | + return |
| 322 | + } |
| 323 | + |
| 324 | + if centralBuildExists { |
| 325 | + c.Stages["Build"] = centralBuildStageConfig |
| 326 | + log.Entry().Warnf("You are using 'Central Build' stage in config.yml. " + |
| 327 | + "Please move parameters under the 'Build' stage, " + |
| 328 | + "since 'Central Build' will be removed in future releases") |
| 329 | + } |
| 330 | + } |
| 331 | +} |
0 commit comments