(authConfig dockertypes.AuthConfig)
| 306 | } |
| 307 | |
| 308 | func EncodeAuthConfig(authConfig dockertypes.AuthConfig) (string, error) { |
| 309 | encoded, err := json.Marshal(authConfig) |
| 310 | if err != nil { |
| 311 | return "", errors.Wrap(err, "failed to encode docker login credentials") |
| 312 | } |
| 313 | registryAuth := base64.URLEncoding.EncodeToString(encoded) |
| 314 | return registryAuth, nil |
| 315 | } |
| 316 | |
| 317 | func CheckImageAccessible(dockerClient *Client, dockerImage, authConfig string) error { |
| 318 | if _, err := dockerClient.DistributionInspect(context.Background(), dockerImage, authConfig); err != nil { |
no test coverage detected