forked from jenkinsci/elasticbox-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathload-test.sh
More file actions
executable file
·61 lines (49 loc) · 1.12 KB
/
load-test.sh
File metadata and controls
executable file
·61 lines (49 loc) · 1.12 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
#/bin/bash
USAGE="Usage : load-test.sh -j JENKINS_URL
Example:
load-test.sh -j http://localhost:8080/jenkins
Options:
-j Jenkins server URL
-n Number of builds per jobs
-h Display this message
"
function help() {
echo "${USAGE}"
if [[ ${1} ]]
then
echo ${1}
fi
}
# Handle options
while getopts ":j:n:h" ARGUMENT
do
case ${ARGUMENT} in
j ) JENKINS_URL=$OPTARG;;
n ) BUILDS=$(($OPTARG));;
h ) help; exit 0;;
: ) help "Missing option argument for -$OPTARG"; exit 1;;
? ) help "Option does not exist: $OPTARG"; exit 1;;
esac
done
if [[ -z "${JENKINS_URL}" ]]
then
help "Jenkins server URL must be specified"
exit 1
fi
if [[ ${BUILDS} -lt 1 ]]
then
BUILDS=1
fi
function jenkins() {
java -jar jenkins-cli.jar -s ${JENKINS_URL} "$@"
}
echo "Downloading jenkins-cli.jar"
curl ${JENKINS_URL}/jnlpJars/jenkins-cli.jar -o jenkins-cli.jar
for JOB in $(jenkins list-jobs enabled)
do
echo "Scheduling ${BUILDS} builds of job ${JOB}"
for (( i = 0; i < ${BUILDS}; i++ ))
do
jenkins build $JOB -p hash=$i
done
done