From c43fa109046fddcb059dab53481bf66ed253ff0e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 30 Aug 2018 12:43:09 -0400 Subject: [PATCH] build: Work around OpenShift not including the .git directory See e.g. https://github.com/openshift/source-to-image/issues/457 Thankfully, OpenShift *will* do a recursive clone, so we don't need to handle that. Closes: https://github.com/coreos/coreos-assembler/issues/27 --- Dockerfile | 2 +- build.sh | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 461509a0a0..557eb65923 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM registry.fedoraproject.org/fedora:28 WORKDIR /root/src COPY . /root/src -RUN ./build.sh \ No newline at end of file +RUN ./build.sh diff --git a/build.sh b/build.sh index f35d82602b..cc34247cd3 100755 --- a/build.sh +++ b/build.sh @@ -3,11 +3,17 @@ set -xeuo pipefail srcdir=$(pwd) -# Init submodules -ls -al .git mantle -dnf -y install git +# Work around https://github.com/coreos/coreos-assembler/issues/27 +if ! test -d .git; then + dnf -y install git + (git config --global user.email dummy@example.com + git init && git add . && git commit -a -m 'dummy commit' + git tag -m tag dummy-tag) >/dev/null +fi + if ! test -f mantle/README.md; then - git submodule update --init + echo "Run: git submodule update --init" 1>&2 + exit 1 fi # We want to run what builds we can as an unprivileged user;