Skip to content

Commit 7fb2222

Browse files
Publish JUnit results
* Also do Github status recovery.
1 parent b960533 commit 7fb2222

File tree

1 file changed

+62
-4
lines changed

1 file changed

+62
-4
lines changed

dev-support/jenkinsfile-windows-10

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ def getGithubCreds() {
2121
usernameVariable: 'GITHUB_USER')]
2222
}
2323

24+
// Publish JUnit results only if there are XML files under surefire-reports
25+
def publishJUnitResults() {
26+
def findCmdExitCode = sh script: "find ${SOURCEDIR} -wholename */target/surefire-reports/*.xml | egrep .", returnStatus: true
27+
boolean surefireReportsExist = findCmdExitCode == 0
28+
if (surefireReportsExist) {
29+
echo "XML files found under surefire-reports, running junit"
30+
// The path should be relative to WORKSPACE for the junit.
31+
SRC = "${SOURCEDIR}/**/target/surefire-reports/*.xml".replace("$WORKSPACE/","")
32+
try {
33+
junit "${SRC}"
34+
} catch(e) {
35+
echo 'junit processing: ' + e.toString()
36+
}
37+
} else {
38+
echo "No XML files found under surefire-reports, skipping junit"
39+
}
40+
}
41+
2442
pipeline {
2543
agent {
2644
label 'Windows'
@@ -37,7 +55,6 @@ pipeline {
3755
YETUS='yetus'
3856
// Branch or tag name. Yetus release tags are 'rel/X.Y.Z'
3957
YETUS_VERSION='rel/0.14.0'
40-
BUILD_USER='HadoopBuilder'
4158
}
4259

4360
parameters {
@@ -47,7 +64,7 @@ pipeline {
4764
}
4865

4966
stages {
50-
stage ('install yetus') {
67+
stage ('Install Yetus') {
5168
steps {
5269
dir("${WORKSPACE}/${YETUS}") {
5370
checkout([
@@ -78,7 +95,8 @@ pipeline {
7895
--label org.apache.yetus.testpatch.project=hadoop^
7996
--tag hadoop-windows-10-builder^
8097
-f %DOCKERFILE% %SOURCEDIR%\\dev-support\\docker'''
81-
bat '''docker run --rm -v %WORKSPACE%\\out:C:\\out -v %WORKSPACE%\\src:C:\\src^
98+
bat '''docker run --rm -v %WORKSPACE%\\out:C:\\out^
99+
-v %WORKSPACE%\\src:C:\\src^
82100
-v %WORKSPACE%\\yetus:C:\\yetus^
83101
-v F:\\maven\\repository:C:\\Users\\%BUILD_USER%\\.m2^
84102
-e PATCH_OR_ISSUE=%CHANGE_URL% -e JIRA_ISSUE_KEY=%JIRA_ISSUE_KEY%^
@@ -106,8 +124,48 @@ pipeline {
106124
bat '''docker run --rm -v F:\\maven\\repository:C:\\Users\\%BUILD_USER%\\.m2^
107125
hadoop-windows-10-builder "/c" "icacls" "C:\\Users\\%BUILD_USER%\\.m2" "/c" "/t" "/q" "/grant" "Users:F"
108126
'''
109-
emailext body: '<p>For more details, see ${BUILD_URL}</p><p style="white-space: pre;">${CHANGES, format="[%d] (%a) %m"}</p>${FILE,path="out/report.html"}', mimeType: 'text/html', subject: 'Apache Hadoop qbt Report: trunk+JDK8 on Windows 10 x64', to: '${RECIPIENTS}'
127+
128+
// Publish status if it was missed (YETUS-1059)
129+
withCredentials(
130+
[usernamePassword(credentialsId: '683f5dcf-5552-4b28-9fb1-6a6b77cf53dd',
131+
passwordVariable: 'GITHUB_TOKEN',
132+
usernameVariable: 'GITHUB_USER')]) {
133+
bat '''docker run --rm -v %WORKSPACE%\\out:C:\\out^
134+
-v %WORKSPACE%\\src:C:\\src^
135+
-v %WORKSPACE%\\yetus:C:\\yetus^
136+
-v F:\\maven\\repository:C:\\Users\\%BUILD_USER%\\.m2^
137+
-e PATCH_OR_ISSUE=%CHANGE_URL% -e JIRA_ISSUE_KEY=%JIRA_ISSUE_KEY%^
138+
-e CHANGE_URL=%CHANGE_URL% -e WORKSPACE=/c -e YETUS=yetus^
139+
-e IS_OPTIONAL=0 -e SOURCEDIR=/c/hadoop -e PATCHDIR=/c/out^
140+
-e GITHUB_TOKEN=%GITHUB_TOKEN% -e GITHUB_USER=%GITHUB_USER%^
141+
-e BUILD_URL=%BUILD_URL% -e BRANCH_NAME=%BRANCH_NAME%^
142+
-e JOB_NAME=%JOB_NAME% -e JENKINS_URL=%JENKINS_URL%^
143+
-e IS_NIGHTLY_BUILD=%IS_NIGHTLY_BUILD% -e IS_WINDOWS=%IS_WINDOWS%^
144+
-e BASH_EXECUTABLE=/c/Git/bin/bash.exe^
145+
-e VCPKG_INSTALLED_PACKAGES=/c/vcpkg/installed/x64-windows^
146+
-e CMAKE_TOOLCHAIN_FILE=/c/vcpkg/scripts/buildsystems/vcpkg.cmake^
147+
hadoop-windows-10-builder "/c"^
148+
"C:\\Git\\bin\\bash.exe" "-c" \'"/c/src/dev-support/jenkins.sh" "github_status_recovery"\'
149+
'''
150+
}
151+
110152
archiveArtifacts "out/**"
153+
154+
emailext body: '<p>For more details, see ${BUILD_URL}</p><p style="white-space: pre;">${CHANGES, format="[%d] (%a) %m"}</p>${FILE,path="out/report.html"}', mimeType: 'text/html', subject: 'Apache Hadoop qbt Report: trunk+JDK8 on Windows 10 x64', to: '${RECIPIENTS}'
155+
156+
// Publish the HTML report so that it can be looked at
157+
// Has to be relative to WORKSPACE.
158+
publishHTML (target: [
159+
allowMissing: true,
160+
keepAll: true,
161+
alwaysLinkToLastBuild: true,
162+
// Has to be relative to WORKSPACE
163+
reportDir: "out",
164+
reportFiles: 'report.html',
165+
reportName: 'Yetus Report'
166+
])
167+
168+
publishJUnitResults()
111169
}
112170
}
113171

0 commit comments

Comments
 (0)