DOCKER_RUN_OPTS="--rm"
DOCKER_RUN_OPTS+=" -w $DOCKER_PATH"
+BUILD_RESULT=0
+
if [ "$DOCKER_INTERACTIVE" ]; then
DOCKER_RUN_OPTS+=" -it"
CMD="/bin/bash"
docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
+ BUILD_RESULT=$?
else
- CMD="./nncc configure"
- docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
+ if [[ ${BUILD_RESULT} -eq 0 ]]; then
+ CMD="./nncc configure"
+ docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
+ BUILD_RESULT=$?
+ fi
- CMD="./nncc build -j$(nproc)"
- docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
-fi
+ if [[ ${BUILD_RESULT} -eq 0 ]]; then
+ CMD="./nncc build -j$(nproc)"
+ docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
+ BUILD_RESULT=$?
+ fi
-BUILD_RESULT=$?
+ if [[ ${BUILD_RESULT} -eq 0 ]]; then
+ CMD="./nncc test"
+ docker run $DOCKER_RUN_OPTS $DOCKER_ENV_VARS $DOCKER_VOLUMES $DOCKER_IMAGE_NAME $CMD
+ BUILD_RESULT=$?
+ fi
+fi
# Newly created files during above docker run can have different ownership.
# This may cause some problems, for example, some jenkins slaves or developers