1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
24 cron('H H/4 * * *') // Every four hours. See https://jenkins.io/doc/book/pipeline/syntax/#cron-syntax
27 // this should roughly match how long we tell the flaky dashboard to look at
28 buildDiscarder(logRotator(numToKeepStr: '50'))
29 timeout (time: 2, unit: 'HOURS')
33 ASF_NIGHTLIES = 'https://nightlies.apache.org'
36 booleanParam(name: 'DEBUG', defaultValue: false, description: 'Produce a lot more meta-information.')
39 // this should match what the yetus nightly job for the branch will use
44 stage ('run flaky tests') {
46 sh '''#!/usr/bin/env bash
48 declare -a curl_args=(--fail)
49 tmpdir=$(realpath target)
50 declare -a mvn_args=(--batch-mode -fn -Dbuild.id="${BUILD_ID}" -Dmaven.repo.local="${WORKSPACE}/local-repository" -Djava.io.tmpdir=${tmpdir})
51 if [ "${DEBUG}" = "true" ]; then
52 curl_args=("${curl_args[@]}" -v)
53 mvn_args=("${mvn_args[@]}" -X)
56 curl "${curl_args[@]}" -o includes.txt "${JENKINS_URL}/job/HBase-Find-Flaky-Tests/job/${BRANCH_NAME}/lastSuccessfulBuild/artifact/output/includes"
57 if [ -s includes.txt ]; then
58 rm -rf local-repository/org/apache/hbase
59 mvn clean "${mvn_args[@]}"
60 rm -rf "target/machine" && mkdir -p "target/machine"
61 if [ -x dev-support/gather_machine_environment.sh ]; then
62 "./dev-support/gather_machine_environment.sh" "target/machine"
63 echo "got the following saved stats in 'target/machine'"
64 ls -lh "target/machine"
66 echo "Skipped gathering machine environment because we couldn't read the script to do so."
68 mvn -T0.25C package "${mvn_args[@]}" -Dtest="$(cat includes.txt)" -Dmaven.test.redirectTestOutputToFile=true -Dsurefire.firstPartForkCount=0.25C -Dsurefire.secondPartForkCount=0.25C
70 echo "set of flaky tests is currently empty."
78 junit testResults: "**/surefire-reports/*.xml", allowEmptyResults: true
79 sshPublisher(publishers: [
80 sshPublisherDesc(configName: 'Nightlies',
82 sshTransfer(remoteDirectory: "hbase/${JOB_NAME}/${BUILD_NUMBER}",
83 sourceFiles: "**/surefire-reports/*,**/test-data/*"
89 ./dev-support/gen_redirect_html.py "${ASF_NIGHTLIES}/hbase/${JOB_NAME}/${BUILD_NUMBER}" > test_logs.html
91 archiveArtifacts artifacts: 'includes.txt,test_logs.html,target/machine/*'