Skip to content

Commit

Permalink
example passes
Browse files Browse the repository at this point in the history
  • Loading branch information
chitrangpatel committed Dec 14, 2023
1 parent e2a3c2b commit 2168a53
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/apis/pipeline/v1/resultref.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ func stripVarSubExpression(expression string) string {
// - Output: "", "", nil, "", error
// TODO: may use regex for each type to handle possible reference formats
func parseExpression(substitutionExpression string) (string, string, *int, string, ParamType, error) {
if looksLikeResultRef(substitutionExpression) {
if looksLikeResultRef(substitutionExpression) || looksLikeStepResultRef(substitutionExpression) {
subExpressions := strings.Split(substitutionExpression, ".")
// For string result: tasks.<taskName>.results.<stringResultName>
// For string step result: steps.<stepName>.results.<stringResultName>
// For array result: tasks.<taskName>.results.<arrayResultName>[index]
// For array step result: steps.<stepName>.results.<arrayResultName>[index]
if len(subExpressions) == 4 {
resultName, stringIdx := ParseResultName(subExpressions[3])
if stringIdx != "" {
Expand All @@ -164,6 +166,7 @@ func parseExpression(substitutionExpression string) (string, string, *int, strin
return subExpressions[1], resultName, nil, "", ParamTypeString, nil
} else if len(subExpressions) == 5 {
// For object type result: tasks.<taskName>.results.<objectResultName>.<individualAttribute>
// For object type step result: steps.<stepName>.results.<objectResultName>.<individualAttribute>
return subExpressions[1], subExpressions[3], nil, subExpressions[4], ParamTypeObject, nil
}
}
Expand Down

0 comments on commit 2168a53

Please sign in to comment.