mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
INFRA-683 Move Corda OS release branch builds to serial (#6703)
Co-authored-by: Waldemar Zurowski <waldemar.zurowski@r3.com>
This commit is contained in:
parent
ba802c6619
commit
b3d9d1291f
273
.ci/dev/regression/Jenkinsfile
vendored
273
.ci/dev/regression/Jenkinsfile
vendored
@ -1,58 +1,209 @@
|
|||||||
@Library('corda-shared-build-pipeline-steps')
|
#!groovy
|
||||||
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
|
/**
|
||||||
|
* 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-.*$/)
|
||||||
|
/*
|
||||||
|
** calculate the stage for NexusIQ evaluation
|
||||||
|
** * build for snapshots
|
||||||
|
** * stage-release: for release candidates and for health checks
|
||||||
|
** * operate: for final release
|
||||||
|
*/
|
||||||
|
def nexusDefaultIqStage = "build"
|
||||||
|
if (isReleaseTag) {
|
||||||
|
switch (env.TAG_NAME) {
|
||||||
|
case ~/.*-RC\d+(-.*)?/: nexusDefaultIqStage = "stage-release"; break;
|
||||||
|
case ~/.*-HC\d+(-.*)?/: nexusDefaultIqStage = "stage-release"; break;
|
||||||
|
default: nexusDefaultIqStage = "release"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* make sure calculated default value of NexusIQ stage is first in the list
|
||||||
|
* thus making it default for the `choice` parameter
|
||||||
|
*/
|
||||||
|
def nexusIqStageChoices = [nexusDefaultIqStage].plus(
|
||||||
|
[
|
||||||
|
'develop',
|
||||||
|
'build',
|
||||||
|
'stage-release',
|
||||||
|
'release',
|
||||||
|
'operate'
|
||||||
|
].minus([nexusDefaultIqStage]))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common Gradle arguments for all Gradle executions
|
||||||
|
*/
|
||||||
|
String COMMON_GRADLE_PARAMS = [
|
||||||
|
'--no-daemon',
|
||||||
|
'--stacktrace',
|
||||||
|
'--info',
|
||||||
|
'-Pcompilation.warningsAsErrors=false',
|
||||||
|
'-Ptests.failFast=true',
|
||||||
|
].join(' ')
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent { label 'k8s' }
|
agent { label 'standard' }
|
||||||
options {
|
options {
|
||||||
timestamps()
|
timestamps()
|
||||||
buildDiscarder(logRotator(daysToKeepStr: '7', artifactDaysToKeepStr: '7'))
|
timeout(time: 6, unit: 'HOURS')
|
||||||
timeout(time: 3, unit: 'HOURS')
|
buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14'))
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters {
|
||||||
|
choice choices: nexusIqStageChoices, description: 'NexusIQ stage for code evaluation', name: 'nexusIqStage'
|
||||||
}
|
}
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
DOCKER_TAG_TO_USE = "${env.GIT_COMMIT.subSequence(0, 8)}"
|
DOCKER_URL = "https://index.docker.io/v1/"
|
||||||
EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}"
|
|
||||||
BUILD_ID = "${env.BUILD_ID}-${env.JOB_NAME}"
|
|
||||||
ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials')
|
ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials')
|
||||||
|
ARTIFACTORY_BUILD_NAME = "Corda / Publish / Publish Release to Artifactory".replaceAll("/", "::")
|
||||||
|
CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}"
|
||||||
|
CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}"
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Corda Pull Request - Generate Build Image') {
|
stage('Compile') {
|
||||||
steps {
|
steps {
|
||||||
withCredentials([string(credentialsId: 'container_reg_passwd', variable: 'DOCKER_PUSH_PWD')]) {
|
sh script: [
|
||||||
sh "./gradlew " +
|
'./gradlew',
|
||||||
"-Dkubenetize=true " +
|
COMMON_GRADLE_PARAMS,
|
||||||
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
'clean',
|
||||||
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
'jar'
|
||||||
"-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
|
].join(' ')
|
||||||
" clean pushBuildImage --stacktrace"
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Temporarily disable Sonatype checks for regression builds
|
||||||
|
*/
|
||||||
|
stage('Sonatype Check') {
|
||||||
|
when {
|
||||||
|
expression { isReleaseTag }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
sh "./gradlew --no-daemon properties | grep -E '^(version|group):' >version-properties"
|
||||||
|
/* every build related to Corda X.Y (GA, RC, HC, patch or snapshot) uses the same NexusIQ application */
|
||||||
|
def version = sh (returnStdout: true, script: "grep ^version: version-properties | sed -e 's/^version: \\([0-9]\\+\\.[0-9]\\+\\).*\$/\\1/'").trim()
|
||||||
|
def groupId = sh (returnStdout: true, script: "grep ^group: version-properties | sed -e 's/^group: //'").trim()
|
||||||
|
def artifactId = 'corda'
|
||||||
|
nexusAppId = "${groupId}-${artifactId}-${version}"
|
||||||
}
|
}
|
||||||
sh "kubectl auth can-i get pods"
|
nexusPolicyEvaluation (
|
||||||
|
failBuildOnNetworkError: false,
|
||||||
|
iqApplication: selectedApplication(nexusAppId), // application *has* to exist before a build starts!
|
||||||
|
iqScanPatterns: [[scanPattern: 'node/capsule/build/libs/corda*.jar']],
|
||||||
|
iqStage: params.nexusIqStage
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Regression Test') {
|
stage('Unit Test') {
|
||||||
steps {
|
steps {
|
||||||
sh "./gradlew " +
|
sh script: [
|
||||||
"-DbuildId=\"\${BUILD_ID}\" " +
|
'./gradlew',
|
||||||
"-Dkubenetize=true " +
|
COMMON_GRADLE_PARAMS,
|
||||||
"-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\" " +
|
'test'
|
||||||
"-Dartifactory.username=\"\${ARTIFACTORY_CREDENTIALS_USR}\" " +
|
].join(' ')
|
||||||
"-Dartifactory.password=\"\${ARTIFACTORY_CREDENTIALS_PSW}\" " +
|
}
|
||||||
"-Dgit.branch=\"\${GIT_BRANCH}\" " +
|
}
|
||||||
"-Dgit.target.branch=\"\${GIT_BRANCH}\" " +
|
|
||||||
" parallelRegressionTest --stacktrace"
|
stage('Integration Test') {
|
||||||
|
steps {
|
||||||
|
sh script: [
|
||||||
|
'./gradlew',
|
||||||
|
COMMON_GRADLE_PARAMS,
|
||||||
|
'integrationTest'
|
||||||
|
].join(' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Smoke Test') {
|
||||||
|
steps {
|
||||||
|
sh script: [
|
||||||
|
'./gradlew',
|
||||||
|
COMMON_GRADLE_PARAMS,
|
||||||
|
'smokeTest'
|
||||||
|
].join(' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Slow Integration Test') {
|
||||||
|
steps {
|
||||||
|
sh script: [
|
||||||
|
'./gradlew',
|
||||||
|
COMMON_GRADLE_PARAMS,
|
||||||
|
'slowIntegrationTest'
|
||||||
|
].join(' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy Node') {
|
||||||
|
steps {
|
||||||
|
sh script: [
|
||||||
|
'./gradlew',
|
||||||
|
COMMON_GRADLE_PARAMS,
|
||||||
|
'deployNode'
|
||||||
|
].join(' ')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish to Artifactory') {
|
||||||
|
when {
|
||||||
|
expression { isReleaseTag }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
rtServer(
|
||||||
|
id: 'R3-Artifactory',
|
||||||
|
url: 'https://software.r3.com/artifactory',
|
||||||
|
credentialsId: 'artifactory-credentials'
|
||||||
|
)
|
||||||
|
rtGradleDeployer(
|
||||||
|
id: 'deployer',
|
||||||
|
serverId: 'R3-Artifactory',
|
||||||
|
repo: 'corda-releases'
|
||||||
|
)
|
||||||
|
rtGradleRun(
|
||||||
|
usesPlugin: true,
|
||||||
|
useWrapper: true,
|
||||||
|
switches: '-s --info',
|
||||||
|
tasks: 'artifactoryPublish',
|
||||||
|
deployerId: 'deployer',
|
||||||
|
buildName: env.ARTIFACTORY_BUILD_NAME
|
||||||
|
)
|
||||||
|
rtPublishBuildInfo(
|
||||||
|
serverId: 'R3-Artifactory',
|
||||||
|
buildName: env.ARTIFACTORY_BUILD_NAME
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Publish Release to Docker Hub') {
|
||||||
|
when {
|
||||||
|
expression { !isInternalRelease && isReleaseTag }
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
withCredentials([
|
||||||
|
usernamePassword(credentialsId: 'corda-publisher-docker-hub-credentials',
|
||||||
|
usernameVariable: 'DOCKER_USERNAME',
|
||||||
|
passwordVariable: 'DOCKER_PASSWORD')]) {
|
||||||
|
sh "./gradlew pushOfficialImages"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
archiveArtifacts artifacts: '**/pod-logs/**/*.log', fingerprint: false
|
archiveArtifacts artifacts: '**/*.log', fingerprint: false
|
||||||
junit '**/build/test-results-xml/**/*.xml'
|
archiveArtifacts artifacts: '**/build/reports/tests/**', fingerprint: false
|
||||||
|
junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true
|
||||||
|
|
||||||
script {
|
script {
|
||||||
try {
|
try {
|
||||||
@ -84,38 +235,42 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
script
|
script
|
||||||
{
|
{
|
||||||
// We want to send a summary email, but want to limit to once per day.
|
if (!isReleaseTag) {
|
||||||
// Comparing the dates of the previous and current builds achieves this,
|
// We want to send a summary email, but want to limit to once per day.
|
||||||
// i.e. we will only send an email for the first build on a given day.
|
// Comparing the dates of the previous and current builds achieves this,
|
||||||
def prevBuildDate = new Date(
|
// i.e. we will only send an email for the first build on a given day.
|
||||||
currentBuild?.previousBuild.timeInMillis ?: 0).clearTime()
|
def prevBuildDate = new Date(
|
||||||
def currentBuildDate = new Date(
|
currentBuild?.previousBuild.timeInMillis ?: 0).clearTime()
|
||||||
currentBuild.timeInMillis).clearTime()
|
def currentBuildDate = new Date(
|
||||||
|
currentBuild.timeInMillis).clearTime()
|
||||||
|
|
||||||
if (prevBuildDate != currentBuildDate) {
|
if (prevBuildDate != currentBuildDate) {
|
||||||
def statusSymbol = '\u2753'
|
def statusSymbol = '\u2753'
|
||||||
switch(currentBuild.result) {
|
switch(currentBuild.result) {
|
||||||
case 'SUCCESS':
|
case 'SUCCESS':
|
||||||
statusSymbol = '\u2705'
|
statusSymbol = '\u2705'
|
||||||
break;
|
break;
|
||||||
case 'UNSTABLE':
|
case 'UNSTABLE':
|
||||||
case 'FAILURE':
|
statusSymbol = '\u26A0'
|
||||||
statusSymbol = '\u274c'
|
break;
|
||||||
break;
|
case 'FAILURE':
|
||||||
default:
|
statusSymbol = '\u274c'
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo('First build for this date, sending summary email')
|
||||||
|
emailext to: '$DEFAULT_RECIPIENTS',
|
||||||
|
subject: "$statusSymbol" + '$BRANCH_NAME regression tests - $BUILD_STATUS',
|
||||||
|
mimeType: 'text/html',
|
||||||
|
body: '${SCRIPT, template="groovy-html.template"}'
|
||||||
|
} else {
|
||||||
|
echo('Already sent summary email today, suppressing')
|
||||||
}
|
}
|
||||||
|
|
||||||
echo('First build for this date, sending summary email')
|
|
||||||
emailext to: '$DEFAULT_RECIPIENTS',
|
|
||||||
subject: "$statusSymbol" + '$BRANCH_NAME regression tests - $BUILD_STATUS',
|
|
||||||
mimeType: 'text/html',
|
|
||||||
body: '${SCRIPT, template="groovy-html.template"}'
|
|
||||||
} else {
|
|
||||||
echo('Already sent summary email today, suppressing')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(Test) {
|
tasks.withType(Test) {
|
||||||
forkEvery = 10
|
forkEvery = 20
|
||||||
ignoreFailures = project.hasProperty('tests.ignoreFailures') ? project.property('tests.ignoreFailures').toBoolean() : false
|
ignoreFailures = project.hasProperty('tests.ignoreFailures') ? project.property('tests.ignoreFailures').toBoolean() : false
|
||||||
failFast = project.hasProperty('tests.failFast') ? project.property('tests.failFast').toBoolean() : false
|
failFast = project.hasProperty('tests.failFast') ? project.property('tests.failFast').toBoolean() : false
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ import org.junit.*
|
|||||||
import rx.schedulers.TestScheduler
|
import rx.schedulers.TestScheduler
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
|
import java.nio.file.FileSystem
|
||||||
|
import java.nio.file.Path
|
||||||
import java.security.KeyPair
|
import java.security.KeyPair
|
||||||
import java.time.Instant
|
import java.time.Instant
|
||||||
import java.time.temporal.ChronoUnit
|
import java.time.temporal.ChronoUnit
|
||||||
@ -60,11 +62,12 @@ class NetworkMapUpdaterTest {
|
|||||||
|
|
||||||
private val cacheExpiryMs = 1000
|
private val cacheExpiryMs = 1000
|
||||||
private val privateNetUUID = UUID.randomUUID()
|
private val privateNetUUID = UUID.randomUUID()
|
||||||
private val fs = Jimfs.newFileSystem(unix())
|
private lateinit var fs: FileSystem
|
||||||
private val baseDir = fs.getPath("/node")
|
private lateinit var baseDir: Path
|
||||||
private val nodeInfoDir = baseDir / NODE_INFO_DIRECTORY
|
private val nodeInfoDir
|
||||||
|
get() = baseDir / NODE_INFO_DIRECTORY
|
||||||
private val scheduler = TestScheduler()
|
private val scheduler = TestScheduler()
|
||||||
private val fileWatcher = NodeInfoWatcher(baseDir, scheduler)
|
private lateinit var fileWatcher: NodeInfoWatcher
|
||||||
private val nodeReadyFuture = openFuture<Void?>()
|
private val nodeReadyFuture = openFuture<Void?>()
|
||||||
private val networkMapCache = createMockNetworkMapCache()
|
private val networkMapCache = createMockNetworkMapCache()
|
||||||
private lateinit var ourKeyPair: KeyPair
|
private lateinit var ourKeyPair: KeyPair
|
||||||
@ -80,6 +83,10 @@ class NetworkMapUpdaterTest {
|
|||||||
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
|
// register BouncyCastle and EdDSA provider separately, which wrecks havoc.
|
||||||
Crypto.registerProviders()
|
Crypto.registerProviders()
|
||||||
|
|
||||||
|
fs = Jimfs.newFileSystem(unix())
|
||||||
|
baseDir = fs.getPath("/node")
|
||||||
|
fileWatcher = NodeInfoWatcher(baseDir, scheduler)
|
||||||
|
|
||||||
ourKeyPair = Crypto.generateKeyPair(X509Utilities.DEFAULT_TLS_SIGNATURE_SCHEME)
|
ourKeyPair = Crypto.generateKeyPair(X509Utilities.DEFAULT_TLS_SIGNATURE_SCHEME)
|
||||||
ourNodeInfo = createNodeInfoAndSigned("Our info", ourKeyPair).signed
|
ourNodeInfo = createNodeInfoAndSigned("Our info", ourKeyPair).signed
|
||||||
server = NetworkMapServer(cacheExpiryMs.millis)
|
server = NetworkMapServer(cacheExpiryMs.millis)
|
||||||
|
@ -25,7 +25,6 @@ import net.corda.nodeapi.exceptions.DuplicateAttachmentException
|
|||||||
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
import net.corda.nodeapi.internal.persistence.CordaPersistence
|
||||||
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
import net.corda.nodeapi.internal.persistence.DatabaseConfig
|
||||||
import net.corda.testing.common.internal.testNetworkParameters
|
import net.corda.testing.common.internal.testNetworkParameters
|
||||||
import net.corda.testing.core.internal.ContractJarTestUtils
|
|
||||||
import net.corda.testing.core.internal.ContractJarTestUtils.makeTestContractJar
|
import net.corda.testing.core.internal.ContractJarTestUtils.makeTestContractJar
|
||||||
import net.corda.testing.core.internal.ContractJarTestUtils.makeTestJar
|
import net.corda.testing.core.internal.ContractJarTestUtils.makeTestJar
|
||||||
import net.corda.testing.core.internal.ContractJarTestUtils.makeTestSignedContractJar
|
import net.corda.testing.core.internal.ContractJarTestUtils.makeTestSignedContractJar
|
||||||
@ -96,6 +95,7 @@ class NodeAttachmentServiceTest {
|
|||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
database.close()
|
database.close()
|
||||||
|
fs.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user