Skip to content

Commit c5d1bbf

Browse files
hello-stephenclaude
andcommitted
[fix](ci) build cred redaction sed expr only from non-empty vars
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 433c4e8 commit c5d1bbf

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

regression-test/pipeline/common/doris-utils.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,14 @@ _monitor_regression_log() {
662662

663663
}
664664

665+
_redact_creds() {
666+
local expr="" v
667+
for v in "${hwYunAk:-}" "${hwYunSk:-}" "${s3SourceAk:-}" "${s3SourceSk:-}" "${txYunAk:-}" "${txYunSk:-}"; do
668+
[[ -n "${v}" ]] && expr+="s/${v}//g;"
669+
done
670+
[[ -n "${expr}" ]] && sed -i "${expr}" "$@" &>/dev/null || true
671+
}
672+
665673
archive_doris_logs() {
666674
if [[ ! -d "${DORIS_HOME:-}" ]]; then return 1; fi
667675
local archive_name="$1"
@@ -674,19 +682,19 @@ archive_doris_logs() {
674682
(
675683
cd "${DORIS_HOME}" || return 1
676684
cp --parents -rf "fe/conf" "${archive_dir}"/
677-
if sed -i "s/${hwYunAk:-}//g;s/${hwYunSk:-}//g;s/${s3SourceAk:-}//g;s/${s3SourceSk:-}//g;s/${txYunAk:-}//g;s/${txYunSk:-}//g" fe/log/* &>/dev/null; then :; fi
685+
_redact_creds fe/log/*
678686
cp --parents -rf "fe/log" "${archive_dir}"/
679687
cp --parents -rf "be/conf" "${archive_dir}"/
680-
if sed -i "s/${hwYunAk:-}//g;s/${hwYunSk:-}//g;s/${s3SourceAk:-}//g;s/${s3SourceSk:-}//g;s/${txYunAk:-}//g;s/${txYunSk:-}//g" be/log/* &>/dev/null; then :; fi
688+
_redact_creds be/log/*
681689
cp --parents -rf "be/log" "${archive_dir}"/
682690
if [[ -d "${DORIS_HOME}"/regression-test/log ]]; then
683691
# try to hide ak and sk
684-
if sed -i "s/${hwYunAk:-}//g;s/${hwYunSk:-}//g;s/${s3SourceAk:-}//g;s/${s3SourceSk:-}//g;s/${txYunAk:-}//g;s/${txYunSk:-}//g" regression-test/log/* &>/dev/null; then :; fi
692+
_redact_creds regression-test/log/*
685693
cp --parents -rf "regression-test/log" "${archive_dir}"/
686694
fi
687695
if [[ -d "${DORIS_HOME}"/../regression-test/conf ]]; then
688696
# try to hide ak and sk
689-
if sed -i "s/${hwYunAk:-}//g;s/${hwYunSk:-}//g;s/${s3SourceAk:-}//g;s/${s3SourceSk:-}//g;s/${txYunAk:-}//g;s/${txYunSk:-}//g" ../regression-test/conf/* &>/dev/null; then :; fi
697+
_redact_creds ../regression-test/conf/*
690698
mkdir -p "${archive_dir}"/regression-test/conf
691699
cp -rf ../regression-test/conf/* "${archive_dir}"/regression-test/conf/
692700
fi

0 commit comments

Comments
 (0)