Skip to content

Commit 299089e

Browse files
HADOOP-17816. Run optional CI for changes in C
* We need to ensure that we run the CI for all the platforms when there are changes in C files.
1 parent 4627e9c commit 299089e

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

dev-support/jenkins.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
# We use Ubuntu Focal as the main platform for building Hadoop, thus
2222
# it runs for all the PRs. Additionally, we also ensure that
2323
# Hadoop builds across the supported platforms whenever there's a change
24-
# in any of the C++ files, C++ build files or platform changes.
24+
# in any of the C/C++ files, C/C++ build files or platform changes.
2525

26-
## @description Check if the given extension is related to C++
26+
## @description Check if the given extension is related to C/C++
2727
## @param seeking
2828
## @return 0 if yes
2929
## @return 1 if no
30-
is_cpp_extension() {
31-
local cpp_extensions=("cc" "cpp" "h" "hpp")
30+
is_c_cpp_extension() {
31+
local c_cpp_extension=("c" "cc" "cpp" "h" "hpp")
3232
local seeking=$1
3333

34-
for element in "${cpp_extensions[@]}"; do
34+
for element in "${c_cpp_extension[@]}"; do
3535
if [[ $element == "$seeking" ]]; then
3636
return 0
3737
fi
@@ -50,41 +50,41 @@ is_platform_change() {
5050

5151
for path in "${SOURCEDIR}"/dev-support/docker/Dockerfile* "${SOURCEDIR}"/dev-support/docker/pkg-resolver/*.json; do
5252
if [ "${in_path}" == "${path}" ]; then
53-
echo "Found C++ platform related changes in ${in_path}"
53+
echo "Found C/C++ platform related changes in ${in_path}"
5454
return 0
5555
fi
5656
done
5757
return 1
5858
}
5959

6060
## @description Checks if the given path corresponds to a change
61-
## in C++ files or related to C++ build system
61+
## in C/C++ files or related to C/C++ build system
6262
## @param path
6363
## @return 0 if yes
6464
## @return 1 if no
65-
is_cpp_change() {
65+
is_c_cpp_change() {
6666
shopt -s nocasematch
6767

6868
local path=$1
6969
declare filename
7070
filename=$(basename -- "${path}")
7171
extension=${filename##*.}
7272

73-
if is_cpp_extension "${extension}"; then
74-
echo "Found C++ changes in ${path}"
73+
if is_c_cpp_extension "${extension}"; then
74+
echo "Found C/C++ changes in ${path}"
7575
return 0
7676
fi
7777

7878
if [[ $filename =~ CMakeLists\.txt ]]; then
79-
echo "Found C++ build related changes in ${path}"
79+
echo "Found C/C++ build related changes in ${path}"
8080
return 0
8181
fi
8282
return 1
8383
}
8484

8585
## @description Check if the CI needs to be run - CI will always run if
8686
## IS_OPTIONAL is 0, or if there's any change in
87-
## C++/C++ build/platform
87+
## C/C++ files or C/C++ build or platform
8888
## @return 0 if yes
8989
## @return 1 if no
9090
function check_ci_run() {
@@ -94,7 +94,7 @@ function check_ci_run() {
9494
# Loop over the paths of all the changed files and check if the criteria
9595
# to run the CI has been satisfied
9696
for path in $(git --git-dir "${SOURCEDIR}/.git" diff --name-only "${firstCommitOfThisPr}" HEAD); do
97-
if is_cpp_change "${path}"; then
97+
if is_c_cpp_change "${path}"; then
9898
return 0
9999
fi
100100

@@ -242,7 +242,7 @@ if [ "$1" == "run_ci" ]; then
242242
if check_ci_run; then
243243
run_ci
244244
else
245-
echo "No C++ file/C++ build/platform changes found, will not run CI"
245+
echo "No C/C++ file or C/C++ build or platform changes found, will not run CI for this platform"
246246
fi
247247
elif [ "$1" == "cleanup_ci_proc" ]; then
248248
cleanup_ci_proc

0 commit comments

Comments
 (0)