From 455e1926753934441162b8c42c1d6e50fef9b3fa Mon Sep 17 00:00:00 2001 From: Amarnath Valluri Date: Wed, 21 Sep 2016 09:52:31 +0300 Subject: [PATCH] docker scripts: Provide git configuration inside docker container While kernel patching 'git am/apply' is failing with below error: *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. Though we provide GIT_COMMITTER_{NAME/EMAL} environment, bitbake does not pass this to do_patch tasks. This patch configures the docker container with proper git configuration. Signed-off-by: Amarnath Valluri --- docker/build-project.sh | 6 ++++++ docker/local-build.sh | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docker/build-project.sh b/docker/build-project.sh index 22f1709..63d15e6 100755 --- a/docker/build-project.sh +++ b/docker/build-project.sh @@ -25,6 +25,12 @@ cd $WORKSPACE # get git commit ID of the project for using in buildhistory tagging CI_GIT_COMMIT=$(git rev-parse HEAD) +# prepare git config +#NOTE: bitbake does not pass git enviornment to tasks(do_patch), +# hence we need to setup the git configuration +git config --global user.name "$GIT_COMMITTER_NAME" +git config --global user.email "$GIT_COMMITTER_EMAIL" + # FIXME: undbound variables used without checking: set +u source ostro-init-build-env diff --git a/docker/local-build.sh b/docker/local-build.sh index edd3186..81c4d3d 100755 --- a/docker/local-build.sh +++ b/docker/local-build.sh @@ -11,6 +11,9 @@ BUILD_CACHE_DIR=$WORKSPACE/bb-cache BUILDOS="opensuse-42.1" GIT_PROXY_COMMAND=oe-git-proxy TARGET_MACHINE="intel-corei7-64" +GIT_COMMITTER_EMAIL=${GIT_COMMITTER_EMAIL:-$(git config --get user.email)} +GIT_COMMITTER_NAME=${GIT_COMMITTER_NAME:-$(git config --get user.name)} +GIT_COMMITTER_NAME=${GIT_COMMITTER_NAME:-${USER}} BUILD_ARGS="--build-arg uid=`id -u`" RUN_ARGS=(-u "`id -u`") @@ -39,7 +42,7 @@ echo "$BUILD_NUMBER" > $WORKSPACE/.build_number CI_BUILD_ID="${BUILD_TIMESTAMP}-build-${BUILD_NUMBER}" # export other vars -for var in WORKSPACE BASE_DISTRO CURRENT_PROJECT BUILD_CACHE_DIR GIT_PROXY_COMMAND CI_BUILD_ID TARGET_MACHINE; do +for var in WORKSPACE BASE_DISTRO CURRENT_PROJECT BUILD_CACHE_DIR GIT_PROXY_COMMAND CI_BUILD_ID TARGET_MACHINE GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL; do RUN_ARGS+=(-e "$var=${!var}") done # Point HOME to WORKSPACE, don't polute real home.