build-image icon indicating copy to clipboard operation
build-image copied to clipboard

Submodules do not get copied on cloning to container

Open johnykifle opened this issue 5 years ago • 2 comments

When building a site, git submodules never get cloned with the repo to container.

johnykifle avatar Jul 01 '20 13:07 johnykifle

You can work around this, though it is not very elegant, it should unblock you:

You can manually copy it over. While it isn't cloned into the container automagically, you can manually access the /opt/repo directory from the build image, to see the "local" filesystem and copy things off of it - for instance the submodule.

To get things started, in the build image, you'll have to run a "dummy" build command:

build ls

You should see some output like this:

$ build ls
Cloning into '/opt/buildhome/repo'...
done.
Installing dependencies
[...]

...which will be the docker image cloning the repo and installing dependencies, and "building" your site (in this case "run ls"). Then, you'll copy your submodule into the appropriate location inside of /opt/buildhome/repo - which is the copy we "work from" and have just created when you ran build ls) - before you run build your-real-build-command to actually use the newly imported submodule.

nolessafool avatar Jul 02 '20 21:07 nolessafool

customers in the helpdesk/community to notify of a fix:

  • Enterprise customer: https://netlify.zendesk.com/agent/tickets/33962

nolessafool avatar Jul 02 '20 21:07 nolessafool