forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkins_ci.sh
executable file
·41 lines (33 loc) · 915 Bytes
/
jenkins_ci.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
#!/usr/bin/env bash
set -euox pipefail
: "${HOME:?Need to set HOME to a non-empty value.}"
: "${WORKSPACE:?Need to set WORKSPACE to a non-empty value.}"
: "${beat:?Need to set beat to a non-empty value.}"
if [ ! -d "$beat" ]; then
echo "$beat does not exist"
mkdir -p build
touch build/TEST-empty.xml
exit
fi
source ./dev-tools/common.bash
jenkins_setup
cleanup() {
echo "Running cleanup..."
rm -rf $TEMP_PYTHON_ENV
if docker info > /dev/null ; then
make stop-environment || true
make fix-permissions || true
echo "Killing all running containers..."
ids=$(docker ps -q)
if [ -n "$ids" ]; then
docker kill $ids
fi
echo "Cleaning stopped docker containers and dangling images/networks/volumes..."
docker system prune -f || true
fi
echo "Cleanup complete."
}
trap cleanup EXIT
rm -rf ${GOPATH}/pkg
cd ${beat}
RACE_DETECTOR=1 make clean check testsuite