You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2020/10/18 14:09:18 UTC

[hbase] 01/01: HBASE-25194 Do not publish workspace in flaky find job

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch HBASE-25194
in repository https://gitbox.apache.org/repos/asf/hbase.git

commit 25f06607e8625229734b1b063a7273101c2d3fb5
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Sun Oct 18 22:03:22 2020 +0800

    HBASE-25194 Do not publish workspace in flaky find job
---
 dev-support/flaky-tests/flaky-reporting.Jenkinsfile | 10 +++++++---
 dev-support/flaky-tests/report-flakies.py           | 17 ++++++++++++-----
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/dev-support/flaky-tests/flaky-reporting.Jenkinsfile b/dev-support/flaky-tests/flaky-reporting.Jenkinsfile
index 640b1cb..d6ac602 100644
--- a/dev-support/flaky-tests/flaky-reporting.Jenkinsfile
+++ b/dev-support/flaky-tests/flaky-reporting.Jenkinsfile
@@ -31,6 +31,9 @@ pipeline {
   parameters {
     booleanParam(name: 'DEBUG', defaultValue: false, description: 'Produce a lot more meta-information.')
   }
+  environment {
+    OUTPUT_DIR_RELATIVE_REPORT = "output-report"
+  }
   stages {
     stage ('build flaky report') {
       steps {
@@ -43,7 +46,8 @@ pipeline {
           flaky_args=("${flaky_args[@]}" --urls "${JENKINS_URL}/job/HBase/job/HBase%20Nightly/job/${BRANCH_NAME}" --is-yetus True --max-builds 10)
           flaky_args=("${flaky_args[@]}" --urls "${JENKINS_URL}/job/HBase/job/HBase-Flaky-Tests/job/${BRANCH_NAME}" --is-yetus False --max-builds 30)
           docker build -t hbase-dev-support dev-support
-          docker run --ulimit nproc=12500 -v "${WORKSPACE}":/hbase --workdir=/hbase hbase-dev-support python dev-support/flaky-tests/report-flakies.py --mvn -v "${flaky_args[@]}"
+          docker run --ulimit nproc=12500 -v "${WORKSPACE}":/hbase --workdir=/hbase hbase-dev-support \
+            python dev-support/flaky-tests/report-flakies.py --mvn -v -o ${OUTPUT_DIR_RELATIVE_REPORT} "${flaky_args[@]}"
 '''
       }
     }
@@ -51,13 +55,13 @@ pipeline {
   post {
     always {
       // Has to be relative to WORKSPACE.
-      archiveArtifacts artifacts: "includes,excludes,dashboard.html"
+      archiveArtifacts artifacts: "${OUTPUT_DIR_RELATIVE_REPORT}/includes,${OUTPUT_DIR_RELATIVE_REPORT}/excludes,${OUTPUT_DIR_RELATIVE_REPORT}/dashboard.html"
       publishHTML target: [
         allowMissing: true,
         keepAll: true,
         alwaysLinkToLastBuild: true,
         // Has to be relative to WORKSPACE
-        reportDir: ".",
+        reportDir: ${OUTPUT_DIR_RELATIVE_REPORT},
         reportFiles: 'dashboard.html',
         reportName: 'Flaky Test Report'
       ]
diff --git a/dev-support/flaky-tests/report-flakies.py b/dev-support/flaky-tests/report-flakies.py
index 1b3161a..d29ecfa 100755
--- a/dev-support/flaky-tests/report-flakies.py
+++ b/dev-support/flaky-tests/report-flakies.py
@@ -60,6 +60,8 @@ parser.add_argument(
          "strings are written to files so they can be saved as artifacts and easily imported in "
          "other projects. Also writes timeout and failing tests in separate files for "
          "reference.")
+parser.add_argument("-o", "--output", metavar='dir', action='store', required=False,
+                    help="the output directory")
 parser.add_argument("-v", "--verbose", help="Prints more logs.", action="store_true")
 args = parser.parse_args()
 
@@ -68,6 +70,11 @@ logger = logging.getLogger(__name__)
 if args.verbose:
     logger.setLevel(logging.INFO)
 
+output_dir = '.'
+if args.output is not None:
+    output_dir = args.output
+    if not os.path.exists(output_dir):
+      os.makedirs(output_dir)
 
 def get_bad_tests(build_url, is_yetus):
     """
@@ -257,24 +264,24 @@ for url_max_build in expanded_urls:
 all_bad_tests = all_hanging_tests.union(all_failed_tests)
 if args.mvn:
     includes = ",".join(all_bad_tests)
-    with open("./includes", "w") as inc_file:
+    with open(output_dir + "/includes", "w") as inc_file:
         inc_file.write(includes)
 
     excludes = ["**/{0}.java".format(bad_test) for bad_test in all_bad_tests]
-    with open("./excludes", "w") as exc_file:
+    with open(output_dir + "/excludes", "w") as exc_file:
         exc_file.write(",".join(excludes))
 
-    with open("./timeout", "w") as timeout_file:
+    with open(output_dir + "/timeout", "w") as timeout_file:
         timeout_file.write(",".join(all_timeout_tests))
 
-    with open("./failed", "w") as failed_file:
+    with open(output_dir + "/failed", "w") as failed_file:
         failed_file.write(",".join(all_failed_tests))
 
 dev_support_dir = os.path.dirname(os.path.abspath(__file__))
 with open(os.path.join(dev_support_dir, "flaky-dashboard-template.html"), "r") as f:
     template = Template(f.read())
 
-with open("dashboard.html", "w") as f:
+with open(output_dir + "/dashboard.html", "w") as f:
     datetime = time.strftime("%m/%d/%Y %H:%M:%S")
     f.write(template.render(datetime=datetime, bad_tests_count=len(all_bad_tests),
                             results=url_to_bad_test_results, build_ids=url_to_build_ids))