1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-19 19:44:27 +02:00

handle new naming strategy for Central Build stage name (#5171)

* config helper rename

* rename in name provider 
---------

Co-authored-by: maxcask <maxcask@gmail.com>
This commit is contained in:
maxcask 2024-11-12 15:33:38 +04:00 committed by GitHub
parent 1edf8299f3
commit 758d10b06e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 2 deletions

View File

@ -10,6 +10,9 @@ class ConfigurationHelper implements Serializable {
}
ConfigurationHelper loadStepDefaults(Map compatibleParameters = [:], String stageName = step.env.STAGE_NAME) {
if (stageName == 'Central Build'){
stageName = 'Build'
}
DefaultValueCache.prepare(step)
this.config = ConfigurationLoader.defaultGeneralConfiguration()
mixin(ConfigurationLoader.defaultGeneralConfiguration(), null, compatibleParameters)

View File

@ -3,13 +3,18 @@ package com.sap.piper
@Singleton
class StageNameProvider implements Serializable {
static final long serialVersionUID = 1L
static final String CENTRAL_BUILD = "Central Build";
static final String BUILD = "Build";
/** Stores a feature toggle for defaulting to technical names in stages */
boolean useTechnicalStageNames = false
String getStageName(Script script, Map parameters, Script step) {
String stageName = null
if (parameters.stageName in CharSequence) {
return parameters.stageName
stageName = parameters.stageName
stageName = replaceCentralBuild(stageName);
return stageName
}
if (this.useTechnicalStageNames) {
String technicalStageName = getTechnicalStageName(step)
@ -17,7 +22,15 @@ class StageNameProvider implements Serializable {
return technicalStageName
}
}
return script.env.STAGE_NAME
if (stageName == null) {
stageName = script.env.STAGE_NAME
stageName = replaceCentralBuild(stageName);
}
return stageName
}
private String replaceCentralBuild(String stageName) {
return CENTRAL_BUILD.equals(stageName) ? BUILD : stageName;
}
static String getTechnicalStageName(Script step) {