2021-06-01 14:21:22 +00:00
|
|
|
#!groovy
|
|
|
|
/**
|
|
|
|
* Jenkins pipeline to build Corda Opensource Pull Requests.
|
|
|
|
*/
|
|
|
|
|
2020-01-24 10:39:23 +00:00
|
|
|
@Library('corda-shared-build-pipeline-steps')
|
2019-10-08 14:33:24 +00:00
|
|
|
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
|
|
|
|
|
|
|
|
killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger())
|
2019-09-16 10:29:58 +00:00
|
|
|
|
2021-06-01 14:21:22 +00:00
|
|
|
/**
|
|
|
|
* Common Gradle arguments for all Gradle executions
|
|
|
|
*/
|
|
|
|
String COMMON_GRADLE_PARAMS = [
|
|
|
|
'--no-daemon',
|
|
|
|
'--stacktrace',
|
|
|
|
'--info',
|
|
|
|
'-Pcompilation.warningsAsErrors=false',
|
|
|
|
'-Ptests.failFast=true',
|
|
|
|
].join(' ')
|
|
|
|
|
2019-09-16 10:29:58 +00:00
|
|
|
pipeline {
|
2021-06-01 14:21:22 +00:00
|
|
|
agent { label 'standard' }
|
|
|
|
|
|
|
|
/*
|
|
|
|
* List options in alphabetical order
|
|
|
|
*/
|
2020-02-12 13:58:30 +00:00
|
|
|
options {
|
2021-06-01 14:21:22 +00:00
|
|
|
ansiColor('xterm')
|
|
|
|
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
|
|
|
|
parallelsAlwaysFailFast()
|
|
|
|
timeout(time: 6, unit: 'HOURS')
|
|
|
|
timestamps()
|
2020-02-12 13:58:30 +00:00
|
|
|
}
|
2019-09-19 17:41:06 +00:00
|
|
|
|
2021-06-01 14:21:22 +00:00
|
|
|
/*
|
|
|
|
* List environment variables in alphabetical order
|
|
|
|
*/
|
2019-09-16 10:29:58 +00:00
|
|
|
environment {
|
2019-11-02 09:07:53 +00:00
|
|
|
ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials')
|
2019-09-16 10:29:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2021-06-01 14:21:22 +00:00
|
|
|
stage('Compile') {
|
2019-09-16 10:29:58 +00:00
|
|
|
steps {
|
2021-06-01 14:21:22 +00:00
|
|
|
sh script: [
|
|
|
|
'./gradlew',
|
|
|
|
COMMON_GRADLE_PARAMS,
|
|
|
|
'clean',
|
|
|
|
'jar'
|
|
|
|
].join(' ')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Stash') {
|
|
|
|
steps {
|
|
|
|
stash name: 'compiled', useDefaultExcludes: false
|
2019-09-16 10:29:58 +00:00
|
|
|
}
|
|
|
|
}
|
2019-09-19 17:41:06 +00:00
|
|
|
|
2021-06-01 14:21:22 +00:00
|
|
|
stage('All Tests') {
|
2019-09-19 17:41:06 +00:00
|
|
|
parallel {
|
2021-06-01 14:21:22 +00:00
|
|
|
stage('Another agent') {
|
|
|
|
agent {
|
|
|
|
label 'standard'
|
|
|
|
}
|
|
|
|
options {
|
|
|
|
skipDefaultCheckout true
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
archiveArtifacts artifacts: '**/*.log', fingerprint: false
|
|
|
|
junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true
|
|
|
|
}
|
|
|
|
cleanup {
|
|
|
|
deleteDir() /* clean up our workspace */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Unstash') {
|
|
|
|
steps {
|
|
|
|
unstash 'compiled'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Recompile') {
|
|
|
|
steps {
|
|
|
|
sh script: [
|
|
|
|
'./gradlew',
|
|
|
|
COMMON_GRADLE_PARAMS,
|
|
|
|
'jar'
|
|
|
|
].join(' ')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Unit Test') {
|
|
|
|
steps {
|
|
|
|
sh script: [
|
|
|
|
'./gradlew',
|
|
|
|
COMMON_GRADLE_PARAMS,
|
|
|
|
'test'
|
|
|
|
].join(' ')
|
|
|
|
}
|
|
|
|
}
|
2019-11-25 09:39:37 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-01 14:21:22 +00:00
|
|
|
stage('Same agent') {
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
archiveArtifacts artifacts: '**/*.log', fingerprint: false
|
|
|
|
junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Integration Test') {
|
|
|
|
steps {
|
|
|
|
sh script: [
|
|
|
|
'./gradlew',
|
|
|
|
COMMON_GRADLE_PARAMS,
|
|
|
|
'integrationTest'
|
|
|
|
].join(' ')
|
|
|
|
}
|
|
|
|
}
|
2019-09-19 17:41:06 +00:00
|
|
|
}
|
2019-10-08 14:33:24 +00:00
|
|
|
}
|
2019-09-16 10:29:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-08 14:33:24 +00:00
|
|
|
post {
|
|
|
|
cleanup {
|
|
|
|
deleteDir() /* clean up our workspace */
|
2019-09-16 10:29:58 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-24 10:39:23 +00:00
|
|
|
}
|