diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /scripts/utils.sh | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r-- | scripts/utils.sh | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh index 92f647958fe..c71de666ac6 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -109,21 +109,38 @@ function install_junit_merge_gem() { function fail_on_warnings() { local cmd="$*" - local warnings - warnings="$(mktemp)" + local warning_file + warning_file="$(mktemp)" + + local allowed_warning_file + allowed_warning_file="$(mktemp)" - eval "$cmd 2>$warnings" + eval "$cmd 2>$warning_file" local ret=$? - if test -s "$warnings"; + # Filter out comments and empty lines from allowed warnings file. + grep --invert-match --extended-regexp "^#|^$" scripts/allowed_warnings.txt > "$allowed_warning_file" + + local warnings + # Filter out allowed warnings from stderr. + # Turn grep errors into warnings so we fail later. + warnings=$(grep --invert-match --extended-regexp --file "$allowed_warning_file" "$warning_file" 2>&1 || true) + + rm -f "$allowed_warning_file" + + if [ "$warnings" != "" ] then echoerr "There were warnings:" - cat "$warnings" - rm "$warnings" + echoerr "======================== Filtered warnings =====================================" + echo "$warnings" >&2 + echoerr "======================= Unfiltered warnings ====================================" + cat "$warning_file" >&2 + echoerr "================================================================================" + rm -f "$warning_file" return 1 fi - rm "$warnings" + rm -f "$warning_file" return $ret } |