aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-07-02 15:03:00 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2015-07-02 16:14:34 +0200
commit53af877a1ac5e9777f0a78b8ee1779b918b695ec (patch)
tree06280ddaffe8a6d0aca1a1c6c285ee4b5f16e17a /scripts
parent5f9538c9a90d52cf29b7c58035fe2ff1ecb6375a (diff)
downloadsonarqube-53af877a1ac5e9777f0a78b8ee1779b918b695ec.tar.gz
sonarqube-53af877a1ac5e9777f0a78b8ee1779b918b695ec.zip
use a private repo before building in generate_batch_reports.sh
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/generate_batch_reports.sh34
1 files changed, 24 insertions, 10 deletions
diff --git a/scripts/generate_batch_reports.sh b/scripts/generate_batch_reports.sh
index 227d734b923..605839fc895 100755
--- a/scripts/generate_batch_reports.sh
+++ b/scripts/generate_batch_reports.sh
@@ -16,6 +16,29 @@
set -euo pipefail
+function clean() {
+ rm -Rf $BUILD_DIR
+}
+
+function createPrivateClone() {
+ BRANCH=$(git symbolic-ref -q HEAD)
+ BRANCH=${BRANCH##refs/heads/}
+ BRANCH=${BRANCH:-HEAD}
+ LOCATION=$(pwd)
+ REPO_DIR=$(git rev-parse --show-toplevel)
+ REPO_NAME=${REPO_DIR##*/}
+ RELATIVE_PATH=${LOCATION#$REPO_DIR}
+
+ # create temp directory and register trap to clean it on exit
+ BUILD_DIR=$(mktemp -d -t ${REPO_NAME}.XXXXXXXX 2>/dev/null)
+ trap "clean" INT TERM EXIT
+
+ # Private build
+ cd $REPO_DIR
+ git clone --single-branch -slb "${BRANCH}" . ${BUILD_DIR}
+ cd ${BUILD_DIR}${RELATIVE_PATH}
+}
+
DUMP_DIR="/tmp/batch_dumps"
HISTORY_LENGTH=30
SONAR_HOST="http://localhost:9000"
@@ -25,20 +48,11 @@ SONAR_JDBC_URL="jdbc:postgresql://localhost:5432/sonar"
SONAR_JDBC_USERNAME="sonar"
SONAR_JDBC_PASSWORD="sonar"
-function clean() {
- git co $branch_name
- git branch -D working_branch
-}
-
-trap "clean" EXIT
+createPrivateClone
# retrieve ${HISTORY_LENGTH} commits for the current directory
git log -${HISTORY_LENGTH} --pretty=%h -- . | tac > /tmp/sha1s.txt
-branch_name=$(git symbolic-ref -q HEAD)
-branch_name=${branch_name##refs/heads/}
-branch_name=${branch_name:-HEAD}
-
git co -b working_branch
while read sha1; do
echo $sha1