Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/max bo/hspiper 284 #5151

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions pkg/config/evaluation.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/pkg/errors"

"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/orchestrator"
"github.com/SAP/jenkins-library/pkg/piperutils"
)
Expand Down Expand Up @@ -39,6 +40,9 @@ func (r *RunConfigV1) evaluateConditionsV1(config *Config, utils piperutils.File
// to also consider using the technical name.
stageName := stage.DisplayName

// Central Build in Jenkins was renamed to Build.
handleLegacyStageNaming(config, currentOrchestrator, stageName)

// Check #1: Apply explicit activation/deactivation from config file (if any)
// and then evaluate stepActive conditions
runStep := make(map[string]bool, len(stage.Steps))
Expand Down Expand Up @@ -305,3 +309,23 @@ func anyOtherStepIsActive(targetStep string, runSteps map[string]bool) bool {

return false
}

func handleLegacyStageNaming(c *Config, orchestrator, stageName string) {
if orchestrator == "Jenkins" && stageName == "Build" {
_, buildExists := c.Stages["Build"]
centralBuildStageConfig, centralBuildExists := c.Stages["Central Build"]
if buildExists && centralBuildExists {
log.Entry().Warnf("You have 2 entries for build stage in config.yml. " +
"Parameters defined under 'Central Build' are ignored. " +
"Please use only 'Build'")
return
}

if centralBuildExists {
c.Stages["Build"] = centralBuildStageConfig
log.Entry().Warnf("You are using 'Central Build' stage in config.yml. " +
"Please move parameters under the 'Build' stage, " +
"since 'Central Build' will be removed in future releases")
}
}
}
Loading