I have two private repositories on GitHub called dashboard
and ui
. I defined ui
as a git submodule of dashboard
, and I configured docker to autobuild dashboard
on every changes on a specific branch.
I read this documentation https://docs.docker.com/docker-hub/builds/, but when I try to setup the deploy key given by docker in my ui
's settings, it says "Key already in use". Indeed, this key is already used by dashboard
to allow docker to autobuild this repo!
Here is my docker build log:
Error:
Failed to clone repository: Cloning into '/tmp/build_byaxhis7sznbvmb6wgwzm6n'... Submodule 'app/styles/ui' (git@github.com:yllieth/ui.git) registered for path 'app/styles/ui' Cloning into 'app/styles/ui'... Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts. ERROR: Repository not found. fatal: The remote end hung up unexpectedly Clone of 'git@github.com:yllieth/ui.git' into submodule path 'app/styles/ui' failed
Dockerfile: None
Docker doesn't find any Dockerfile even if I have one defined in my dashboard
repo. So, I won't be able to give it any instructions or add another SSH key.
If anyone has an idea about how using autobuild with private repos and git submodule, I'm interested!!
If your GitHub repository contains links to private submodules, you'll get an error message in your build. Normally, the Docker Hub sets up a deploy key in your GitHub repository. Unfortunately, GitHub only allows a repository deploy key to access a single repository. As a workaround, you need to create a dedicated user account in GitHub and attach the automated build's deploy key to that account. This dedicated build account can be limited to read-only access to just the repositories required to build.
A guy already initiated the pull request for the update in docker document. He also included the screenshots that might help you with this problem.
If sub modules doesn't work for you can try and switch to subtree. its more or like does the same with few changes. Subtree is used as remote inside your project.
https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844
http://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging
http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/
This is ugly, but you could create a machine-user as github calls them, and add the deploy key to it as the user's key (after removing it from deploy keys). Then add that user as a read only user to each repo needed for that build.
I am waiting to hear from the docker team on something better.