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

fix handle new naming strategy for Central Build stage name if extension is used #5178

Merged
merged 11 commits into from
Nov 19, 2024
13 changes: 13 additions & 0 deletions vars/piperStageWrapper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private void stageLocking(Map config, Closure body) {
private void executeStage(script, originalStage, stageName, config, utils, telemetryDisabled = false) {
boolean projectExtensions
boolean globalExtensions

def startTime = System.currentTimeMillis()

try {
Expand All @@ -103,6 +104,18 @@ private void executeStage(script, originalStage, stageName, config, utils, telem
*/
def projectInterceptorFile = "${config.projectExtensionsDirectory}${stageName}.groovy"
def globalInterceptorFile = "${config.globalExtensionsDirectory}${stageName}.groovy"
/* due to renaming stage 'Central Build' to 'Build' need to define extension file name 'Central Build.groovy'
as stageName used to generate it, once all the users will 'Build' as a stageName
and extension filename, below renaming snippet should be removed
*/
if (stageName == 'Build'){
if (!fileExists(projectInterceptorFile) || !fileExists(globalInterceptorFile)){
def centralBuildExtensionFileName = "Central Build.groovy"
projectInterceptorFile = "${config.projectExtensionsDirectory}${centralBuildExtensionFileName}"
globalInterceptorFile = "${config.globalExtensionsDirectory}${centralBuildExtensionFileName}"
}
}

projectExtensions = fileExists(projectInterceptorFile)
globalExtensions = fileExists(globalInterceptorFile)
// Pre-defining the real originalStage in body variable, might be overwritten later if extensions exist
Expand Down
Loading