-
Notifications
You must be signed in to change notification settings - Fork 346
Closed
Description
If the repo is cloned as a submodule, make docker
fails. This is due to the fact that GITCOMMIT_SHA
doesn't exist before make
runs within the build container, and the true .git/
directory is outside of the Docker build context when we're in a submodule.
I was able to fix this by making GITCOMMIT_SHA
a dependency of the docker
make target in the Makefile
, such that GITCOMMIT_SHA
already exists in the Docker build context before make
runs. I have opened #185 with the fix.
Example
~$ EXAMPLE_DIR=$(mktemp -d)
~$ cd $EXAMPLE_DIR
tmp.MEpbWK5rCB$ git init
Initialized empty Git repository in /tmp/tmp.MEpbWK5rCB/.git/
tmp.MEpbWK5rCB$ git submodule add [email protected]:awslabs/amazon-ecr-credential-helper.git
Cloning into '/tmp/tmp.MEpbWK5rCB/amazon-ecr-credential-helper'...
remote: Enumerating objects: 373, done.
remote: Counting objects: 100% (373/373), done.
remote: Compressing objects: 100% (300/300), done.
remote: Total 2186 (delta 90), reused 205 (delta 55), pack-reused 1813
Receiving objects: 100% (2186/2186), 2.60 MiB | 11.09 MiB/s, done.
Resolving deltas: 100% (889/889), done.
tmp.MEpbWK5rCB$ cd amazon-ecr-credential-helper/
amazon-ecr-credential-helper$ make docker
find: ‘.git/’: Not a directory
mkdir -p bin
docker run --rm \
-e TARGET_GOOS= \
-e TARGET_GOARCH= \
-v '/tmp/tmp.MEpbWK5rCB/amazon-ecr-credential-helper/bin':/go/src/github.com/awslabs/amazon-ecr-credential-helper/bin \
sha256:dfe7b32b42631a793e59eb8c18b99da8df91fa3717ecc4fa4d0323a1ccf84110
find: '.git/': Not a directory
git rev-parse --short=7 HEAD > GITCOMMIT_SHA
fatal: Not a git repository: ../.git/modules/amazon-ecr-credential-helper
make: *** [GITCOMMIT_SHA] Error 128
Makefile:75: recipe for target 'GITCOMMIT_SHA' failed
Makefile:32: recipe for target 'docker' failed
make: *** [docker] Error 2
Metadata
Metadata
Assignees
Labels
No labels