Skip to content

Commit

Permalink
fix handle new naming strategy for Central Build stage name if extens…
Browse files Browse the repository at this point in the history
…ion is used (#5178)

* handle extension filename

---------

Co-authored-by: maxcask <[email protected]>
Co-authored-by: Googlom <[email protected]>
  • Loading branch information
3 people authored Nov 19, 2024
1 parent f54dbfd commit 10f535c
Showing 1 changed file with 13 additions and 0 deletions.
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

0 comments on commit 10f535c

Please sign in to comment.