| "github.com/goccy/go-yaml" |
| // Define a global variable for the release value. |
| func GetImages() (map[string]string, error) { |
| // Replace {{ release }} with the actual release value |
| modifiedVarsFile := []byte(strings.ReplaceAll(string(varsFile), "{{ atmosphere_release }}", release)) |
| // Fix prefixes for images to allow tests to run |
| modifiedVarsFile = []byte(strings.ReplaceAll(string(modifiedVarsFile), "{{ atmosphere_image_prefix }}registry.atmosphere.dev", "harbor.atmosphere.dev")) |
| modifiedVarsFile = []byte(strings.ReplaceAll(string(modifiedVarsFile), "{{ atmosphere_image_prefix }}", "harbor.atmosphere.dev/")) |
| 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 { |