Skip to content

Commit

Permalink
build: Fix BUILDKIT _build directory creation
Browse files Browse the repository at this point in the history
[ upstream commit a7293ef ]

_build directory may already exist, and the shallow clone may already
have been applied, so don't fail if git clone fails.

Fixes: #11513
Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
jrajahalme authored and aanm committed Jun 22, 2020
1 parent bf2cf8d commit 1822e8f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Makefile.buildkit
Expand Up @@ -19,10 +19,13 @@ veryclean: clean-build
BUILDKIT_DOCKERFILE_FILTER := | sed -e "1s|^\#.*|\# syntax = docker/dockerfile:experimental|" -e "s|^RUN\(.*\)make|RUN --mount=type=cache,target=/root/.cache/go-build\1make|"

# _build/.git is a shallow bare clone of the main repo
# - mkdir can fail if the directory exists already
# - git clone will fail if _build.git already exists.
# In this case the following 'build-context-update' will update it
# If the _build directory gets into bad shape 'make veryclean' will nuke it.
_build/.git:
-mkdir -p _build
git clone --bare --no-local --depth 1 . _build/.git
@cd _build && git remote set-url origin ..
-git clone --bare --no-local --depth 1 . _build/.git && cd _build && git remote set-url origin ..

#
# Create _build context:
Expand Down

0 comments on commit 1822e8f

Please sign in to comment.