HBASE-18467 report nightly results to devs via jira
- rely on parallel pipeline to ensure all stages always run - define non-CPS jira commenting function - comment on jiras in the changeset with summary and links Signed-off-by: Mike Drob <mdrob@apache.org>
This commit is contained in:
parent
e86ffedb45
commit
ddc9af9027
|
@ -15,11 +15,7 @@
|
|||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
pipeline {
|
||||
agent {
|
||||
node {
|
||||
label 'Hadoop'
|
||||
}
|
||||
}
|
||||
agent any
|
||||
triggers {
|
||||
cron('@daily')
|
||||
}
|
||||
|
@ -34,6 +30,12 @@ pipeline {
|
|||
// where we check out to across stages
|
||||
BASEDIR = "${env.WORKSPACE}/component"
|
||||
YETUS_RELEASE = '0.7.0'
|
||||
// where we'll write everything from different steps. Need a copy here so the final step can check for success/failure.
|
||||
OUTPUT_DIR_RELATIVE_GENERAL = 'output-general'
|
||||
OUTPUT_DIR_RELATIVE_JDK7 = 'output-jdk7'
|
||||
OUTPUT_DIR_RELATIVE_HADOOP2 = 'output-jdk8-hadoop2'
|
||||
OUTPUT_DIR_RELATIVE_HADOOP3 = 'output-jdk8-hadoop3'
|
||||
|
||||
PROJECT = 'hbase'
|
||||
PROJECT_PERSONALITY = 'https://raw.githubusercontent.com/apache/hbase/master/dev-support/hbase-personality.sh'
|
||||
// This section of the docs tells folks not to use the javadoc tag. older branches have our old version of the check for said tag.
|
||||
|
@ -62,6 +64,7 @@ pipeline {
|
|||
dir('component') {
|
||||
checkout scm
|
||||
}
|
||||
stash name: 'component', includes: "component/*,component/**/*"
|
||||
}
|
||||
}
|
||||
stage ('yetus install') {
|
||||
|
@ -111,7 +114,14 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
stash name: 'yetus', includes: "yetus-*/*,yetus-*/**/*,tools/personality.sh"
|
||||
}
|
||||
}
|
||||
stage ('health checks') {
|
||||
parallel {
|
||||
stage ('yetus general check') {
|
||||
agent {
|
||||
node {
|
||||
label 'Hadoop'
|
||||
}
|
||||
}
|
||||
environment {
|
||||
// TODO does hadoopcheck need to be jdk specific?
|
||||
// Should be things that work with multijdk
|
||||
|
@ -119,18 +129,30 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
// on branches that don't support jdk7, this will already be JAVA_HOME, so we'll end up not
|
||||
// doing multijdk there.
|
||||
MULTIJDK = '/usr/lib/jvm/java-8-openjdk-amd64'
|
||||
OUTPUT_DIR_RELATIVE = "output-general"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE}"
|
||||
OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_GENERAL}"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_GENERAL}"
|
||||
}
|
||||
steps {
|
||||
unstash 'yetus'
|
||||
unstash 'component'
|
||||
sh '''#!/usr/bin/env bash
|
||||
rm -rf "${OUTPUT_DIR}" && mkdir "${OUTPUT_DIR}"
|
||||
rm -rf "${OUTPUT_DIR}/machine" && mkdir "${OUTPUT_DIR}/machine"
|
||||
"${BASEDIR}/dev-support/gather_machine_environment.sh" "${OUTPUT_DIR_RELATIVE}/machine"
|
||||
'''
|
||||
// TODO should this be a download from master, similar to how the personality is?
|
||||
sh "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh"
|
||||
// TODO roll this into the hbase_nightly_yetus script
|
||||
sh '''#!/usr/bin/env bash
|
||||
rm -rf "${OUTPUT_DIR}/commentfile}"
|
||||
declare -i status=0
|
||||
if "${BASEDIR}/dev-support/hbase_nightly_yetus.sh" ; then
|
||||
echo '(/) {color:green}+1 general checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
else
|
||||
echo '(x) {color:red}-1 general checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
status=1
|
||||
fi
|
||||
echo "-- For more information [see general report|${BUILD_URL}/General_Nightly_Build_Report/]" >> "${OUTPUT_DIR}/commentfile"
|
||||
exit "${status}"
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
@ -150,29 +172,44 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
}
|
||||
}
|
||||
stage ('yetus jdk7 checks') {
|
||||
agent {
|
||||
node {
|
||||
label 'Hadoop'
|
||||
}
|
||||
}
|
||||
when {
|
||||
branch 'branch-1*'
|
||||
}
|
||||
environment {
|
||||
TESTS = 'mvninstall,compile,javac,unit,htmlout'
|
||||
OUTPUT_DIR_RELATIVE = "output-jdk7"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE}"
|
||||
OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_JDK7}"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_JDK7}"
|
||||
// On branches where we do jdk7 checks, jdk7 will be JAVA_HOME already.
|
||||
}
|
||||
steps {
|
||||
unstash 'yetus'
|
||||
unstash 'component'
|
||||
sh '''#!/usr/bin/env bash
|
||||
rm -rf "${OUTPUT_DIR}" && mkdir "${OUTPUT_DIR}"
|
||||
rm -rf "${OUTPUT_DIR}/machine" && mkdir "${OUTPUT_DIR}/machine"
|
||||
"${BASEDIR}/dev-support/gather_machine_environment.sh" "${OUTPUT_DIR_RELATIVE}/machine"
|
||||
'''
|
||||
sh """#!/usr/bin/env bash
|
||||
sh '''#!/usr/bin/env bash
|
||||
# for branch-1.1 we don't do jdk8 findbugs, so do it here
|
||||
if [ "${env.BRANCH_NAME}" == "branch-1.1" ]; then
|
||||
if [ "${BRANCH_NAME}" == "branch-1.1" ]; then
|
||||
TESTS+=",findbugs"
|
||||
fi
|
||||
"${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh"
|
||||
"""
|
||||
rm -rf "${OUTPUT_DIR}/commentfile}"
|
||||
declare -i status=0
|
||||
if "${BASEDIR}/dev-support/hbase_nightly_yetus.sh" ; then
|
||||
echo '(/) {color:green}+1 jdk7 checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
else
|
||||
echo '(x) {color:red}-1 jdk7 checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
status=1
|
||||
fi
|
||||
echo "-- For more information [see jdk7 report|${BUILD_URL}/JDK7_Nightly_Build_Report/]" >> "${OUTPUT_DIR}/commentfile"
|
||||
exit "${status}"
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
@ -207,6 +244,11 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
}
|
||||
}
|
||||
stage ('yetus jdk8 hadoop2 checks') {
|
||||
agent {
|
||||
node {
|
||||
label 'Hadoop'
|
||||
}
|
||||
}
|
||||
when {
|
||||
not {
|
||||
branch 'branch-1.1*'
|
||||
|
@ -214,20 +256,32 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
}
|
||||
environment {
|
||||
TESTS = 'mvninstall,compile,javac,unit,htmlout'
|
||||
OUTPUT_DIR_RELATIVE = "output-jdk8-hadoop2"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE}"
|
||||
OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_HADOOP2}"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_HADOOP2}"
|
||||
// This isn't strictly needed on branches that only support jdk8, but doesn't hurt
|
||||
// and is needed on branches that do both jdk7 and jdk8
|
||||
SET_JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64'
|
||||
}
|
||||
steps {
|
||||
unstash 'yetus'
|
||||
unstash 'component'
|
||||
sh '''#!/usr/bin/env bash
|
||||
rm -rf "${OUTPUT_DIR}" && mkdir "${OUTPUT_DIR}"
|
||||
rm -rf "${OUTPUT_DIR}/machine" && mkdir "${OUTPUT_DIR}/machine"
|
||||
"${BASEDIR}/dev-support/gather_machine_environment.sh" "${OUTPUT_DIR_RELATIVE}/machine"
|
||||
'''
|
||||
sh "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh"
|
||||
sh '''#!/usr/bin/env bash
|
||||
rm -rf "${OUTPUT_DIR}/commentfile}"
|
||||
declare -i status=0
|
||||
if "${BASEDIR}/dev-support/hbase_nightly_yetus.sh" ; then
|
||||
echo '(/) {color:green}+1 jdk8 hadoop2 checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
else
|
||||
echo '(x) {color:red}-1 jdk8 hadoop2 checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
status=1
|
||||
fi
|
||||
echo "-- For more information [see jdk8 (hadoop2) report|${BUILD_URL}/JDK8_Nightly_Build_Report_(Hadoop2)/]" >> "${OUTPUT_DIR}/commentfile"
|
||||
exit "${status}"
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
@ -262,6 +316,11 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
}
|
||||
}
|
||||
stage ('yetus jdk8 hadoop3 checks') {
|
||||
agent {
|
||||
node {
|
||||
label 'Hadoop'
|
||||
}
|
||||
}
|
||||
when {
|
||||
not {
|
||||
branch 'branch-1*'
|
||||
|
@ -272,8 +331,8 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
// Findbugs is part of this last yetus stage to prevent findbugs precluding hadoop3
|
||||
// tests.
|
||||
TESTS = 'mvninstall,compile,javac,unit,findbugs,htmlout'
|
||||
OUTPUT_DIR_RELATIVE = "output-jdk8-hadoop3"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE}"
|
||||
OUTPUT_DIR_RELATIVE = "${env.OUTPUT_DIR_RELATIVE_HADOOP3}"
|
||||
OUTPUT_DIR = "${env.WORKSPACE}/${env.OUTPUT_DIR_RELATIVE_HADOOP3}"
|
||||
// This isn't strictly needed on branches that only support jdk8, but doesn't hurt
|
||||
// and is needed on branches that do both jdk7 and jdk8
|
||||
SET_JAVA_HOME = '/usr/lib/jvm/java-8-openjdk-amd64'
|
||||
|
@ -282,12 +341,24 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
}
|
||||
steps {
|
||||
unstash 'yetus'
|
||||
unstash 'component'
|
||||
sh '''#!/usr/bin/env bash
|
||||
rm -rf "${OUTPUT_DIR}" && mkdir "${OUTPUT_DIR}"
|
||||
rm -rf "${OUTPUT_DIR}/machine" && mkdir "${OUTPUT_DIR}/machine"
|
||||
"${BASEDIR}/dev-support/gather_machine_environment.sh" "${OUTPUT_DIR_RELATIVE}/machine"
|
||||
'''
|
||||
sh "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh"
|
||||
sh '''#!/usr/bin/env bash
|
||||
rm -rf "${OUTPUT_DIR}/commentfile}"
|
||||
declare -i status=0
|
||||
if "${BASEDIR}/dev-support/hbase_nightly_yetus.sh" ; then
|
||||
echo '(/) {color:green}+1 jdk8 hadoop3 checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
else
|
||||
echo '(x) {color:red}-1 jdk8 hadoop3 checks{color}' >> "${OUTPUT_DIR}/commentfile"
|
||||
status=1
|
||||
fi
|
||||
echo "-- For more information [see jdk8 (hadoop3) report|${BUILD_URL}/JDK8_Nightly_Build_Report_(Hadoop3)/]" >> "${OUTPUT_DIR}/commentfile"
|
||||
exit "${status}"
|
||||
'''
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
@ -343,13 +414,17 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
"${BASEDIR}/dev-support/gather_machine_environment.sh" "output-srctarball/machine"
|
||||
'''
|
||||
sh """#!/bin/bash -e
|
||||
${env.BASEDIR}/dev-support/hbase_nightly_source-artifact.sh \
|
||||
if "${env.BASEDIR}/dev-support/hbase_nightly_source-artifact.sh" \
|
||||
--intermediate-file-dir output-srctarball \
|
||||
--unpack-temp-dir unpacked_src_tarball \
|
||||
--maven-m2-initial .m2-for-repo \
|
||||
--maven-m2-src-build .m2-for-src \
|
||||
--clean-source-checkout \
|
||||
${env.BASEDIR}
|
||||
"${env.BASEDIR}" ; then
|
||||
echo '(/) {color:green}+1 source release artifact{color}\n-- See build output for details.' >output-srctarball/commentfile
|
||||
else
|
||||
echo '(x) {color:red}-1 source release artifact{color}\n-- See build output for details.' >output-srctarball/commentfile
|
||||
fi
|
||||
"""
|
||||
}
|
||||
post {
|
||||
|
@ -360,3 +435,70 @@ curl -L -o personality.sh "${env.PROJECT_PERSONALITY}"
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
try {
|
||||
sh "printenv"
|
||||
def results = ["${env.OUTPUT_DIR_RELATIVE_GENERAL}/commentfile",
|
||||
"${env.OUTPUT_DIR_RELATIVE_JDK7}/commentfile",
|
||||
"${env.OUTPUT_DIR_RELATIVE_HADOOP2}/commentfile",
|
||||
"${env.OUTPUT_DIR_RELATIVE_HADOOP3}/commentfile",
|
||||
'output-srctarball/commentfile']
|
||||
echo env.BRANCH_NAME
|
||||
echo env.BUILD_URL
|
||||
echo currentBuild.result
|
||||
echo currentBuild.durationString
|
||||
def comment = "Results for branch ${env.BRANCH_NAME}, done in ${currentBuild.durationString}\n"
|
||||
comment += "\t[build ${currentBuild.displayName} on builds.a.o|${env.BUILD_URL}]:\n----\ndetails (if available):\n\n"
|
||||
if (currentBuild.result == "SUCCESS") {
|
||||
comment += "(/) *{color:green}+1 overall{color}*\n\n"
|
||||
} else {
|
||||
comment += "(x) *{color:red}-1 overall{color}*\n"
|
||||
// Ideally get the committer our of the change and @ mention them in the per-jira comment
|
||||
comment += " Committer, please check your recent inclusion of a patch for this issue.\n\n"
|
||||
}
|
||||
echo ""
|
||||
echo "[DEBUG] trying to aggregate step-wise results"
|
||||
comment += results.collect { fileExists(file: it) ? readFile(file: it) : "" }.join("\n\n")
|
||||
echo "[INFO] Comment:"
|
||||
echo comment
|
||||
echo ""
|
||||
echo "[INFO] There are ${currentBuild.changeSets.size()} change sets."
|
||||
getJirasToComment(currentBuild).each { currentIssue ->
|
||||
jiraComment issueKey: currentIssue, body: comment
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
echo "Got exception: ${exception}"
|
||||
echo " ${exception.getStackTrace()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
|
||||
@NonCPS
|
||||
List<String> getJirasToComment(RunWrapper thisBuild) {
|
||||
def seenJiras = []
|
||||
thisBuild.changeSets.each { cs ->
|
||||
cs.getItems().each { change ->
|
||||
CharSequence msg = change.msg
|
||||
echo "change: ${change}"
|
||||
echo " ${msg}"
|
||||
echo " ${change.commitId}"
|
||||
echo " ${change.author}"
|
||||
echo ""
|
||||
msg.eachMatch("HBASE-[0-9]+") { currentIssue ->
|
||||
echo "[DEBUG] found jira key: ${currentIssue}"
|
||||
if (currentIssue in seenJiras) {
|
||||
echo "[DEBUG] already commented on ${currentIssue}."
|
||||
} else {
|
||||
echo "[INFO] commenting on ${currentIssue}."
|
||||
seenJiras << currentIssue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return seenJiras
|
||||
}
|
||||
|
|
|
@ -180,5 +180,4 @@ else
|
|||
echo "Building a binary tarball from the source tarball failed. see srtarball_install.log for details."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO check the layout of the binary artifact we just made.
|
||||
|
|
Loading…
Reference in New Issue