(pluginExecutableName string)
| 218 | } |
| 219 | |
| 220 | func findPluginExecutable(pluginExecutableName string) (string, error) { |
| 221 | dockerUserDir := ".docker/cli-plugins" |
| 222 | userDir, err := os.UserHomeDir() |
| 223 | if err != nil { |
| 224 | return "", err |
| 225 | } |
| 226 | candidates := []string{ |
| 227 | filepath.Join(userDir, dockerUserDir), |
| 228 | "/usr/local/lib/docker/cli-plugins", |
| 229 | "/usr/local/libexec/docker/cli-plugins", |
| 230 | "/usr/lib/docker/cli-plugins", |
| 231 | "/usr/libexec/docker/cli-plugins", |
| 232 | } |
| 233 | for _, path := range candidates { |
| 234 | bin, err := filepath.Abs(filepath.Join(path, pluginExecutableName)) |
| 235 | if err != nil { |
| 236 | return "", err |
| 237 | } |
| 238 | if _, err := os.Stat(bin); err == nil { |
| 239 | return bin, nil |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | return "", fmt.Errorf("plugin not found %s: %w", pluginExecutableName, os.ErrNotExist) |
| 244 | } |
| 245 | |
| 246 | // CopyFile copies a file from a sourceFile to a destinationFile setting permissions to 0755 |
| 247 | func CopyFile(t testing.TB, sourceFile string, destinationFile string) { |
no outgoing calls