Fetching Authentication Configuration from Config files

Following the discussion on this Merge Request: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/merge_requests/8, I have tried to make authentication work for private registry when using Docker executor.

As suggested, I started from @ayufan branch and worked from there:

  • The registry name is found from the image name
  • If the value is not empty, the executor will try to look at ~/.dockercfg (Using NewAuthConfigurationsFromDockerCfg() method in go-dockerclient)
  • If that fails for some reason, the executor will then look at ~/.docker/config.json (Which should be the new default from Docker 1.7.0)
  • Finally, if an Authentication corresponding to the specified registry is found, subsequent Pull will make use of it

Being fairly new to Go, I hope the Error handling is Ok. Please feel free to ask for fixes. As well, I needed the latest version of go-dockerclient and it's adding quite a fair bit of modifications to the repo. (Was Godeps the right way to do it?)

Finally, if I tested it at my company (and it seems to work fine), should I add test classes somewhere? Do you also want me to add something at the documentation?

Thank you in advance