Skip to content

Commit 3dbfe52

Browse files
authored
HBASE-29878 Improve the Documentation UI (addendum) - fix author check in nightly (#7952)
Ignore files under hbase-website in author checks. For this we monkey-patch YETUS-1266 fix for author_postcompile function in our hbase-personality.sh. YETUS-1266 Escape regex metacharacters in author plugin ignore list The author_postcompile function writes --author-ignore-list entries directly into a grep -E filter file without escaping. Filenames containing regex metacharacters (parentheses, brackets, etc.) are silently misinterpreted as pattern syntax, causing those files to pass through unfiltered. Signed-off-by: Nick Dimiduk <ndimiduk@apache.org>
1 parent 5889015 commit 3dbfe52

7 files changed

Lines changed: 57 additions & 6 deletions

.github/workflows/yetus-general-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
SOURCEDIR: "${{ github.workspace }}/src"
116116
TESTS_FILTER: "checkstyle,javac,pylint,shellcheck,shelldocs,blanks,perlcritic,ruby-lint,rubocop"
117117
YETUSDIR: "${{ github.workspace }}/yetus"
118-
AUTHOR_IGNORE_LIST: "src/main/asciidoc/_chapters/developer.adoc"
118+
AUTHOR_IGNORE_LIST: "hbase-website/app/pages/_docs/docs/_mdx/(multi-page)/building-and-developing/developer-guidelines.mdx,hbase-website/public/book.html"
119119
BLANKS_EOL_IGNORE_FILE: "dev-support/blanks-eol-ignore.txt"
120120
BLANKS_TABS_IGNORE_FILE: "dev-support/blanks-tabs-ignore.txt"
121121
EXCLUDE_TESTS_URL: "https://ci-hbase.apache.org/job/HBase-Find-Flaky-Tests/job/${{ github.base_ref }}/lastSuccessfulBuild/artifact/output/excludes"

.github/workflows/yetus-jdk17-hadoop3-compile-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
SOURCEDIR: "${{ github.workspace }}/src"
115115
TESTS_FILTER: "javac,javadoc"
116116
YETUSDIR: "${{ github.workspace }}/yetus"
117-
AUTHOR_IGNORE_LIST: "src/main/asciidoc/_chapters/developer.adoc"
117+
AUTHOR_IGNORE_LIST: "hbase-website/app/pages/_docs/docs/_mdx/(multi-page)/building-and-developing/developer-guidelines.mdx,hbase-website/public/book.html"
118118
BLANKS_EOL_IGNORE_FILE: "dev-support/blanks-eol-ignore.txt"
119119
BLANKS_TABS_IGNORE_FILE: "dev-support/blanks-tabs-ignore.txt"
120120
BUILD_THREAD: "4"

.github/workflows/yetus-jdk17-hadoop3-unit-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
SET_JAVA_HOME: "/usr/lib/jvm/java-17"
133133
SOURCEDIR: "${{ github.workspace }}/src"
134134
YETUSDIR: "${{ github.workspace }}/yetus"
135-
AUTHOR_IGNORE_LIST: "src/main/asciidoc/_chapters/developer.adoc"
135+
AUTHOR_IGNORE_LIST: "hbase-website/app/pages/_docs/docs/_mdx/(multi-page)/building-and-developing/developer-guidelines.mdx,hbase-website/public/book.html"
136136
BLANKS_EOL_IGNORE_FILE: "dev-support/blanks-eol-ignore.txt"
137137
BLANKS_TABS_IGNORE_FILE: "dev-support/blanks-tabs-ignore.txt"
138138
EXCLUDE_TESTS_URL: "https://ci-hbase.apache.org/job/HBase-Find-Flaky-Tests/job/${{ github.base_ref }}/lastSuccessfulBuild/artifact/output/excludes"

dev-support/Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pipeline {
4343
PROJECT_PERSONALITY = 'https://raw.githubusercontent.com/apache/hbase/master/dev-support/hbase-personality.sh'
4444
PERSONALITY_FILE = 'tools/personality.sh'
4545
// This section of the docs tells folks not to use the javadoc tag. older branches have our old version of the check for said tag.
46-
AUTHOR_IGNORE_LIST = 'src/main/asciidoc/_chapters/developer.adoc'
46+
AUTHOR_IGNORE_LIST = 'hbase-website/app/pages/_docs/docs/_mdx/(multi-page)/building-and-developing/developer-guidelines.mdx,hbase-website/public/book.html'
4747
BLANKS_EOL_IGNORE_FILE = 'dev-support/blanks-eol-ignore.txt'
4848
BLANKS_TABS_IGNORE_FILE = 'dev-support/blanks-tabs-ignore.txt'
4949
// output from surefire; sadly the archive function in yetus only works on file names.

dev-support/Jenkinsfile_GitHub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pipeline {
4141
GENERAL_CHECK_PLUGINS = 'all,-javadoc,-jira,-shadedjars,-unit'
4242
JDK_SPECIFIC_PLUGINS = 'compile,github,htmlout,javac,javadoc,maven,mvninstall,shadedjars,unit'
4343
// This section of the docs tells folks not to use the javadoc tag. older branches have our old version of the check for said tag.
44-
AUTHOR_IGNORE_LIST = 'src/main/asciidoc/_chapters/developer.adoc'
44+
AUTHOR_IGNORE_LIST = 'hbase-website/app/pages/_docs/docs/_mdx/(multi-page)/building-and-developing/developer-guidelines.mdx,hbase-website/public/book.html'
4545
BLANKS_EOL_IGNORE_FILE = 'dev-support/blanks-eol-ignore.txt'
4646
BLANKS_TABS_IGNORE_FILE = 'dev-support/blanks-tabs-ignore.txt'
4747
// output from surefire; sadly the archive function in yetus only works on file names.

dev-support/hadoop3-backwards-compatibility-check.Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ pipeline {
135135
SKIP_ERRORPRONE = true
136136
OUTPUT_DIR_RELATIVE = "output-jdk17-hadoop3-backwards-${HADOOP3_VERSION}"
137137
OUTPUT_DIR = "${WORKSPACE}/${OUTPUT_DIR_RELATIVE}"
138-
AUTHOR_IGNORE_LIST = 'src/main/asciidoc/_chapters/developer.adoc'
138+
AUTHOR_IGNORE_LIST = 'hbase-website/app/pages/_docs/docs/_mdx/(multi-page)/building-and-developing/developer-guidelines.mdx,hbase-website/public/book.html'
139139
BLANKS_EOL_IGNORE_FILE = 'dev-support/blanks-eol-ignore.txt'
140140
BLANKS_TABS_IGNORE_FILE = 'dev-support/blanks-tabs-ignore.txt'
141141
// output from surefire; sadly the archive function in yetus only works on file names.

dev-support/hbase-personality.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,57 @@ function personality_modules
290290
done
291291
}
292292

293+
# This is a workaround to fix the author check until YETUS-1266 is released.
294+
# TODO: Remove this when we upgraded to Yetus having YETUS-1266!
295+
## @description Check the current directory for author tags
296+
## @audience private
297+
## @stability evolving
298+
## @replaceable no
299+
## @return 0 on success
300+
## @return 1 on failure
301+
function author_postcompile
302+
{
303+
# shellcheck disable=SC2155
304+
declare -r appname=$(basename "${BASH_SOURCE-$0}")
305+
declare -a globalignore
306+
307+
if [[ "${BUILDMODE}" != full ]]; then
308+
return
309+
fi
310+
311+
big_console_header "Checking for @author tags: ${BUILDMODE}"
312+
313+
start_clock
314+
315+
if [[ -f "${PATCH_DIR}/excluded.txt" ]]; then
316+
globalignore=("${GREP}" "-v" "-f" "${PATCH_DIR}/excluded.txt")
317+
else
318+
globalignore=("cat")
319+
fi
320+
321+
"${GIT}" grep -n -I --extended-regexp -i -e '^[^-].*@author' \
322+
| "${GREP}" -v "${appname}" \
323+
| "${globalignore[@]}" \
324+
>> "${PATCH_DIR}/author-tags-git.txt"
325+
326+
if [[ -z "${AUTHOR_IGNORE_LIST[0]}" ]]; then
327+
cp -p "${PATCH_DIR}/author-tags-git.txt" "${PATCH_DIR}/${AUTHOR_LOGNAME}"
328+
else
329+
for i in "${AUTHOR_IGNORE_LIST[@]}"; do
330+
printf "%s\n" "${i}"
331+
done \
332+
| "${SED}" 's/[][\\.^$*+?{}()|]/\\&/g' \
333+
| "${SED}" 's/^/^/' \
334+
> "${PATCH_DIR}/author-tags-filter.txt"
335+
"${GREP}" -v -E \
336+
-f "${PATCH_DIR}/author-tags-filter.txt" \
337+
"${PATCH_DIR}/author-tags-git.txt" \
338+
> "${PATCH_DIR}/${AUTHOR_LOGNAME}"
339+
fi
340+
341+
author_generic
342+
}
343+
293344
## @description places where we override the built in assumptions about what tests to run
294345
## @audience private
295346
## @stability evolving

0 commit comments

Comments
 (0)