From 56cd622f5674dbc9a277a6c676f02d3077cd1ecf Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Mon, 28 Jul 2025 10:45:52 +0530 Subject: [PATCH 1/4] HBASE-29475 [hbase-thirdparty] Add spotless in pre commit check --- dev-support/jenkins/Jenkinsfile | 1 + dev-support/jenkins/hbase-personality.sh | 85 ++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 dev-support/jenkins/hbase-personality.sh diff --git a/dev-support/jenkins/Jenkinsfile b/dev-support/jenkins/Jenkinsfile index 0de41d9..298bcad 100644 --- a/dev-support/jenkins/Jenkinsfile +++ b/dev-support/jenkins/Jenkinsfile @@ -57,6 +57,7 @@ pipeline { JAVA8_HOME = "/usr/lib/jvm/java-8" JAVA17_HOME = "/usr/lib/jvm/java-17" PLUGINS = 'all' + PERSONALITY = "${WORKDIR}/${SRC_REL}/dev-support/jenkins/hbase-personality.sh" } diff --git a/dev-support/jenkins/hbase-personality.sh b/dev-support/jenkins/hbase-personality.sh new file mode 100644 index 0000000..4c8f784 --- /dev/null +++ b/dev-support/jenkins/hbase-personality.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +personality_plugins "all" + +## @description Globals specific to this personality +## @audience private +## @stability evolving +function personality_globals +{ + # shellcheck disable=SC2034 + BUILDTOOL=maven + #shellcheck disable=SC2034 + PROJECT_NAME=hbase-thirdparty + #shellcheck disable=SC2034 + PATCH_BRANCH_DEFAULT=master + #shellcheck disable=SC2034 + JIRA_ISSUE_RE='^HBASE-[0-9]+$' + #shellcheck disable=SC2034 + GITHUB_REPO="apache/hbase-thirdparty" +} + +###################################### +# Below plugin is copied from https://github.com/apache/hbase/blob/master/dev-support/hbase-personality.sh +###################################### + +add_test_type spotless + +## @description spotless file filter +## @audience private +## @stability evolving +## @param filename +function spotless_filefilter +{ + # always add spotless check as it can format almost all types of files + add_test spotless +} +## @description run spotless:check to check format issues +## @audience private +## @stability evolving +## @param repostatus +function spotless_rebuild +{ + local repostatus=$1 + local logfile="${PATCH_DIR}/${repostatus}-spotless.txt" + + if ! verify_needed_test spotless; then + return 0 + fi + + big_console_header "Checking spotless on ${repostatus}" + + start_clock + + local -a maven_args=('spotless:check') + + # disabled because "maven_executor" needs to return both command and args + # shellcheck disable=2046 + echo_and_redirect "${logfile}" $(maven_executor) "${maven_args[@]}" + + count=$(${GREP} -c '\[ERROR\]' "${logfile}") + if [[ ${count} -gt 0 ]]; then + add_vote_table -1 spotless "${repostatus} has ${count} errors when running spotless:check, run spotless:apply to fix." + add_footer_table spotless "@@BASE@@/${repostatus}-spotless.txt" + return 1 + fi + + add_vote_table +1 spotless "${repostatus} has no errors when running spotless:check." + return 0 +} + +###################################### From 6b5f2346a3fbd9091e1e82c9ac1590b6e89282ba Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Mon, 4 Aug 2025 18:59:16 +0530 Subject: [PATCH 2/4] Revert dummy change and rebase PR --- dev-support/jenkins/Jenkinsfile | 2 +- dev-support/jenkins/hbase-personality.sh | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/dev-support/jenkins/Jenkinsfile b/dev-support/jenkins/Jenkinsfile index 298bcad..5a20b5d 100644 --- a/dev-support/jenkins/Jenkinsfile +++ b/dev-support/jenkins/Jenkinsfile @@ -57,7 +57,7 @@ pipeline { JAVA8_HOME = "/usr/lib/jvm/java-8" JAVA17_HOME = "/usr/lib/jvm/java-17" PLUGINS = 'all' - PERSONALITY = "${WORKDIR}/${SRC_REL}/dev-support/jenkins/hbase-personality.sh" + PERSONALITY = "${SRC_REL}/dev-support/jenkins/hbase-personality.sh" } diff --git a/dev-support/jenkins/hbase-personality.sh b/dev-support/jenkins/hbase-personality.sh index 4c8f784..c6294e3 100644 --- a/dev-support/jenkins/hbase-personality.sh +++ b/dev-support/jenkins/hbase-personality.sh @@ -21,8 +21,6 @@ personality_plugins "all" ## @stability evolving function personality_globals { - # shellcheck disable=SC2034 - BUILDTOOL=maven #shellcheck disable=SC2034 PROJECT_NAME=hbase-thirdparty #shellcheck disable=SC2034 From ebdbeb0a222955d8f3311d1f3e3a8120ec272f53 Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Mon, 4 Aug 2025 19:08:19 +0530 Subject: [PATCH 3/4] Add personality to yetus --- dev-support/jenkins/jenkins_precommit_github_yetus.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev-support/jenkins/jenkins_precommit_github_yetus.sh b/dev-support/jenkins/jenkins_precommit_github_yetus.sh index 79cc8a0..7b0ea60 100755 --- a/dev-support/jenkins/jenkins_precommit_github_yetus.sh +++ b/dev-support/jenkins/jenkins_precommit_github_yetus.sh @@ -40,6 +40,7 @@ declare -a required_envs=( "SET_JAVA_HOME" "SOURCEDIR" "YETUSDIR" + "PERSONALITY" ) # Validate params for required_env in "${required_envs[@]}"; do @@ -85,6 +86,8 @@ fi YETUS_ARGS+=("--patch-dir=${PATCHDIR}") # where the source is located YETUS_ARGS+=("--basedir=${SOURCEDIR}") +YETUS_ARGS+=("--project=hbase-thirdparty") +YETUS_ARGS+=("--personality=${PERSONALITY}") # lots of different output formats YETUS_ARGS+=("--console-report-file=${PATCHDIR}/console.txt") # enable writing back to Github From 1316b7fbc46860ee4223edeb14d04657950f1221 Mon Sep 17 00:00:00 2001 From: Nihal Jain Date: Mon, 4 Aug 2025 19:39:06 +0530 Subject: [PATCH 4/4] Fix path --- dev-support/jenkins/Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev-support/jenkins/Jenkinsfile b/dev-support/jenkins/Jenkinsfile index 5a20b5d..0597228 100644 --- a/dev-support/jenkins/Jenkinsfile +++ b/dev-support/jenkins/Jenkinsfile @@ -56,8 +56,10 @@ pipeline { SET_JAVA_HOME = "/usr/lib/jvm/java-17" JAVA8_HOME = "/usr/lib/jvm/java-8" JAVA17_HOME = "/usr/lib/jvm/java-17" + WORKDIR_REL = "yetus-precommit-check" + WORKDIR = "${WORKSPACE}/${WORKDIR_REL}" PLUGINS = 'all' - PERSONALITY = "${SRC_REL}/dev-support/jenkins/hbase-personality.sh" + PERSONALITY = "${WORKDIR}/${SRC_REL}/dev-support/jenkins/hbase-personality.sh" }