From 10f535c8fa2643981cd8672d1dafb87d88b1cba4 Mon Sep 17 00:00:00 2001 From: maxcask Date: Tue, 19 Nov 2024 11:58:55 +0400 Subject: [PATCH] fix handle new naming strategy for Central Build stage name if extension is used (#5178) * handle extension filename --------- Co-authored-by: maxcask Co-authored-by: Googlom --- vars/piperStageWrapper.groovy | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/vars/piperStageWrapper.groovy b/vars/piperStageWrapper.groovy index 1d6f1a3195..142a89617a 100644 --- a/vars/piperStageWrapper.groovy +++ b/vars/piperStageWrapper.groovy @@ -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 { @@ -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