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: '30'))
29 timeout (time: 2, unit: 'HOURS')
33 booleanParam(name: 'DEBUG', defaultValue: false, description: 'Produce a lot more meta-information.')
36 // this should match what the yetus nightly job for the branch will use
41 stage ('run flaky tests') {
43 sh '''#!/usr/bin/env bash
45 declare -a curl_args=(--fail)
46 declare -a mvn_args=(--batch-mode -fn -Dbuild.id="${BUILD_ID}" -Dmaven.repo.local="${WORKSPACE}/local-repository")
47 if [ "${DEBUG}" = "true" ]; then
48 curl_args=("${curl_args[@]}" -v)
49 mvn_args=("${mvn_args[@]}" -X)
52 curl "${curl_args[@]}" -o includes.txt "${JENKINS_URL}/job/HBase/job/HBase-Find-Flaky-Tests/job/${BRANCH_NAME}/lastSuccessfulBuild/artifact/output/includes"
53 if [ -s includes.txt ]; then
54 rm -rf local-repository/org/apache/hbase
55 mvn clean "${mvn_args[@]}"
56 rm -rf "target/machine" && mkdir -p "target/machine"
57 if [ -x dev-support/gather_machine_environment.sh ]; then
58 "./dev-support/gather_machine_environment.sh" "target/machine"
59 echo "got the following saved stats in 'target/machine'"
60 ls -lh "target/machine"
62 echo "Skipped gathering machine environment because we couldn't read the script to do so."
64 mvn -T0.25C package "${mvn_args[@]}" -Dtest="$(cat includes.txt)" -Dmaven.test.redirectTestOutputToFile=true -Dsurefire.firstPartForkCount=0.25C -Dsurefire.secondPartForkCount=0.25C
66 echo "set of flaky tests is currently empty."
74 junit testResults: "**/surefire-reports/*.xml", allowEmptyResults: true
75 // TODO compress these logs
76 archiveArtifacts artifacts: 'includes.txt,**/surefire-reports/*,**/test-data/*,target/machine/*'