HBASE-18467 WIP run all stages and build jira comments. Currently blocked by JENKINS-46358
HBASE-18467 use single find as a work around. HBASE-18467 trying to get StringGroovyMethods instead of DefaultGroovyMethods HBASE-18467 still trying to get the StringGroovyMethods version. HBASE-18467 move pattern into a variable because groovy is horrible. HBASE-18467 move the try block's start to cover more. HBASE-18467 switch to using hte java class for Pattern. HBASE-18467 just call the groovy implementation directly. HBASE-18467 has to be the charsequence version, not the string version. :rolling_eyes_cat: HBASE-18467 maybe declared types for CharSequence? HBASE-18467 indirect. HBASE-18467 HBASE-18467 Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/91b32d7c Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/91b32d7c Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/91b32d7c Branch: refs/heads/HBASE-18467 Commit: 91b32d7c7be16c72cc91fc36eaaec437a79161f2 Parents: 780be08 Author: Sean Busbey <bus...@apache.org> Authored: Wed Aug 9 00:48:46 2017 -0500 Committer: Sean Busbey <bus...@apache.org> Committed: Wed Sep 13 22:51:11 2017 -0500 ---------------------------------------------------------------------- dev-support/Jenkinsfile | 143 ++++++++++++++++++++++++++++++-- dev-support/hbase_nightly_yetus.sh | 7 ++ 2 files changed, 143 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/91b32d7c/dev-support/Jenkinsfile ---------------------------------------------------------------------- diff --git a/dev-support/Jenkinsfile b/dev-support/Jenkinsfile index 1f01a47..27850a4 100644 --- a/dev-support/Jenkinsfile +++ b/dev-support/Jenkinsfile @@ -17,7 +17,9 @@ pipeline { agent { node { - label 'Hadoop' +// label 'Hadoop' +// temp go to ubuntu since it seems like no one uses those + label 'ubuntu' } } triggers { @@ -128,7 +130,18 @@ curl -L -o personality.sh "${env.PROJET_PERSONALITY}" steps { unstash 'yetus' // TODO should this be a download from master, similar to how the personality is? - sh "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh" + sh '''#!/usr/bin/env bash + rm -f "${OUTPUTDIR}/success" "${OUTPUTDIR}/failure" + declare commentfile + if "${BASEDIR}/dev-support/hbase_nightly_yetus.sh" ; then + commentfile="${OUTPUTDIR}/success" + echo '(/) *{color:green}+1 general checks{color}*' >> "${commentfile}" + else + commentfile="${OUTPUTDIR}/failure" + echo '(x) *{color:red}-1 general checks{color}*' >> "${commentfile}" + fi + echo "-- For more information [see general report|${BUILD_URL}/General_Nightly_Build_Report/]" >> "${commentfile}" + ''' } post { always { @@ -159,13 +172,22 @@ curl -L -o personality.sh "${env.PROJET_PERSONALITY}" } steps { unstash 'yetus' - 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" - """ + declare commentfile + rm -f "${OUTPUTDIR}/success" "${OUTPUTDIR}/failure" + if "${BASEDIR}/dev-support/hbase_nightly_yetus.sh" ; then + commentfile="${OUTPUTDIR}/success" + echo '(/) *{color:green}+1 jdk7 checks{color}*' >> "${commentfile}" + else + commentfile="${OUTPUTDIR}/failure" + echo '(x) *{color:red}-1 jdk7 checks{color}*' >> "${commentfile}" + fi + echo "-- For more information [see jdk7 report|${BUILD_URL}/JDK7_Nightly_Build_Report/]" >> "${commentfile}" + ''' } post { always { @@ -215,7 +237,18 @@ curl -L -o personality.sh "${env.PROJET_PERSONALITY}" } steps { unstash 'yetus' - sh "${env.BASEDIR}/dev-support/hbase_nightly_yetus.sh" + sh '''#!/usr/bin/env bash + declare commentfile + rm -f "${OUTPUTDIR}/success" "${OUTPUTDIR}/failure" + if "${BASEDIR}/dev-support/hbase_nightly_yetus.sh" ; then + commentfile="${OUTPUTDIR}/success" + echo '(/) *{color:green}+1 jdk8 checks{color}*' >> "${commentfile}" + else + commentfile="${OUTPUTDIR}/failure" + echo '(x) *{color:red}-1 jdk8 checks{color}*' >> "${commentfile}" + fi + echo "-- For more information [see jdk8 report|${BUILD_URL}/JDK8_Nightly_Build_Report/]" >> "${commentfile}" + ''' } post { always { @@ -287,6 +320,7 @@ curl -L -o personality.sh "${env.PROJET_PERSONALITY}" } // expectation check largely based on HBASE-14952 sh '''#!/bin/bash -e + rm -rf "${env.WORKSPACE}/src_tarball_success" "${env.WORKSPACE}/src_tarball_failure" echo "Checking against things we don't expect to include in the source tarball (git related, hbase-native-client, etc.)" cat >known_excluded <<END Only in .: .git @@ -304,6 +338,101 @@ END fi ''' } + // This approach only works because the source release artifact is the last stage that does work. + post { + success { + writeFile file: "${env.WORKSPACE}/src_tarball_success", text: '(/) *{color:green}+1 source release artifact{color}*' + } + failure { + writeFile file: "${env.WORKSPACE}/src_tarball_failure", text: '(x) *{color:red}-1 source release artifact{color}*' + } + } + } + stage ('Fail if previous stages failed') { + steps { + script { + def failures = ['src_tarball_failure', "${env.OUTPUT_RELATIVE_GENERAL}/failure", + "${env.OUTPUT_RELATIVE_JDK7}/failure", "${OUTPUT_RELATIVE_JDK8}/failure"] + for ( failure_file in failures ) { + if (fileExists(file: failure_file)) { + error 'Failing job due to previous failure(s) in prior steps.' + } + } + } + } + } + } + post { + always { + script { + try { + sh "printenv" + def results = ["${env.OUTPUT_RELATIVE_GENERAL}/failure", "${env.OUTPUT_RELATIVE_GENERAL}/success", + "${env.OUTPUT_RELATIVE_JDK7}/failure", "${env.OUTPUT_RELATIVE_JDK7}/success", + "${env.OUTPUT_RELATIVE_JDK8}/failure", "${env.OUTPUT_RELATIVE_JDK8}/success", + 'src_tarball_failure', 'src_tarball_success'] + 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" + if (currentBuild.result == "SUCCESS") { + comment += ' (/) *{color:green}+1 overall{color}*\\' + } else { + comment += '(x) *{color:red}-1 overall{color}*\\' + // 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.\\' + } + comment += " [build ${currentBuild.displayName} on builds.a.o|${env.BUILD_URL}]: ${currentBuild.result}\\----\\details (if available):\n" + //echo "[DEBUG] Comment so far: " + //echo comment + echo "" + echo "[DEBUG] trying to aggregate step-wise results" + comment += results.collect { fileExists(file: it) ? readFile(file: it) : "" }.join("\n") + echo "[INFO] Comment:" + echo comment + echo "" + echo "[INFO] There are ${currentBuild.changeSets.size()} change sets." + def seenJiras = [] + CharSequence pattern = /HBASE-[0-9]+/ + def foobar = { CharSequence foo, CharSequence bar -> + org.codehaus.groovy.runtime.StringGroovyMethods.find(foo,bar) + } + for ( changelist in currentBuild.changeSets ) { + if ( changelist.isEmptySet() ) { + echo "[DEBUG] change set was empty, skipping JIRA comments." + } else { + echo "[DEBUG] there are changes in the change set. Attempting to post comments." + } + for ( change in changelist ) { + CharSequence msg = change.msg + echo "[DEBUG] msg is of class ${msg.class}" + echo "change: ${change}" + echo " ${msg}" + echo " ${change.commitId}" + echo " ${change.author}" + echo "" + // For now, only match the first occurrance of an HBase jira id, due to JENKINS-46358 + currentIssue = foobar(msg, pattern) + if (currentIssue != null ) { + echo "[DEBUG] found jira key: ${currentIssue}" + if ( currentIssue in seenJiras ) { + echo "[DEBUG] already commented on ${currentIssue}." + } else { + echo "[INFO] commenting on ${currentIssue}." + jiraComment issueKey: currentIssue, body: comment + seenJiras << currentIssue + } + } else { + echo "[WARN] no JIRA key found in message, TODO email committer" + } + } + } + } catch (Exception exception) { + echo "Got exception: ${exception}" + echo " ${exception.getStackTrace()}" + } + } } } } http://git-wip-us.apache.org/repos/asf/hbase/blob/91b32d7c/dev-support/hbase_nightly_yetus.sh ---------------------------------------------------------------------- diff --git a/dev-support/hbase_nightly_yetus.sh b/dev-support/hbase_nightly_yetus.sh index 007d64a..5920a81 100755 --- a/dev-support/hbase_nightly_yetus.sh +++ b/dev-support/hbase_nightly_yetus.sh @@ -16,6 +16,13 @@ # specific language governing permissions and limitations # under the License. +# XXX Don't commit this part. +# fail fast +mkdir -p "${OUTPUTDIR}" +echo "placeholder" >> "${OUTPUTDIR}/console-report.html" +exit 1772 +# /XXX Don't commit this part. + declare -i missing_env=0 # Validate params for required_env in "TESTS" "TOOLS" "BASEDIR" "ARCHIVE_PATTERN_LIST" "OUTPUT_RELATIVE" \