Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable fromjob source for deploy job variable #3950

Merged
merged 12 commits into from
Jan 23, 2025
Prev Previous commit
Next Next commit
debug for regular expression replace
Signed-off-by: Min Min <jamsman94@gmail.com>
jamsman94 committed Jan 9, 2025
commit 3252d48294bc6327631d3d6d31095b4b11ce281a
6 changes: 3 additions & 3 deletions pkg/microservice/aslan/core/common/service/kube/render.go
Original file line number Diff line number Diff line change
@@ -123,8 +123,8 @@ func ReplaceWorkloadImages(rawYaml string, images []*commonmodels.Container) (st
imageMap[image.Name] = image
}

customKVRegExp := regexp.MustCompile(`{{(\.(\w+))+}}`)
restoreRegExp := regexp.MustCompile(`TEMP_PLACEHOLDER_(\w+)`)
customKVRegExp := regexp.MustCompile(`{{(\.\w+(\.\w+)*)}}`)
restoreRegExp := regexp.MustCompile(`TEMP_PLACEHOLDER_(\.\w+(\.\w+)*)`)

splitYams := util.SplitYaml(rawYaml)
yamlStrs := make([]string, 0)
@@ -231,7 +231,7 @@ func ReplaceWorkloadImages(rawYaml string, images []*commonmodels.Container) (st
return "", nil, fmt.Errorf("updated resource cannot be marshaled into a YAML, error: %s", err)
}

finalYaml := restoreRegExp.ReplaceAll(updatedYaml, []byte("{{.$1}}"))
finalYaml := restoreRegExp.ReplaceAll(updatedYaml, []byte("{{$1}}"))
yamlStrs = append(yamlStrs, string(finalYaml))
}