(filePath string)
| 117 | } |
| 118 | |
| 119 | func GetComposeImages(filePath string) ([]string, error) { |
| 120 | images, err := getComposeImagesByCommand(filePath) |
| 121 | if err == nil { |
| 122 | return images, nil |
| 123 | } |
| 124 | |
| 125 | content, readErr := os.ReadFile(filePath) |
| 126 | if readErr != nil { |
| 127 | return nil, readErr |
| 128 | } |
| 129 | env, _ := os.ReadFile(path.Join(path.Dir(filePath), ".env")) |
| 130 | images, parseErr := docker.GetImagesFromDockerCompose(env, content) |
| 131 | if parseErr != nil { |
| 132 | return nil, fmt.Errorf("get compose images failed, cmd err: %v, parse err: %v", err, parseErr) |
| 133 | } |
| 134 | return images, nil |
| 135 | } |
| 136 | |
| 137 | func getComposeImagesByCommand(filePath string) ([]string, error) { |
| 138 | if err := checkCmd(); err != nil { |
no test coverage detected