2020-10-21 10:58:54 +00:00
|
|
|
#!groovy
|
|
|
|
/**
|
|
|
|
* Jenkins pipeline to build Corda OS release branches and tags.
|
|
|
|
* PLEASE NOTE: we DO want to run a build for each commit!!!
|
|
|
|
*/
|
2020-09-02 13:35:30 +00:00
|
|
|
|
2020-10-21 10:58:54 +00:00
|
|
|
/**
|
|
|
|
* Sense environment
|
|
|
|
*/
|
|
|
|
boolean isReleaseTag = (env.TAG_NAME =~ /^release-.*JDK11$/)
|
|
|
|
boolean isInternalRelease = (env.TAG_NAME =~ /^internal-release-.*JDK11$/)
|
|
|
|
boolean isReleaseCandidate = (env.TAG_NAME =~ /^release-.*(RC|HC).*JDK11$/)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Common Gradle arguments for all Gradle executions
|
|
|
|
*/
|
|
|
|
String COMMON_GRADLE_PARAMS = [
|
|
|
|
'--no-daemon',
|
|
|
|
'--stacktrace',
|
|
|
|
'--info',
|
|
|
|
'-Pcompilation.warningsAsErrors=false',
|
|
|
|
'-Ptests.failFast=true',
|
|
|
|
].join(' ')
|
2020-09-02 13:35:30 +00:00
|
|
|
|
|
|
|
pipeline {
|
2020-10-16 12:03:25 +00:00
|
|
|
agent { label 'open-j9 && os' }
|
2020-10-21 10:58:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* List options in alphabetical order
|
|
|
|
*/
|
2020-09-02 13:35:30 +00:00
|
|
|
options {
|
2020-10-21 10:58:54 +00:00
|
|
|
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
|
2020-09-02 13:35:30 +00:00
|
|
|
timeout(time: 10, unit: 'HOURS')
|
2020-10-21 10:58:54 +00:00
|
|
|
timestamps()
|
2020-09-02 13:35:30 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 10:58:54 +00:00
|
|
|
/*
|
|
|
|
* List environment variables in alphabetical order
|
|
|
|
*/
|
2020-09-02 13:35:30 +00:00
|
|
|
environment {
|
2020-10-21 10:58:54 +00:00
|
|
|
ARTIFACTORY_BUILD_NAME = "Corda OS OpenJ9 :: Publish :: Publish Release to Artifactory :: ${env.BRANCH_NAME}"
|
|
|
|
ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials')
|
|
|
|
CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}"
|
|
|
|
CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}"
|
2020-09-02 13:35:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Unit Tests') {
|
|
|
|
steps {
|
2020-10-21 10:58:54 +00:00
|
|
|
sh "./gradlew clean --continue test --info -Ptests.failFast=true"
|
2020-09-02 13:35:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Integration Tests') {
|
|
|
|
steps {
|
2020-10-21 10:58:54 +00:00
|
|
|
sh "./gradlew clean --continue integrationTest --info -Ptests.failFast=true"
|
2020-09-02 13:35:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Smoke Tests') {
|
|
|
|
steps {
|
2020-10-21 10:58:54 +00:00
|
|
|
sh "./gradlew clean --continue smokeTest --info -Ptests.failFast=true"
|
2020-09-02 13:35:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Slow Integration Tests') {
|
|
|
|
steps {
|
2020-10-21 10:58:54 +00:00
|
|
|
sh "./gradlew clean --continue slowIntegrationTest --info -Ptests.failFast=true"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Publish Release to Docker Hub') {
|
|
|
|
when {
|
|
|
|
expression { isReleaseTag && !isInternalRelease && !isReleaseCandidate}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
withCredentials([
|
|
|
|
usernamePassword(credentialsId: 'corda-publisher-docker-hub-credentials',
|
|
|
|
usernameVariable: 'DOCKER_USERNAME',
|
|
|
|
passwordVariable: 'DOCKER_PASSWORD')
|
|
|
|
]) {
|
|
|
|
sh script: [
|
|
|
|
'./gradlew',
|
|
|
|
COMMON_GRADLE_PARAMS,
|
|
|
|
'docker:buildAndPushDockerhubImages'
|
|
|
|
].join(' ')
|
|
|
|
}
|
2020-09-02 13:35:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
junit '**/build/test-results/**/*.xml'
|
|
|
|
}
|
|
|
|
cleanup {
|
|
|
|
deleteDir() /* clean up our workspace */
|
|
|
|
}
|
|
|
|
}
|
2020-10-21 10:58:54 +00:00
|
|
|
}
|