HBASE-25194 Do not publish workspace in flaky find job (#2564)

Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Duo Zhang 2020-10-20 11:51:34 +08:00
parent 06bb12ed83
commit 0c20f2b212
2 changed files with 16 additions and 8 deletions

View File

@ -43,7 +43,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 -u `id -u`:`id -g` --workdir=/hbase hbase-dev-support \
python dev-support/flaky-tests/report-flakies.py --mvn -v -o output "${flaky_args[@]}"
'''
}
}
@ -51,13 +52,13 @@ pipeline {
post {
always {
// Has to be relative to WORKSPACE.
archiveArtifacts artifacts: "includes,excludes,dashboard.html"
archiveArtifacts artifacts: "output/*"
publishHTML target: [
allowMissing: true,
keepAll: true,
alwaysLinkToLastBuild: true,
// Has to be relative to WORKSPACE
reportDir: ".",
reportDir: "output",
reportFiles: 'dashboard.html',
reportName: 'Flaky Test Report'
]

View File

@ -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))