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',
|
2021-06-03 09:42:49 +00:00
|
|
|
/*
|
|
|
|
** revert default behavour for `ignoreFailures` and
|
|
|
|
** do not ignore test failures in PR builds
|
|
|
|
*/
|
|
|
|
'-Ptests.ignoreFailures=false',
|
2021-06-01 14:21:22 +00:00
|
|
|
'-Pcompilation.warningsAsErrors=false',
|
|
|
|
'-Ptests.failFast=true',
|
2021-06-03 09:42:49 +00:00
|
|
|
'-Ddependx.branch.origin="${GIT_COMMIT}"', // DON'T change quotation - GIT_COMMIT variable is substituted by SHELL!!!!
|
|
|
|
'-Ddependx.branch.target="${CHANGE_TARGET}"', // DON'T change quotation - CHANGE_TARGET variable is substituted by SHELL!!!!
|
2021-06-01 14:21:22 +00:00
|
|
|
].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 14:26:06 +00:00
|
|
|
options {
|
2021-06-01 14:21:22 +00:00
|
|
|
ansiColor('xterm')
|
2020-07-15 09:17:58 +00:00
|
|
|
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
|
2021-06-01 14:21:22 +00:00
|
|
|
parallelsAlwaysFailFast()
|
|
|
|
timeout(time: 6, unit: 'HOURS')
|
|
|
|
timestamps()
|
2020-02-12 14:26:06 +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')
|
2020-07-17 08:39:45 +00:00
|
|
|
CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}"
|
2021-06-03 09:42:49 +00:00
|
|
|
CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}"
|
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 {
|
2022-02-14 17:04:47 +00:00
|
|
|
authenticateGradleWrapper()
|
2021-06-01 14:21:22 +00:00
|
|
|
sh script: [
|
|
|
|
'./gradlew',
|
|
|
|
COMMON_GRADLE_PARAMS,
|
|
|
|
'clean',
|
|
|
|
'jar'
|
|
|
|
].join(' ')
|
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('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 {
|
2022-02-14 17:04:47 +00:00
|
|
|
authenticateGradleWrapper()
|
2021-06-01 14:21:22 +00:00
|
|
|
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
|
|
|
}
|