This repository was archived by the owner on Feb 4, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathversion-build.sh
More file actions
executable file
·116 lines (94 loc) · 2.91 KB
/
version-build.sh
File metadata and controls
executable file
·116 lines (94 loc) · 2.91 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
set -e
USAGE="Usage : version-build.sh -a ELASTICBOX_ADDRESS -j JENKINS_VERSION
Example:
version-build.sh -a https://blue.elasticbox.com -j 2.150.2
Options:
-a ElasticBox address to run tests against
-j Jenkins version to build with
-t ElasticBox access token
-w ElasticBox workspace
-c Fork count
-g GitHub test properties
-? Display this message
"
cd $(dirname $0)
REPOSITORY_FOLDER=$(pwd)
source ${REPOSITORY_FOLDER}/common.sh
function help() {
echo "${USAGE}"
if [[ ${1} ]]
then
echo ${1}
fi
}
# Handle options
while getopts ":a:j:t:w:c:g:h" ARGUMENT
do
case ${ARGUMENT} in
a ) EBX_ADDRESS=$OPTARG;;
j ) JENKINS_VERSION=$OPTARG;;
p ) PACKAGE=$OPTARG;;
t ) EBX_TOKEN=$OPTARG;;
w ) EBX_WORKSPACE=$OPTARG;;
c ) FORK_COUNT=$OPTARG;;
g ) GITHUB_PROPERTIES=$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 ${EBX_ADDRESS} ]]
then
help "ElasticBox address must be specified."
exit 1
fi
if [[ ${JENKINS_VERSION} == 'latest' ]]
then
JENKINS_VERSION=$(get_latest_jenkins_version)
fi
if [[ -n ${JENKINS_VERSION} ]]
then
update_pom ${REPOSITORY_FOLDER}/pom.xml ${JENKINS_VERSION} ${FORK_COUNT}
else
JENKINS_VERSION=$(get_jenkins_version ${REPOSITORY_FOLDER})
fi
echo "------------------------------------------------"
echo "Building with Jenkins version ${JENKINS_VERSION}"
echo "------------------------------------------------"
echo "Testing against ElasticBox at ${EBX_ADDRESS}"
BUILD_OPTIONS="-B -DskipTests=false -Dmaven.javadoc.skip=true"
BUILD_OPTIONS="${BUILD_OPTIONS} -Delasticbox.jenkins.test.ElasticBoxURL=${EBX_ADDRESS}"
BUILD_OPTIONS="${BUILD_OPTIONS} -Dhudson.model.ParametersAction.keepUndefinedParameters=true"
BUILD_OPTIONS="${BUILD_OPTIONS} -Djenkins.test.timeout=1200"
if [[ -n ${EBX_WORKSPACE} ]]
then
BUILD_OPTIONS="${BUILD_OPTIONS} -Delasticbox.jenkins.test.workspace=${EBX_WORKSPACE}"
fi
if [[ -n ${GITHUB_PROPERTIES} ]]
then
BUILD_OPTIONS="${BUILD_OPTIONS} -Delasticbox.jenkins.test.GitHubProperties=${GITHUB_PROPERTIES}"
fi
if [[ -n ${EBX_TOKEN} ]]
then
BUILD_OPTIONS="${BUILD_OPTIONS} -Delasticbox.jenkins.test.accessToken=${EBX_TOKEN}"
fi
cd ${REPOSITORY_FOLDER}
echo "Executing: mvn ${BUILD_OPTIONS} clean install"
mvn ${BUILD_OPTIONS} clean install
# keep the test results and logs for the tested Jenkins version
TEST_RESULTS_FOLDER=${REPOSITORY_FOLDER}/results/${JENKINS_VERSION}
rm -rf ${TEST_RESULTS_FOLDER}
mkdir -p ${TEST_RESULTS_FOLDER}
cd target/surefire-reports
for FILE in $(ls)
do
if [ -f "${FILE}" ]
then
cp ${FILE} ${TEST_RESULTS_FOLDER}/${JENKINS_VERSION}_${FILE}
fi
done
if [[ -f "${REPOSITORY_FOLDER}/pom.xml.bak" ]]
then
mv -f ${REPOSITORY_FOLDER}/pom.xml.bak ${REPOSITORY_FOLDER}/pom.xml
fi