2018-08-10 12:28:10 -04:00
|
|
|
// 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.
|
|
|
|
pipeline {
|
|
|
|
agent {
|
|
|
|
node {
|
2020-10-01 02:30:27 -04:00
|
|
|
label 'hbase'
|
2018-08-10 12:28:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
triggers {
|
2020-10-10 04:09:39 -04:00
|
|
|
cron('H H/4 * * *') // Every four hours. See https://jenkins.io/doc/book/pipeline/syntax/#cron-syntax
|
2018-08-10 12:28:10 -04:00
|
|
|
}
|
|
|
|
options {
|
|
|
|
// this should roughly match how long we tell the flaky dashboard to look at
|
2021-10-29 04:54:59 -04:00
|
|
|
buildDiscarder(logRotator(numToKeepStr: '50'))
|
2018-08-10 12:28:10 -04:00
|
|
|
timeout (time: 2, unit: 'HOURS')
|
|
|
|
timestamps()
|
|
|
|
}
|
2021-10-07 09:58:48 -04:00
|
|
|
environment {
|
|
|
|
ASF_NIGHTLIES = 'https://nightlies.apache.org'
|
|
|
|
}
|
2018-08-10 12:28:10 -04:00
|
|
|
parameters {
|
|
|
|
booleanParam(name: 'DEBUG', defaultValue: false, description: 'Produce a lot more meta-information.')
|
|
|
|
}
|
|
|
|
tools {
|
|
|
|
// this should match what the yetus nightly job for the branch will use
|
2020-10-20 04:58:43 -04:00
|
|
|
maven 'maven_latest'
|
|
|
|
jdk "jdk_1.8_latest"
|
2018-08-10 12:28:10 -04:00
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage ('run flaky tests') {
|
|
|
|
steps {
|
|
|
|
sh '''#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
declare -a curl_args=(--fail)
|
|
|
|
declare -a mvn_args=(--batch-mode -fn -Dbuild.id="${BUILD_ID}" -Dmaven.repo.local="${WORKSPACE}/local-repository")
|
|
|
|
if [ "${DEBUG}" = "true" ]; then
|
|
|
|
curl_args=("${curl_args[@]}" -v)
|
|
|
|
mvn_args=("${mvn_args[@]}" -X)
|
|
|
|
set -x
|
|
|
|
fi
|
2020-10-20 05:00:06 -04:00
|
|
|
curl "${curl_args[@]}" -o includes.txt "${JENKINS_URL}/job/HBase/job/HBase-Find-Flaky-Tests/job/${BRANCH_NAME}/lastSuccessfulBuild/artifact/output/includes"
|
2018-08-10 12:28:10 -04:00
|
|
|
if [ -s includes.txt ]; then
|
2018-09-12 10:20:41 -04:00
|
|
|
rm -rf local-repository/org/apache/hbase
|
|
|
|
mvn clean "${mvn_args[@]}"
|
|
|
|
rm -rf "target/machine" && mkdir -p "target/machine"
|
|
|
|
if [ -x dev-support/gather_machine_environment.sh ]; then
|
|
|
|
"./dev-support/gather_machine_environment.sh" "target/machine"
|
|
|
|
echo "got the following saved stats in 'target/machine'"
|
|
|
|
ls -lh "target/machine"
|
|
|
|
else
|
|
|
|
echo "Skipped gathering machine environment because we couldn't read the script to do so."
|
|
|
|
fi
|
2020-03-04 16:51:21 -05:00
|
|
|
mvn -T0.25C package "${mvn_args[@]}" -Dtest="$(cat includes.txt)" -Dmaven.test.redirectTestOutputToFile=true -Dsurefire.firstPartForkCount=0.25C -Dsurefire.secondPartForkCount=0.25C
|
2018-08-10 12:28:10 -04:00
|
|
|
else
|
|
|
|
echo "set of flaky tests is currently empty."
|
|
|
|
fi
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
junit testResults: "**/surefire-reports/*.xml", allowEmptyResults: true
|
2021-10-07 09:58:48 -04:00
|
|
|
sshPublisher(publishers: [
|
|
|
|
sshPublisherDesc(configName: 'Nightlies',
|
|
|
|
transfers: [
|
|
|
|
sshTransfer(remoteDirectory: "hbase/${JOB_NAME}/${BUILD_NUMBER}",
|
|
|
|
sourceFiles: "**/surefire-reports/*,**/test-data/*"
|
|
|
|
)
|
|
|
|
]
|
|
|
|
)
|
|
|
|
])
|
|
|
|
sh '''#!/bin/bash -e
|
2021-10-22 09:43:58 -04:00
|
|
|
./dev-support/gen_redirect_html.py "${ASF_NIGHTLIES}/hbase/${JOB_NAME}/${BUILD_NUMBER}" > test_logs.html
|
2021-10-07 09:58:48 -04:00
|
|
|
'''
|
2021-10-22 09:43:58 -04:00
|
|
|
archiveArtifacts artifacts: 'includes.txt,test_logs.html,target/machine/*'
|
2018-08-10 12:28:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|