Commit 6b106b2f authored by Peter van 't Hof's avatar Peter van 't Hof Committed by GitHub

Merge pull request #63 from biopet/fix-BIOPET-641

Changed timeouts on builds
parents 261ebe2a 1eb69dfa
node('local') { node('local') {
timeout(45) { try {
try {
stage('Init') { stage('Init') {
tool 'JDK 8u102' tool 'JDK 8u102'
tool 'Apache Maven 3.3.9' tool 'Apache Maven 3.3.9'
} }
timeout(45) {
stage('Checkout') { stage('Checkout') {
checkout scm checkout scm
sh 'git submodule update --init --recursive' sh 'git submodule update --init --recursive'
} }
}
timeout(45) {
stage('Build and Test') { stage('Build and Test') {
withMaven(maven: 'Apache Maven 3.3.9', jdk: 'JDK 8u102') { withMaven(maven: 'Apache Maven 3.3.9', jdk: 'JDK 8u102') {
sh 'mvn -B -T 2 -Dmaven.test.failure.ignore clean package' sh 'mvn -B -T 2 -Dmaven.test.failure.ignore clean package'
} }
} }
}
stage('Report Tests') { stage('Report Tests') {
junit '*/target/surefire-reports/*.xml' junit '*/target/surefire-reports/*.xml'
} }
stage('Check git on changes') {
sh 'if [ $(git diff | wc -l) -eq 0 ]; then true; else echo "[ERROR] Git is not clean anymore after build"; git diff; echo "[ERROR] This might be caused by reformated code, if so run maven locally"; false; fi'
}
stage('Check Documentation') { stage('Check git on changes') {
sh 'mkdocs build --clean --strict' sh 'if [ $(git diff | wc -l) -eq 0 ]; then true; else echo "[ERROR] Git is not clean anymore after build"; git diff; echo "[ERROR] This might be caused by reformated code, if so run maven locally"; false; fi'
} }
if (currentBuild.result == null || "SUCCESS".equals(currentBuild.result)) { stage('Check Documentation') {
currentBuild.result = "SUCCESS" sh 'mkdocs build --clean --strict'
slackSend(color: '#00FF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc') }
} else {
slackSend(color: '#FFFF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
}
} catch (e) { if (currentBuild.result == null || "SUCCESS".equals(currentBuild.result)) {
if (currentBuild.result == null || "FAILED".equals(currentBuild.result)) { currentBuild.result = "SUCCESS"
currentBuild.result = "FAILED" slackSend(color: '#00FF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
} } else {
slackSend(color: '#FF0000', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc') slackSend(color: '#FFFF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
}
throw e } catch (e) {
if (currentBuild.result == null || "FAILED".equals(currentBuild.result)) {
currentBuild.result = "FAILED"
} }
slackSend(color: '#FF0000', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
throw e
} }
} }
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