0

We have go packages in separate repos to the package being built in circle. We have setup the build with a github user key (https://circleci.com/docs/github-security-ssh-keys/) so that it can access the private repos that contain the dependencies. However, calling godep restore results in a git clone https://... call.

Is it possible to force godep restore packages using SSH type urls? Alternatively, is it possible to somehow use the user key to enable auth over HTTPS?

I have tried everything suggested here but so far no joy: https://gist.github.com/shurcooL/6927554

Myles McDonnell
  • 12,943
  • 17
  • 66
  • 116

1 Answers1

2

It seems like you're misusing the Godeps :-)

According to their FAQ you should consider checking in vendor directory to the repo, you're building (that is: all the external dependencies).

  • That is an option, but we prefer to only commit the godeps.json file and restore source to an environment. Committing both vendor folder and json file provides scope for the two to become out of sync. – Myles McDonnell Aug 30 '16 at 10:35
  • 1
    Nope, just use `godep update` to update `vendor` (and it will update both the json and the `vendor` folder) :-) – Vasily Korytov Aug 30 '16 at 10:37
  • vasily is correct @MylesMcDonnell You should be commiting the vendor folder, you should not be relying on external git repos to build your code. I know it sounds weird specially if the repos are yours but it works better to and you avoid a lot of pain if you commit the actual versions you use and let govendor manage the updates etc. – dmportella Aug 30 '16 at 12:24
  • @MylesMcDonnell the files should never go out of sync, as long as you use govendor. – dmportella Aug 30 '16 at 12:25
  • cool..that's what I will do then. Might need to raise another question for this: now I have the vendor folder checked in but when I run go test on circle it can't resolve the packages? go build does resolve the packages. all works fine locally in a vanilla workspace so something to do with the circle env I suspect. – Myles McDonnell Aug 30 '16 at 12:31
  • Try `godep go test` instead. :-) – Vasily Korytov Aug 30 '16 at 14:36
  • I don't need to use godep at all during CI build time because all of the deps are 'vendored' and I'm on Go1.6.x. The problem I was having is that Go will not look for dependencies in the vendor folder if the code being built is not in the workspace. By default circle does put your code in the workspace so I was able to fix by moving the code in the circle dependencies section. – Myles McDonnell Aug 30 '16 at 14:50