From ea13fb610b5599983a90efbfe35cb98a5deae973 Mon Sep 17 00:00:00 2001 From: stephen Date: Thu, 1 Aug 2024 16:17:06 +0800 Subject: [PATCH] [ci](branch-3.0) support run cloud_p* and performance --- regression-test/pipeline/cloud_p0/prepare.sh | 24 +++++++++---------- .../pipeline/common/doris-utils.sh | 2 +- .../pipeline/performance/compile.sh | 4 ++-- .../pipeline/performance/deploy.sh | 4 ++++ .../pipeline/performance/prepare.sh | 8 +++++-- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/regression-test/pipeline/cloud_p0/prepare.sh b/regression-test/pipeline/cloud_p0/prepare.sh index df3cbe9fb9e860..64d2fbc10e363f 100644 --- a/regression-test/pipeline/cloud_p0/prepare.sh +++ b/regression-test/pipeline/cloud_p0/prepare.sh @@ -67,11 +67,11 @@ fi # shellcheck source=/dev/null source "$(bash "${teamcity_build_checkoutDir}"/regression-test/pipeline/common/get-or-set-tmp-env.sh 'get')" if ${skip_pipeline:=false}; then echo "INFO: skip build pipline" && exit 0; else echo "INFO: no skip"; fi -if [[ "${target_branch}" == "master" ]]; then +if [[ "${target_branch}" == "master" || "${target_branch}" == "branch-3.0" ]]; then echo "INFO: PR target branch ${target_branch}" install_java else - echo "WARNING: PR target branch ${target_branch} is NOT in (master), skip pipeline." + echo "WARNING: PR target branch ${target_branch} is NOT in (master, branch-3.0), skip pipeline." bash "${teamcity_build_checkoutDir}"/regression-test/pipeline/common/get-or-set-tmp-env.sh 'set' "export skip_pipeline=true" exit 0 fi @@ -107,11 +107,11 @@ install_fdb clean_fdb "cloud_instance_0" echo "#### 5. check if binary package ready" -merge_pr_to_master_commit() { +merge_pr_to_target_branch_compiled_commit() { local pr_num_from_trigger="$1" local target_branch="$2" - local master_commit="$3" - echo "INFO: merge pull request into ${target_branch} ${master_commit}" + local target_branch_compiled_commit="$3" + echo "INFO: merge pull request into ${target_branch} ${target_branch_compiled_commit}" if [[ -z "${teamcity_build_checkoutDir}" ]]; then echo "ERROR: env teamcity_build_checkoutDir not set" && return 1 fi @@ -120,10 +120,10 @@ merge_pr_to_master_commit() { git fetch origin "${target_branch}" git checkout "${target_branch}" git reset --hard origin/"${target_branch}" - git checkout "${master_commit}" + git checkout "${target_branch_compiled_commit}" returnValue=$? if [[ ${returnValue} -ne 0 ]]; then - echo "ERROR: checkout ${target_branch} ${master_commit} failed. please rebase to the newest version." + echo "ERROR: checkout ${target_branch} ${target_branch_compiled_commit} failed. please rebase to the newest version." return 1 fi git rev-parse HEAD @@ -132,7 +132,7 @@ merge_pr_to_master_commit() { echo "git fetch origin refs/pull/${pr_num_from_trigger}/head" git fetch origin "refs/pull/${pr_num_from_trigger}/head" git merge --no-edit --allow-unrelated-histories FETCH_HEAD - echo "INFO: merge refs/pull/${pr_num_from_trigger}/head into ${target_branch} ${master_commit}" + echo "INFO: merge refs/pull/${pr_num_from_trigger}/head into ${target_branch} ${target_branch_compiled_commit}" # CONFLICTS=$(git ls-files -u | wc -l) if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then echo "ERROR: merge refs/pull/${pr_num_from_trigger}/head into failed. Aborting" @@ -145,11 +145,11 @@ if ! check_oss_file_exist "${pr_num_from_trigger}_${commit_id_from_trigger}.tar. if download_oss_file "${pr_num_from_trigger}_${commit_id_from_trigger}.tar.gz"; then rm -rf "${teamcity_build_checkoutDir}"/output tar -I pigz -xf "${pr_num_from_trigger}_${commit_id_from_trigger}.tar.gz" - master_commit_file="master.commit" - if [[ -e output/${master_commit_file} ]]; then + target_branch_compiled_commit_file="master.commit" + if [[ -e output/${target_branch_compiled_commit_file} ]]; then # checkout to master commit and merge this pr, to ensure binary and case are same version - master_commit=$(cat output/"${master_commit_file}") - if merge_pr_to_master_commit "${pr_num_from_trigger}" "${target_branch}" "${master_commit}"; then + target_branch_compiled_commit=$(cat output/"${target_branch_compiled_commit_file}") + if merge_pr_to_target_branch_compiled_commit "${pr_num_from_trigger}" "${target_branch}" "${target_branch_compiled_commit}"; then echo "INFO: merged done" if [[ "${teamcity_buildType_id:-}" == "Doris_DorisCloudRegression_CloudP1" ]]; then echo "INFO: 用cloud_p1/conf覆盖cloud_p0/conf" diff --git a/regression-test/pipeline/common/doris-utils.sh b/regression-test/pipeline/common/doris-utils.sh index 51bc0bece7af28..2916bf71221467 100644 --- a/regression-test/pipeline/common/doris-utils.sh +++ b/regression-test/pipeline/common/doris-utils.sh @@ -94,7 +94,7 @@ function install_java() { [[ -z "$(find /usr/lib/jvm -maxdepth 1 -type d -name 'java-8-*')" ]]; then sudo apt update && sudo apt install openjdk-8-jdk -y >/dev/null fi - # doris master branch use java-17 + # doris master and branch-3.0 use java-17 if ! java -version >/dev/null || [[ -z "$(find /usr/lib/jvm -maxdepth 1 -type d -name 'java-17-*')" ]]; then sudo apt update && sudo apt install openjdk-17-jdk -y >/dev/null diff --git a/regression-test/pipeline/performance/compile.sh b/regression-test/pipeline/performance/compile.sh index 3a668cd3fdfdd3..34f49db0c100d8 100644 --- a/regression-test/pipeline/performance/compile.sh +++ b/regression-test/pipeline/performance/compile.sh @@ -76,7 +76,7 @@ merge_pr_to_target_branch_latest() { fi } -if [[ "${target_branch}" == "master" ]]; then +if [[ "${target_branch}" == "master" || "${target_branch}" == "branch-3.0" ]]; then REMOTE_CCACHE='/mnt/remote_ccache_master' docker_image="apache/doris:build-env-ldb-toolchain-0.19-latest" elif [[ "${target_branch}" == "branch-2.0" ]]; then @@ -109,7 +109,7 @@ if sudo docker ps -a --no-trunc | grep "${docker_name}"; then fi rm -f custom_env.sh cp "${teamcity_build_checkoutDir}"/regression-test/pipeline/performance/conf/custom_env.sh . -if [[ "${target_branch}" == "master" ]]; then +if [[ "${target_branch}" == "master" || "${target_branch}" == "branch-3.0" ]]; then echo "export JAVA_HOME=/usr/lib/jvm/jdk-17.0.2" >>custom_env.sh fi rm -rf "${teamcity_build_checkoutDir}"/output diff --git a/regression-test/pipeline/performance/deploy.sh b/regression-test/pipeline/performance/deploy.sh index 9f29fd8d256385..36870058641fab 100644 --- a/regression-test/pipeline/performance/deploy.sh +++ b/regression-test/pipeline/performance/deploy.sh @@ -68,6 +68,10 @@ exit_flag=0 cp -f "${teamcity_build_checkoutDir}"/regression-test/pipeline/performance/conf/fe_custom.conf "${DORIS_HOME}"/fe/conf/ cp -f "${teamcity_build_checkoutDir}"/regression-test/pipeline/performance/conf/be_custom.conf "${DORIS_HOME}"/be/conf/ target_branch="$(echo "${target_branch}" | sed 's| ||g;s|\.||g;s|-||g')" # remove space、dot、hyphen from branch name + if [[ "${target_branch}" == "branch30" ]]; then + # branch-3.0 also use master data + target_branch="master" + fi sed -i "s|^meta_dir=/data/doris-meta-\${branch_name}|meta_dir=/data/doris-meta-${target_branch}${meta_changed_suffix:-}|g" "${DORIS_HOME}"/fe/conf/fe_custom.conf sed -i "s|^storage_root_path=/data/doris-storage-\${branch_name}|storage_root_path=/data/doris-storage-${target_branch}${meta_changed_suffix:-}|g" "${DORIS_HOME}"/be/conf/be_custom.conf diff --git a/regression-test/pipeline/performance/prepare.sh b/regression-test/pipeline/performance/prepare.sh index 1f8e22aed097ac..c4d6050ad6aa58 100644 --- a/regression-test/pipeline/performance/prepare.sh +++ b/regression-test/pipeline/performance/prepare.sh @@ -74,7 +74,7 @@ source "$(bash "${teamcity_build_checkoutDir}"/regression-test/pipeline/common/g source "${teamcity_build_checkoutDir}"/regression-test/pipeline/common/doris-utils.sh if ${skip_pipeline:=false}; then echo "INFO: skip build pipline" && exit 0; else echo "INFO: no skip"; fi -if [[ "${target_branch}" == "master" ]]; then +if [[ "${target_branch}" == "master" || "${target_branch}" == "branch-3.0" ]]; then echo "INFO: PR target branch ${target_branch}" install_java JAVA_HOME="${JAVA_HOME:-$(find /usr/lib/jvm -maxdepth 1 -type d -name 'java-17-*' | sed -n '1p')}" @@ -82,7 +82,7 @@ if [[ "${target_branch}" == "master" ]]; then elif [[ "${target_branch}" == "branch-2.0" ]]; then echo "INFO: PR target branch ${target_branch}" else - echo "WARNING: PR target branch ${target_branch} is NOT in (master, branch-2.0), skip pipeline." + echo "WARNING: PR target branch ${target_branch} is NOT in (master, branch-3.0, branch-2.0), skip pipeline." bash "${teamcity_build_checkoutDir}"/regression-test/pipeline/common/get-or-set-tmp-env.sh 'set' "export skip_pipeline=true" exit 0 fi @@ -98,6 +98,10 @@ if _get_pr_changed_files "${pr_num_from_trigger}"; then # if PR changed the doris meta file, the next PR deployment on the same mechine which built this PR will fail. # make a copy of the meta file for the meta changed PR. target_branch="$(echo "${target_branch}" | sed 's| ||g;s|\.||g;s|-||g')" # remove space、dot、hyphen from branch name + if [[ "${target_branch}" == "branch30" ]]; then + # branch-3.0 also use master data + target_branch="master" + fi meta_changed_suffix="_2" rsync -a --delete "/data/doris-meta-${target_branch}/" "/data/doris-meta-${target_branch}${meta_changed_suffix}" rsync -a --delete "/data/doris-storage-${target_branch}/" "/data/doris-storage-${target_branch}${meta_changed_suffix}"