Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·126 lines (110 loc) · 3.54 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·126 lines (110 loc) · 3.54 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
117
118
119
120
121
122
123
124
125
126
#!/bin/bash
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eo pipefail
## Get the directory of the build script
scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}"))
## cd to the parent directory, i.e. the root of the git repo
cd ${scriptDir}/..
# include common functions
source ${scriptDir}/common.sh
# Use GCP Maven Mirror
mkdir -p ${HOME}/.m2
cp settings.xml ${HOME}/.m2
# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it
if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then
export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS})
fi
if [ -f "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" ]; then
source "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets"
fi
function setup_cloud() {
gcloud config set project "$GOOGLE_CLOUD_PROJECT"
terraform -version &&
source ./.cloud/helpers/init.sh "$1" &&
source ./.cloud/helpers/plan.sh "$1" &&
source ./.cloud/helpers/apply.sh &&
source ./.cloud/helpers/populate-env.sh
destroy() {
arguments=$?
time source ./.cloud/helpers/destroy.sh
exit $arguments
}
trap destroy EXIT
}
RETURN_CODE=0
case ${JOB_TYPE} in
test)
retry_with_backoff 3 10 \
mvn -B -ntp \
-Dclirr.skip=true \
-Denforcer.skip=true \
-Dcheckstyle.skip=true \
-Dflatten.skip=true \
-Danimal.sniffer.skip=true \
-Dmaven.wagon.http.retryHandler.count=5 \
-T 1C \
test
RETURN_CODE=$?
echo "Finished running unit tests"
;;
integration)
generate_modified_modules_list
if [[ ${#modified_module_list[@]} -gt 0 ]]; then
module_list=$(
IFS=,
echo "${modified_module_list[*]}"
)
setup_cloud "$module_list"
install_modules
run_integration_tests "$module_list"
else
echo "No Integration Tests to run"
fi
;;
graalvm)
generate_graalvm_modules_list
if [ ! -z "${module_list}" ]; then
printf "Running GraalVM checks for:\n%s\n" "${module_list}"
setup_cloud "$module_list"
install_modules
run_graalvm_tests "$module_list"
else
echo "Not running GraalVM checks -- No changes in relevant modules"
fi
;;
graalvm17)
generate_graalvm_modules_list
if [ ! -z "${module_list}" ]; then
printf "Running GraalVM 17 checks for:\n%s\n" "${module_list}"
setup_cloud "$module_list"
install_modules
run_graalvm_tests "$module_list"
else
echo "Not running GraalVM 17 checks -- No changes in relevant modules"
fi
;;
*) ;;
esac
if [ "${REPORT_COVERAGE}" == "true" ]; then
bash ${KOKORO_GFILE_DIR}/codecov.sh
fi
# fix output location of logs
bash .kokoro/coerce_logs.sh
if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then
chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot
${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java
fi
echo "exiting with ${RETURN_CODE}"
exit ${RETURN_CODE}