-
Notifications
You must be signed in to change notification settings - Fork 7
/
update-quarkus.sh
executable file
·144 lines (119 loc) · 3.41 KB
/
update-quarkus.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/usr/bin/env bash
set -euo pipefail
version=unset
project=unset
diffonly=unset
REQ=(xsltproc quarkus mvn git getopt)
for R in ${REQ[@]}; do
command -v ${R} >/dev/null 2>&1 || { echo >&2 "This script requires '${R}' but it's not installed. Aborting."; exit 1; }
done
usage() {
>&2 cat << EOF
Usage: $0
[ -p | --project input (e.g. quarkus-rest-data-consumer) ]
[ -v | --version input (e.g. 3.11.0) ]
[ -d | --diffonly ]
[ -h | --help ]
EOF
exit 1
}
# Printing Git DIFF
run_diff() {
for PROJ in ${PROJECTS[@]}; do
echo -e "\n\n----------------------------------------------------------"
echo -e "Project Git Diff: $PROJ"
echo -e "----------------------------------------------------------"
cat ${ROOT_PWD}/${DIFF_DIR}/${PROJ}_git.log
echo -e "---\n"
done
}
args=$(getopt -a -o p:v:dh --long project:,version:,diffonly,help -- "$@")
if [[ $? -gt 0 ]]; then
usage
fi
eval set -- ${args}
while :
do
case $1 in
-p | --project) project=$2 ; shift 2 ;;
-v | --version) version=$2 ; shift 2 ;;
-d | --diff) diffonly=yes ; shift ;;
-h | --help) usage ; shift ;;
# -- means the end of the arguments; drop this, and break out of the while loop
--) shift; break ;;
*) >&2 echo Unsupported option: $1
usage ;;
esac
done
PROJECTS=(
dev-services
quarkus-getting-started
quarkus-rest-data-consumer
quarkus-rest-data-producer
quarkus-reactive-rest-consumer
quarkus-reactive-rest-producer
quarkus-metrics-data-producer
quarkus-metrics-data-consumer
quarkus-opentelemetry-jaeger
quarkus-reactive-messaging-consumer
quarkus-reactive-messaging-producer
quarkus-cloudevents-consumer
quarkus-cloudevents-producer
techlab-extension-appinfo
quarkus-appinfo-application
)
SOLUTION_DIR="solution"
DIFF_DIR_PREFIX="diff-update"
ROOT_PWD=`pwd`
if [ "${project}" == "unset" ]; then
echo "Using default project list";
else
echo "Using project $project";
if [ ! -d ${SOLUTION_DIR}/${project} ]; then
echo "Project $project specified but does not exist."
exit 1
fi
PROJECTS=("$project")
fi
if [ "${version}" == "unset" ]; then
echo "Quarkus version not specified";
version=`quarkus --version`
fi
DIFF_DIR=${DIFF_DIR_PREFIX}/${version}
TS=`date +%Y%m%d%H%M%S`
echo "Upgrade Quarkus version: $version"
echo "Latest Quarkus version: `quarkus --version`"
echo "Diff output directory: ${DIFF_DIR}"
echo "Run Timestamp: $TS"
if [ "${diffonly}" == "yes" ]; then
echo "Running diff only";
run_diff
exit
fi
if [ ! -d $DIFF_DIR ]; then
echo "Creating ${DIFF_DIR}"
mkdir -p $DIFF_DIR
fi
for PROJ in ${PROJECTS[@]}; do
cd ${ROOT_PWD}/${SOLUTION_DIR}/${PROJ}
echo "Updating Project ${SOLUTION_DIR}/${PROJ}"
quarkus update --platform-version=$version
echo "Writing git diff to: ${ROOT_PWD}/${DIFF_DIR}/${PROJ}.log"
git diff . > ${ROOT_PWD}/${DIFF_DIR}/${PROJ}_git.log 2>&1
if [[ "${PROJ}" == *"extension"* ]]; then
echo "$PROJ is an quarkus extension. Running maven package install."
mvn clean package install > ${ROOT_PWD}/${DIFF_DIR}/${PROJ}_maven.log 2>&1
else
echo "$PROJ is a quarkus application. Running maven test"
./mvnw clean test > ${ROOT_PWD}/${DIFF_DIR}/${PROJ}_maven.log 2>&1
fi
if [[ "$?" -ne 0 ]]; then
echo 'Running tests failed.';
exit $rc
fi
echo "Generating dependencies csv for ${SOLUTION_DIR}/${PROJ}/pom.xml"
xsltproc ${ROOT_PWD}/dependencies.xsl pom.xml > dependencies.csv
cd $ROOT_PWD
done
run_diff
echo "all done."