Skip to content

Commit

Permalink
Merge 60e18e3 into 3939328
Browse files Browse the repository at this point in the history
  • Loading branch information
luan-cestari committed Feb 12, 2015
2 parents 3939328 + 60e18e3 commit 72ad7e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ bin/*
*.bak
*.sublime*
**/overlay*
rhc-port-forward-status
etc/rhc-port-forward-status
20 changes: 16 additions & 4 deletions etc/sonar.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
#!/bin/sh

# kill any previous port forward
# kill any previous port forward and the previous mark file about its status
pkill -9 -f "rhc port-forward sonar [-]n lightblue"
rm -f rhc-port-forward-status

# forward ports from openshift (assumes current server is openshift online and you're a member of the lightblue namespace)
rhc port-forward sonar -n lightblue &
# forward ports from openshift (assumes current server is openshift online and you're a member of the lightblue namespace). A new mark file will eb created if the return value of the rhc command is different than 0
rhc port-forward sonar -n lightblue || echo $? > rhc-port-forward-status &

# wait a bit for port forwarding to fire up
sleep 10

# if the file exists, log the error and exit 1
if [ -f "rhc-port-forward-status" ]
then
echo "Error on rhc port-forward. Error code:"
cat rhc-port-forward-status
rm -f rhc-port-forward-status
# rhc process should dead, so it would not need pkill -9 -f "rhc port-forward sonar [-]n lightblue"
exit 1
fi

# build and publish
mvn clean install -Dmaven.test.failure.ignore=true
mvn -e -B sonar:sonar

# cleanup port forwarding
# cleanup port forwarding & mark file
pkill -9 -f "rhc port-forward sonar [-]n lightblue"
rm -f rhc-port-forward-status

0 comments on commit 72ad7e8

Please sign in to comment.