You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by kw...@apache.org on 2022/10/10 13:31:38 UTC

[pulsar-client-cpp] branch main updated: Fix incorrect path in docker scripts (#32)

This is an automated email from the ASF dual-hosted git repository.

kwang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-client-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new 97d73cd  Fix incorrect path in docker scripts (#32)
97d73cd is described below

commit 97d73cddb86c6bf28ee73e1cf09c9052f431699a
Author: Zike Yang <zi...@apache.org>
AuthorDate: Mon Oct 10 21:31:33 2022 +0800

    Fix incorrect path in docker scripts (#32)
    
    ### Motivation
    
    Currently, the `docker-*.sh` are using the incorrect project root path. Need to fix thems.
    
    ### Modifications
    
    * Fix the incorrect path
    
    We need to add `git config --global --add safe.directory /pulsar-client-cpp` to the `docker-test.sh` otherwise it will throw:
    ```
    fatal: unsafe repository ('/pulsar-client-cpp' is owned by someone else)
    To add an exception for this directory, call:
    
            git config --global --add safe.directory /pulsar-client-cpp
    ```
    This started appearing with the release of the Git 2.35.2 security update which fixes vulnerabilities described [here](https://github.blog/2022-04-12-git-security-vulnerability-announced/). [FYI](https://stackoverflow.com/questions/71901632/fatal-error-unsafe-repository-home-repon-is-owned-by-someone-else)
---
 docker-build.sh  | 6 +++---
 docker-format.sh | 6 +++---
 docker-tests.sh  | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/docker-build.sh b/docker-build.sh
index 649945e..796bf9b 100755
--- a/docker-build.sh
+++ b/docker-build.sh
@@ -24,7 +24,7 @@
 set -e
 
 ROOT_DIR=$(git rev-parse --show-toplevel)
-cd $ROOT_DIR/pulsar-client-cpp
+cd $ROOT_DIR
 
 BUILD_IMAGE_NAME="${BUILD_IMAGE_NAME:-apachepulsar/pulsar-build}"
 BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-20.04}"
@@ -35,8 +35,8 @@ echo "---- Build Pulsar C++ client using image $IMAGE (pass <skip-clean> for inc
 
 docker pull $IMAGE
 
-VOLUME_OPTION=${VOLUME_OPTION:-"-v $ROOT_DIR:/pulsar"}
-COMMAND="cd /pulsar/pulsar-client-cpp && cmake . $CMAKE_ARGS && make check-format && make -j8"
+VOLUME_OPTION=${VOLUME_OPTION:-"-v $ROOT_DIR:/pulsar-client-cpp"}
+COMMAND="cd /pulsar-client-cpp && cmake . $CMAKE_ARGS && make check-format && make -j8"
 
 DOCKER_CMD="docker run -i ${VOLUME_OPTION} ${IMAGE}"
 
diff --git a/docker-format.sh b/docker-format.sh
index 9fe2866..56a805f 100755
--- a/docker-format.sh
+++ b/docker-format.sh
@@ -24,7 +24,7 @@
 set -e
 
 ROOT_DIR=$(git rev-parse --show-toplevel)
-cd $ROOT_DIR/pulsar-client-cpp
+cd $ROOT_DIR
 
 BUILD_IMAGE_NAME="${BUILD_IMAGE_NAME:-apachepulsar/pulsar-build}"
 BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-20.04}"
@@ -35,8 +35,8 @@ echo "---- Build Pulsar C++ client using image $IMAGE"
 
 docker pull $IMAGE
 
-VOLUME_OPTION=${VOLUME_OPTION:-"-v $ROOT_DIR:/pulsar"}
-COMMAND="cd /pulsar/pulsar-client-cpp && cmake . $CMAKE_ARGS && make format"
+VOLUME_OPTION=${VOLUME_OPTION:-"-v $ROOT_DIR:/pulsar-client-cpp"}
+COMMAND="cd /pulsar-client-cpp && cmake . $CMAKE_ARGS && make format"
 
 DOCKER_CMD="docker run -i ${VOLUME_OPTION} ${IMAGE}"
 
diff --git a/docker-tests.sh b/docker-tests.sh
index 1665aa8..2095eb4 100755
--- a/docker-tests.sh
+++ b/docker-tests.sh
@@ -31,7 +31,7 @@ fi
 
 
 ROOT_DIR=$(git rev-parse --show-toplevel)
-cd $ROOT_DIR/pulsar-client-cpp
+cd $ROOT_DIR
 
 BUILD_IMAGE_NAME="${BUILD_IMAGE_NAME:-apachepulsar/pulsar-build}"
 BUILD_IMAGE_VERSION="${BUILD_IMAGE_VERSION:-ubuntu-20.04}"
@@ -44,7 +44,7 @@ docker pull $IMAGE
 
 CONTAINER_LABEL="pulsartests=$$"
 export GTEST_COLOR=${GTEST_COLOR:-no}
-DOCKER_CMD="docker run -e GTEST_COLOR -i -l $CONTAINER_LABEL -v $ROOT_DIR:/pulsar $IMAGE"
+DOCKER_CMD="docker run -e GTEST_COLOR -i -l $CONTAINER_LABEL -v $ROOT_DIR:/pulsar-client-cpp $IMAGE"
 
 
 for args in "$@"
@@ -68,7 +68,7 @@ fi
 
 # Java17 is required for CLI e.g) bin/pulsar create-token
 $DOCKER_CMD bash -c "apt-get -y install openjdk-17-jre-headless &&\
- set -o pipefail; cd /pulsar/pulsar-client-cpp && ./run-unit-tests.sh ${tests} $DISABLE_COLOR_OUTPUT"
+ set -o pipefail; cd /pulsar-client-cpp && git config --global --add safe.directory /pulsar-client-cpp && ./run-unit-tests.sh ${tests} $DISABLE_COLOR_OUTPUT"
 RES=$?
 if [ $RES -ne 0 ]; then
   (