Skip to content

Commit

Permalink
refactors Jenkins files
Browse files Browse the repository at this point in the history
  • Loading branch information
robfrank committed Dec 29, 2016
1 parent 6a8d11e commit e8bcc4f
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 113 deletions.
165 changes: 63 additions & 102 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,125 +1,86 @@
#!groovy
node("master") {
milestone()
def mvnHome = tool 'mvn'
def mvnJdk8Image = "orientdb/mvn-gradle-zulu-jdk-8"
def mvnIBMJdkImage = "orientdb/jenkins-slave-ibm-jdk-8"

stage('Source checkout') {
milestone
lock(resource: "${env.BRANCH_NAME}", inversePrecedence: true) {
milestone()
def mvnHome = tool 'mvn'
def mvnJdk8Image = "orientdb/mvn-gradle-zulu-jdk-8"
def mvnIBMJdkImage = "orientdb/jenkins-slave-ibm-jdk-8"
milestone

stage('Source checkout') {
node {
checkout scm
}
}
}

try {

try {

stage('Run tests on Java8') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
try {
sh "${mvnHome}/bin/mvn --batch-mode -V clean install -Dmaven.test.failure.ignore=true -Dsurefire.useFile=false"
sh "${mvnHome}/bin/mvn --batch-mode -V deploy -DskipTests"
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
stage('Run tests on Java8') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
try {
sh "${mvnHome}/bin/mvn --batch-mode -V clean install -Dmaven.test.failure.ignore=true -Dsurefire.useFile=false"
sh "${mvnHome}/bin/mvn --batch-mode -V deploy -DskipTests"
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'

}
}
}
}
}


stage('Run tests on IBM Java8') {
docker.image("${mvnIBMJdkImage}")
.inside("${env.VOLUMES}") {
try {
sh "${mvnHome}/bin/mvn --batch-mode -V test -Dmaven.test.failure.ignore=true -Dsurefire.useFile=false"
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
stage('Run tests on IBM Java8') {
docker.image("${mvnIBMJdkImage}")
.inside("${env.VOLUMES}") {
try {
sh "${mvnHome}/bin/mvn --batch-mode -V test -Dmaven.test.failure.ignore=true -Dsurefire.useFile=false"
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'

}
}
}
}
}

stage("Run downstream projects") {
stage("Run downstream projects") {

build job: "orientdb-spatial-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-enterprise-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-security-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-neo4j-importer-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-teleporter-multibranch/${env.BRANCH_NAME}", wait: false
build job: "spring-data-orientdb-multibranch/${env.BRANCH_NAME}", wait: false
}
build job: "orientdb-spatial-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-enterprise-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-security-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-neo4j-importer-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-teleporter-multibranch/${env.BRANCH_NAME}", wait: false
build job: "spring-data-orientdb-multibranch/${env.BRANCH_NAME}", wait: false
}

stage('Run CI tests on java8') {
timeout(time: 300, unit: 'MINUTES') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
sh "${mvnHome}/bin/mvn --batch-mode -V -U -e -Dmaven.test.failure.ignore=true -Dstorage.diskCache.bufferSize=4096 -Dorientdb.test.env=ci clean package -Dsurefire.useFile=false"
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
}
}
stage('Run CI tests on java8') {
timeout(time: 300, unit: 'MINUTES') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
sh "${mvnHome}/bin/mvn --batch-mode -V -U -e -Dmaven.test.failure.ignore=true -Dstorage.diskCache.bufferSize=4096 -Dorientdb.test.env=ci clean package -Dsurefire.useFile=false"
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
}
}
}

stage('Publish Javadoc') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
sh "${mvnHome}/bin/mvn javadoc:aggregate"
sh "rsync -ra --stats ${WORKSPACE}/target/site/apidocs/ -e ${env.RSYNC_JAVADOC}/${env.BRANCH_NAME}/"
}
}
stage('Publish Javadoc') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
sh "${mvnHome}/bin/mvn javadoc:aggregate"
sh "rsync -ra --stats ${WORKSPACE}/target/site/apidocs/ -e ${env.RSYNC_JAVADOC}/${env.BRANCH_NAME}/"
}
}

// stage('Run crash tests on java8') {
//
// try {
// timeout(time: 240, unit: 'MINUTES') {
// docker.image("${mvnJdk8Image}")
// .inside("${env.VOLUMES}") {
// sh "${mvnHome}/bin/mvn -f ./server/pom.xml --batch-mode -V -U -e -Dmaven.test.failure.ignore=true clean test-compile failsafe:integration-test -Dsurefire.useFile=false"
// }
// }
//
// } catch (e) {
// currentBuild.result = 'FAILURE'
//
// slackSend(color: 'bad', message: "FAILED crash tests: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
// } finally {
// junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
//
// }
// }
//
// stage('Run distributed test on Java8') {
//
// try {
// timeout(time: 180, unit: 'MINUTES') {
// docker.image("${mvnJdk8Image}")
// .inside("${env.VOLUMES}") {
// sh "${mvnHome}/bin/mvn -f ./distributed/pom.xml --batch-mode -V -U -e -Dmaven.test.failure.ignore=true clean package -Dsurefire.useFile=false -DskipTests=false"
//
// }
// }
// } catch (e) {
// currentBuild.result = 'FAILURE'
//
// slackSend(color: 'bad', message: "FAILED distributed tests: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
// } finally {
// junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
//
// }
//
// }

