INFRA-826 Add publishing steps (#6780)

This commit is contained in:
Ross Nicoll 2020-10-21 11:58:54 +01:00 committed by GitHub
parent e7df5818e4
commit d5790a6251
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,39 +1,87 @@
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
@Library('existing-build-control')
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
#!groovy
/**
* Jenkins pipeline to build Corda OS release branches and tags.
* PLEASE NOTE: we DO want to run a build for each commit!!!
*/
killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger())
/**
* 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(' ')
pipeline {
agent { label 'open-j9 && os' }
/*
* List options in alphabetical order
*/
options {
timestamps()
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
timeout(time: 10, unit: 'HOURS')
timestamps()
}
/*
* List environment variables in alphabetical order
*/
environment {
EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}"
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}"
}
stages {
stage('Unit Tests') {
steps {
sh "./gradlew clean --continue test --info"
sh "./gradlew clean --continue test --info -Ptests.failFast=true"
}
}
stage('Integration Tests') {
steps {
sh "./gradlew clean --continue integrationTest --info"
sh "./gradlew clean --continue integrationTest --info -Ptests.failFast=true"
}
}
stage('Smoke Tests') {
steps {
sh "./gradlew clean --continue smokeTest --info"
sh "./gradlew clean --continue smokeTest --info -Ptests.failFast=true"
}
}
stage('Slow Integration Tests') {
steps {
sh "./gradlew clean --continue slowIntegrationTest --info"
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(' ')
}
}
}
}
@ -46,4 +94,4 @@ pipeline {
deleteDir() /* clean up our workspace */
}
}
}
}