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

Fix for checkIfStepActive custom config (#3987)

* Fix for checkIfStepActive custom config

* convert JSONObjects to LinkedHashMap

* fix null pointer

Co-authored-by: Raman Susla<“raman_susla@epam.com”>
This commit is contained in:
Ashly Mathew
2022-08-31 15:11:51 +02:00
committed by GitHub
parent 3a476b2c6d
commit 3fb034b629
3 changed files with 11 additions and 3 deletions

View File

@@ -67,6 +67,7 @@ func checkIfStepActive(utils piperutils.FileUtils) error {
projectConfig, err := initializeConfig(&pConfig)
if err != nil {
log.Entry().Errorf("Failed to load project config: %v", err)
return errors.Wrapf(err, "Failed to load project config failed")
}
stageConfigFile, err := checkStepActiveOptions.openFile(checkStepActiveOptions.stageConfigFile, GeneralConfig.GitHubAccessTokens)

View File

@@ -306,6 +306,8 @@ static boolean checkIfStepActive(Map parameters = [:], Script script, String pip
step = "_"
}
flags += " --stage ${stage} --step ${step}"
flags += getCustomDefaultConfigsArg()
flags += getCustomConfigArg(script)
piperGoUtils.unstashPiperBin()
def returnCode = script.sh(returnStatus: true, script: "${piperGoPath} checkIfStepActive ${flags}")
return (returnCode == 0)

View File

@@ -66,9 +66,14 @@ void call(Map parameters = [:]) {
throw new Exception("checkIfStepActive finished with error")
}
script.commonPipelineEnvironment.configuration.runStage = script.readJSON file: ".pipeline/stage_out.json"
script.commonPipelineEnvironment.configuration.runStep = script.readJSON file: ".pipeline/step_out.json"
def stagesJSONObject = script.readJSON file: ".pipeline/stage_out.json"
def stepsJSONObject = script.readJSON file: ".pipeline/step_out.json"
if (stagesJSONObject) {
script.commonPipelineEnvironment.configuration.runStage = new LinkedHashMap(stagesJSONObject)
}
if (stepsJSONObject) {
script.commonPipelineEnvironment.configuration.runStep = new LinkedHashMap(stepsJSONObject)
}
// Retaining this groovy code as some additional checks for activating-deactivating a stage seems to be done.
script.commonPipelineEnvironment.configuration.runStage.each {stage ->
String currentStage = stage.getKey()