| "github.com/goccy/go-yaml" |
| // Define a global variable for the release value. |
| // Function to replace the {{ release }} placeholders |
| func replaceReleaseInYAML(yamlContent []byte, release string) []byte { |
| return []byte(strings.ReplaceAll(string(yamlContent), "{{ atmosphere_release }}", release)) |
| func GetImages() (map[string]string, error) { |
| // Replace {{ release }} with the actual release value |
| modifiedVarsFile := replaceReleaseInYAML(varsFile, release) |
| path, err := yaml.PathString("$._atmosphere_images") |
| var images map[string]string |
| if err := path.Read(bytes.NewReader(modifiedVarsFile), &images); err != nil { |
| func GetImageByKey(key string) (string, error) { |
| path, err := yaml.PathString("$._atmosphere_images." + key) |
| if err := path.Read(bytes.NewReader(varsFile), &image); err != nil { |