This is an automated email from the ASF dual-hosted git repository. yihua pushed a commit to branch branch-0.x in repository https://gitbox.apache.org/repos/asf/hudi.git
commit 111d1389ba51e09435e80eca77c04c4744cb0bfc Author: Y Ethan Guo <[email protected]> AuthorDate: Wed Mar 6 11:07:36 2024 -0800 [MINOR] Publish test results from the containerized job to Azure (#10818) --- azure-pipelines-20230430.yml | 21 ++++++++++++-- scripts/ci/move_surefire_reports.sh | 58 +++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/azure-pipelines-20230430.yml b/azure-pipelines-20230430.yml index fef10058c8c..b1e3ee5d4d6 100644 --- a/azure-pipelines-20230430.yml +++ b/azure-pipelines-20230430.yml @@ -255,8 +255,23 @@ stages: repository: 'apachehudi/hudi-ci-bundle-validation-base' command: 'run' arguments: > + -v $(Build.SourcesDirectory):/hudi -i docker.io/apachehudi/hudi-ci-bundle-validation-base:$(Build.BuildId) - /bin/bash -c "mvn clean install $(MVN_OPTS_INSTALL) -Phudi-platform-service -Pthrift-gen-source + /bin/bash -c "pwd + && rm -rf /hudi/scripts/ci/results + && mvn clean install $(MVN_OPTS_INSTALL) -Phudi-platform-service -Pthrift-gen-source && mvn test $(MVN_OPTS_TEST) -Punit-tests -pl $(JOB5_UT_MODULES) - && mvn test $(MVN_OPTS_TEST) -Pfunctional-tests -pl $(JOB5_UT_MODULES) - && grep \"testcase\" */target/surefire-reports/*.xml */*/target/surefire-reports/*.xml | awk -F'\"' ' { print $6,$4,$2 } ' | sort -nr | head -n 100" + && mvn test $(MVN_OPTS_TEST) -Pfunctional-tests -pl $(JOB5_FT_MODULES) + && ./scripts/ci/move_surefire_reports.sh /hudi /hudi/scripts/ci/results + && echo 'All surefire report files:' + && find . -type f -name \"TEST-*.xml\"" + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + inputs: + testResultsFormat: 'JUnit' + testResultsFiles: '**/surefire-reports/TEST-*.xml' + searchFolder: '$(Build.SourcesDirectory)/scripts/ci/results' + failTaskOnFailedTests: true + - script: | + grep "testcase" scripts/ci/results/*/target/surefire-reports/*.xml scripts/ci/results/*/*/target/surefire-reports/*.xml | awk -F'"' ' { print $6,$4,$2 } ' | sort -nr | head -n 100 + displayName: Top 100 long-running testcases diff --git a/scripts/ci/move_surefire_reports.sh b/scripts/ci/move_surefire_reports.sh new file mode 100755 index 00000000000..a4b9b2869bd --- /dev/null +++ b/scripts/ci/move_surefire_reports.sh @@ -0,0 +1,58 @@ +#!/bin/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. +# + +# Check if two arguments were provided +if [ "$#" -ne 2 ]; then + echo "Usage: $0 <source_directory> <destination_directory>" + exit 1 +fi + +# Assign the first and second argument to SOURCE and DEST variables +SOURCE="$1" +DEST="$2" + +# Ensure the source directory exists +if [ ! -d "$SOURCE" ]; then + echo "Source directory does not exist: $SOURCE" + exit 1 +fi + +# Create the destination directory if it doesn't exist +if [ ! -d "$DEST" ]; then + mkdir -p "$DEST" +fi + +find "$SOURCE" -type f -name "TEST-*.xml" | while IFS= read -r file; do + # Extract the relative directory path + relative_path="${file#$SOURCE}" + destination_path="$DEST$relative_path" + destination_dir=$(dirname "$destination_path") + + if [[ "$relative_path" == *"scripts/ci"* ]]; then + continue # Skip this file + fi + + # Create the destination directory if it doesn't exist + mkdir -p "$destination_dir" + + # Move the file to the new location, preserving the directory structure + mv "$file" "$destination_path" +done
