Skip to content

Commit 10f535c

Browse files
maxcaskmaxcaskGooglom
authored
fix handle new naming strategy for Central Build stage name if extension is used (#5178)
* handle extension filename --------- Co-authored-by: maxcask <[email protected]> Co-authored-by: Googlom <[email protected]>
1 parent f54dbfd commit 10f535c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

vars/piperStageWrapper.groovy

+13
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private void stageLocking(Map config, Closure body) {
9292
private void executeStage(script, originalStage, stageName, config, utils, telemetryDisabled = false) {
9393
boolean projectExtensions
9494
boolean globalExtensions
95+
9596
def startTime = System.currentTimeMillis()
9697

9798
try {
@@ -103,6 +104,18 @@ private void executeStage(script, originalStage, stageName, config, utils, telem
103104
*/
104105
def projectInterceptorFile = "${config.projectExtensionsDirectory}${stageName}.groovy"
105106
def globalInterceptorFile = "${config.globalExtensionsDirectory}${stageName}.groovy"
107+
/* due to renaming stage 'Central Build' to 'Build' need to define extension file name 'Central Build.groovy'
108+
as stageName used to generate it, once all the users will 'Build' as a stageName
109+
and extension filename, below renaming snippet should be removed
110+
*/
111+
if (stageName == 'Build'){
112+
if (!fileExists(projectInterceptorFile) || !fileExists(globalInterceptorFile)){
113+
def centralBuildExtensionFileName = "Central Build.groovy"
114+
projectInterceptorFile = "${config.projectExtensionsDirectory}${centralBuildExtensionFileName}"
115+
globalInterceptorFile = "${config.globalExtensionsDirectory}${centralBuildExtensionFileName}"
116+
}
117+
}
118+
106119
projectExtensions = fileExists(projectInterceptorFile)
107120
globalExtensions = fileExists(globalInterceptorFile)
108121
// Pre-defining the real originalStage in body variable, might be overwritten later if extensions exist

0 commit comments

Comments
 (0)