if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#00FF00', message: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}

} catch (e) {
currentBuild.result = 'FAILURE'
if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
throw e;
}
if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#00FF00', message: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}

} catch (e) {
currentBuild.result = 'FAILURE'
if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
throw e;
}


13 changes: 8 additions & 5 deletions Jenkinsfile-crash.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ node("master") {
}
}

if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#00FF00', message: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}

} catch (e) {
currentBuild.result = 'FAILURE'

slackSend(color: 'bad', message: "FAILED crash tests: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'

if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
throw e;
}
}

Expand Down
14 changes: 8 additions & 6 deletions Jenkinsfile-distributed.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ node("master") {

}
}
if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#00FF00', message: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}

} catch (e) {
currentBuild.result = 'FAILURE'

slackSend(color: 'bad', message: "FAILED distributed tests: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'

if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
throw e;
}

}

}
Expand Down
125 changes: 125 additions & 0 deletions Jenkinsfile.PREV
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#!groovy
node("master") {
milestone()
lock(resource: "${env.BRANCH_NAME}", inversePrecedence: true) {
milestone()
def mvnHome = tool 'mvn'
def mvnJdk8Image = "orientdb/mvn-gradle-zulu-jdk-8"
def mvnIBMJdkImage = "orientdb/jenkins-slave-ibm-jdk-8"

stage('Source checkout') {
checkout scm
}


try {

stage('Run tests on Java8') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
try {
sh "${mvnHome}/bin/mvn --batch-mode -V clean install -Dmaven.test.failure.ignore=true -Dsurefire.useFile=false"
sh "${mvnHome}/bin/mvn --batch-mode -V deploy -DskipTests"
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'

}
}
}


stage('Run tests on IBM Java8') {
docker.image("${mvnIBMJdkImage}")
.inside("${env.VOLUMES}") {
try {
sh "${mvnHome}/bin/mvn --batch-mode -V test -Dmaven.test.failure.ignore=true -Dsurefire.useFile=false"
} finally {
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'

}
}
}

stage("Run downstream projects") {

build job: "orientdb-spatial-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-enterprise-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-security-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-neo4j-importer-multibranch/${env.BRANCH_NAME}", wait: false
build job: "orientdb-teleporter-multibranch/${env.BRANCH_NAME}", wait: false
build job: "spring-data-orientdb-multibranch/${env.BRANCH_NAME}", wait: false
}

stage('Run CI tests on java8') {
timeout(time: 300, unit: 'MINUTES') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
sh "${mvnHome}/bin/mvn --batch-mode -V -U -e -Dmaven.test.failure.ignore=true -Dstorage.diskCache.bufferSize=4096 -Dorientdb.test.env=ci clean package -Dsurefire.useFile=false"
junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
}
}
}

stage('Publish Javadoc') {
docker.image("${mvnJdk8Image}")
.inside("${env.VOLUMES}") {
sh "${mvnHome}/bin/mvn javadoc:aggregate"
sh "rsync -ra --stats ${WORKSPACE}/target/site/apidocs/ -e ${env.RSYNC_JAVADOC}/${env.BRANCH_NAME}/"
}
}

// stage('Run crash tests on java8') {
//
// try {
// timeout(time: 240, unit: 'MINUTES') {
// docker.image("${mvnJdk8Image}")
// .inside("${env.VOLUMES}") {
// sh "${mvnHome}/bin/mvn -f ./server/pom.xml --batch-mode -V -U -e -Dmaven.test.failure.ignore=true clean test-compile failsafe:integration-test -Dsurefire.useFile=false"
// }
// }
//
// } catch (e) {
// currentBuild.result = 'FAILURE'
//
// slackSend(color: 'bad', message: "FAILED crash tests: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
// } finally {
// junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
//
// }
// }
//
// stage('Run distributed test on Java8') {
//
// try {
// timeout(time: 180, unit: 'MINUTES') {
// docker.image("${mvnJdk8Image}")
// .inside("${env.VOLUMES}") {
// sh "${mvnHome}/bin/mvn -f ./distributed/pom.xml --batch-mode -V -U -e -Dmaven.test.failure.ignore=true clean package -Dsurefire.useFile=false -DskipTests=false"
//
// }
// }
// } catch (e) {
// currentBuild.result = 'FAILURE'
//
// slackSend(color: 'bad', message: "FAILED distributed tests: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
// } finally {
// junit allowEmptyResults: true, testResults: '**/target/surefire-reports/TEST-*.xml'
//
// }
//
// }

if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#00FF00', message: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}

} catch (e) {
currentBuild.result = 'FAILURE'
if (currentBuild.previousBuild == null || currentBuild.previousBuild.result != currentBuild.result) {
slackSend(color: '#FF0000', message: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})")
}
throw e;
}
}

}

0 comments on commit e8bcc4f

Please sign in to comment.