-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbuild.sh
executable file
·48 lines (42 loc) · 970 Bytes
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
function build_clean {
for KILLPID in `ps ax | grep 'hpi:run' | awk ' { print $1;}'`; do
echo "Jenkins is running at $KILLPID, killing it"
kill $KILLPID || echo;
done
}
function on_exit {
build_clean
}
trap on_exit EXIT
##
## Setup
##
echo Setting up Maven
mkdir -p ~/.m2
[ -f ~/.m2/settings.xml.backup ] || cp ~/.m2/settings.xml ~/.m2/settings.xml.backup
cp sandbox/settings.xml ~/.m2/settings.xml
##
## Build plugin
##
mvn -q clean package || exit 1
##
## Start Jenkins on localhost
##
echo Starting Jenkins on localhost
build_clean
JENKINS_PORT=8123
JENKINS_PREFIX=/jenkins
mvn -q hpi:run -Djetty.port=$JENKINS_PORT -Dhpi.prefix=$JENKINS_PREFIX || exit 1 &
JENKINS_URL=http://localhost:$JENKINS_PORT$JENKINS_PREFIX
until $(curl --output /dev/null --silent --head --fail $JENKINS_URL); do
printf '.'
sleep 5
done
echo Jenkins started at $JENKINS_URL
##
## Test plugin
##
cd plugin-test
mvn -q test -Djenkins=$JENKINS_URL $1 || exit 1
cd ..