1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-30 05:59:39 +02:00

including container names when no conditions (#3733)

Co-authored-by: anilkeshav27 <you@example.com>
This commit is contained in:
Anil Keshav 2022-04-13 17:34:42 +02:00 committed by GitHub
parent 7e0ec525bf
commit 3c08a3bd7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -40,6 +40,13 @@ func consolidateContextDefaults(stepData *config.StepData) {
}
}
}
} else {
for paramName, val := range containerParams {
if _, ok := paramConditions[paramName]; !ok {
paramConditions[paramName] = &conditionDefaults{}
}
paramConditions[paramName].equal = append(paramConditions[paramName].equal, conditionDefault{def: val})
}
}
}

View File

@ -221,7 +221,12 @@ func formatDefault(param config.StepParameters, stepParameterNames []string) str
defaults := []string{}
for _, condDef := range v {
//ToDo: add type-specific handling of default
defaults = append(defaults, fmt.Sprintf("%v=`%v`: `%v`", condDef.key, condDef.value, condDef.def))
if len(condDef.key) > 0 && len(condDef.value) > 0 {
defaults = append(defaults, fmt.Sprintf("%v=`%v`: `%v`", condDef.key, condDef.value, condDef.def))
} else {
// containers with no condition will only hold def
defaults = append(defaults, fmt.Sprintf("`%v`", condDef.def))
}
}
return strings.Join(defaults, "<br />")
case []interface{}: