Commit 77899668 authored by mchrusci's avatar mchrusci Committed by Michał Karzyński

[ONNX CI] ONNX CI fixes (#2024)

parent 29f23128
......@@ -24,17 +24,21 @@ DOCKER_CONTAINER_NAME = "jenkins_${PROJECT_NAME}_ci"
NGRAPH_GIT_ADDRESS = "https://github.com/NervanaSystems/ngraph.git"
ONNX_GIT_ADDRESS = "https://github.com/NervanaSystems/ngraph-onnx.git"
JENKINS_GITHUB_CREDENTIAL_ID = "7157091e-bc04-42f0-99fd-dc4da2922a55"
ONNX_BRANCH = "$ghprbSourceBranch"
ONNX_BRANCH = "$CHANGE_BRANCH"
GIT_PR_AUTHOR_EMAIL=""
GIT_COMMIT_AUTHOR_EMAIL=""
GIT_COMMIT_HASH=""
GIT_COMMIT_SUBJECT=""
def CloneRepository(String jenkins_github_credential_id, String ngraph_git_address, String onnx_git_address) {
stage('Clone Repos') {
try {
sh "git clone $onnx_git_address -b $ghprbSourceBranch ."
sh "git clone $onnx_git_address -b $CHANGE_BRANCH ."
}
catch (Exception e) {
ONNX_BRANCH = "master"
sh """
echo "WARNING! Failed to clone ngraph-onnx branch $ghprbSourceBranch ! Falling back to master."
echo "WARNING! Failed to clone ngraph-onnx branch $CHANGE_BRANCH ! Falling back to master."
echo "EXCEPTION: $e"
"""
checkout([$class: 'GitSCM',
......@@ -45,10 +49,14 @@ def CloneRepository(String jenkins_github_credential_id, String ngraph_git_addre
}
dir ("ngraph") {
checkout([$class: 'GitSCM',
branches: [[name: "$ghprbSourceBranch"]],
branches: [[name: "$CHANGE_BRANCH"]],
doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', timeout: 30]], submoduleCfg: [],
userRemoteConfigs: [[credentialsId: "${jenkins_github_credential_id}",
url: "${ngraph_git_address}"]]])
GIT_PR_AUTHOR_EMAIL = sh (script: 'git log -1 --pretty="format:%ae" ', returnStdout: true).trim()
GIT_COMMIT_AUTHOR_EMAIL = sh (script: 'git log -1 --pretty="format:%ce" ', returnStdout: true).trim()
GIT_COMMIT_HASH = sh (script: 'git log -1 --pretty="format:%H" ', returnStdout: true).trim()
GIT_COMMIT_SUBJECT = sh (script: 'git log -1 --pretty="format:%s" ', returnStdout: true).trim()
}
}
}
......@@ -122,20 +130,20 @@ def Notify() {
configurationMaps.add([
"name": "notify"
])
String notifyPeople = "$ghprbPullAuthorEmail, $ghprbActualCommitAuthorEmail"
String notifyPeople = "$GIT_PR_AUTHOR_EMAIL, $GIT_COMMIT_AUTHOR_EMAIL"
Closure notifyMethod = { configMap ->
if(currentBuild.result == "FAILURE") {
blue_ocean = "https://crackerjack.intel.com/blue/organizations/jenkins/onnx%2Fngraph_onnx_integration_ci/detail/ngraph_onnx_integration_ci/${BUILD_NUMBER}/pipeline"
emailext (
subject: "NGraph-Onnx CI: NGraph PR $ghprbPullId $currentBuild.result!",
subject: "NGraph-Onnx CI: NGraph PR $CHANGE_ID $currentBuild.result!",
body: """
<table style="width:100%">
<tr><td>Status:</td> <td>${currentBuild.result}</td></tr>
<tr><td>Repository</td> <td>$ghprbGhRepository</td></tr>
<tr><td>Branch:</td> <td>$ghprbSourceBranch</td></tr>
<tr><td>Jenkins Build:</td> <td> <a href=$blue_ocean> ${BUILD_NUMBER} </a> </td></tr>
<tr><td>Pull Request:</td> <td><a href=$ghprbPullLink>$ghprbPullId</a> </td></tr>
<tr><td>Commit SHA:</td> <td>$ghprbActualCommit</td></tr>
<tr><td>Pull Request Title:</td> <td>$CHANGE_TITLE</td></tr>
<tr><td>Pull Request:</td> <td><a href=$CHANGE_URL>$CHANGE_ID</a> </td></tr>
<tr><td>Branch:</td> <td>$CHANGE_BRANCH</td></tr>
<tr><td>Commit Hash:</td> <td>$GIT_COMMIT_SUBJECT</td></tr>
<tr><td>Commit Subject:</td> <td>$GIT_COMMIT_HASH</td></tr>
<tr><td>Jenkins Build:</td> <td> <a href=$RUN_DISPLAY_URL> ${BUILD_NUMBER} </a> </td></tr>
<tr><td>nGraph-ONNX Branch:</td> <td>${ONNX_BRANCH}</td></tr>
</table>
""",
......@@ -148,7 +156,7 @@ def Notify() {
def main(String label, String projectName, String projectRoot, String dockerContainerName, String jenkins_github_credential_id, String ngraph_git_address, String onnx_git_address) {
node(label) {
timeout(activity: true, time: 60) {
timeout(activity: true, time: 15) {
WORKDIR = "${WORKSPACE}/${BUILD_NUMBER}"
def configurationMaps;
try {
......@@ -166,6 +174,14 @@ def main(String label, String projectName, String projectRoot, String dockerCont
RunToxTests(configurationMaps)
}
}
catch(e) {
// Set result to ABORTED if exception contains exit code of a process interrupted by SIGTERM
if ("$e".contains("143")) {
currentBuild.result = "ABORTED"
} else {
currentBuild.result = "FAILURE"
}
}
finally {
Cleanup(configurationMaps)
Notify()
......
......@@ -174,8 +174,13 @@ def main(String label, String projectName, String projectRoot, String dockerCont
RunToxTests(configurationMaps)
}
}
catch(hudson.AbortException e) {
currentBuild.result = 'ABORTED'
catch(e) {
// Set result to ABORTED if exception contains exit code of a process interrupted by SIGTERM
if ("$e".contains("143")) {
currentBuild.result = "ABORTED"
} else {
currentBuild.result = "FAILURE"
}
}
finally {
Cleanup(configurationMaps)
......
......@@ -86,10 +86,13 @@ def CreateStage(String stageName, Closure method, configurationMaps) {
try {
def prepareEnvMap = GenerateMap(genericBodyMethod, configurationMaps)
parallel prepareEnvMap
} catch(hudson.AbortException e) {
AbortedException(e)
} catch(e) {
Exception(e)
// Set result to ABORTED if exception contains exit code of a process interrupted by SIGTERM
if ("$e".contains("143")) {
currentBuild.result = "ABORTED"
} else {
currentBuild.result = "FAILURE"
}
}
}
}
......@@ -136,12 +139,4 @@ def ShowStatusMap() {
echo "${STAGES_STATUS_MAP}"
}
def Exception(e) {
currentBuild.result = 'FAILURE'
}
def AbortedException(e) {
currentBuild.result = 'ABORTED'
}
return this
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment