You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@metron.apache.org by ot...@apache.org on 2019/10/01 19:20:20 UTC
[metron-bro-plugin-kafka] branch master updated: METRON-2269 Cannot
run Docker tests if src is not a git repo (ottobackwards) closes
apache/metron-bro-plugin-kafka#37
This is an automated email from the ASF dual-hosted git repository.
otto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metron-bro-plugin-kafka.git
The following commit(s) were added to refs/heads/master by this push:
new abbbc9b METRON-2269 Cannot run Docker tests if src is not a git repo (ottobackwards) closes apache/metron-bro-plugin-kafka#37
abbbc9b is described below
commit abbbc9b8e049fa281dde1ff6ab159d194dc10d4a
Author: ottobackwards <ot...@gmail.com>
AuthorDate: Tue Oct 1 14:56:01 2019 -0400
METRON-2269 Cannot run Docker tests if src is not a git repo (ottobackwards) closes apache/metron-bro-plugin-kafka#37
---
docker/run_end_to_end.sh | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/docker/run_end_to_end.sh b/docker/run_end_to_end.sh
index 9a7036f..6d003b0 100755
--- a/docker/run_end_to_end.sh
+++ b/docker/run_end_to_end.sh
@@ -19,7 +19,6 @@
shopt -s nocasematch
set -u # nounset
-set -e # errexit
set -E # errtrap
set -o pipefail
@@ -48,6 +47,7 @@ fi
SKIP_REBUILD_BRO=false
NO_PCAP=false
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)"
+PLUGIN_ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd .. > /dev/null && pwd)"
SCRIPT_DIR="${ROOT_DIR}"/scripts
CONTAINER_DIR="${ROOT_DIR}"/containers/bro-localbuild-container
DATA_PATH="${ROOT_DIR}"/data
@@ -55,7 +55,36 @@ DATE=$(date)
LOG_DATE=${DATE// /_}
TEST_OUTPUT_PATH="${ROOT_DIR}/test_output/"${LOG_DATE//:/_}
KAFKA_TOPIC="bro"
-PLUGIN_VERSION=$(cd "${ROOT_DIR}" && git rev-parse --symbolic-full-name --abbrev-ref HEAD)
+
+cd "${PLUGIN_ROOT_DIR}" || { echo "NO PLUGIN ROOT" ; exit 1; }
+# we may not be checked out from git, check and make it so that we are since
+# bro-pkg requires it
+
+git status 2&>1
+rc=$?; if [[ ${rc} != 0 ]]; then
+ echo "bro-pkg requires the plugin to be a git repo, creating..."
+ git init .
+ rc=$?; if [[ ${rc} != 0 ]]; then
+ echo "ERROR> FAILED TO INITIALIZE GIT IN PLUGIN DIRECTORY. ${rc}"
+ exit ${rc}
+ fi
+ git add .
+ rc=$?; if [[ ${rc} != 0 ]]; then
+ echo "ERROR> FAILED TO ADD ALL TO GIT PLUGIN DIRECTORY. ${rc}"
+ exit ${rc}
+ fi
+ git commit -m 'docker run'
+ rc=$?; if [[ ${rc} != 0 ]]; then
+ echo "ERROR> FAILED TO COMMIT TO GIT MASTER IN PLUGIN DIRECTORY. ${rc}"
+ exit ${rc}
+ fi
+ echo "git repo created"
+fi
+
+# set errexit for the rest of the run
+set -e
+
+PLUGIN_VERSION=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD)
# Handle command line options
for i in "$@"; do
@@ -119,7 +148,7 @@ for i in "$@"; do
done
EXTRA_ARGS="$*"
-
+cd "${ROOT_DIR}" || { echo "NO ROOT" ; exit 1; }
echo "Running build_container with "
echo "SKIP_REBUILD_BRO = ${SKIP_REBUILD_BRO}"
echo "DATA_PATH = ${DATA_PATH}"