From b715140625c0d26a4dce249d9c7fc9fcc520d4e4 Mon Sep 17 00:00:00 2001 From: Adel El-Beik Date: Wed, 15 Nov 2023 16:11:45 +0000 Subject: [PATCH 01/15] ENT-11107: Ctors added to LedgerRecoveryFlow to match EnterpriseLedgerRecoveryFlow. --- .../net/corda/core/flows/LedgerRecoverFlow.kt | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/net/corda/core/flows/LedgerRecoverFlow.kt b/core/src/main/kotlin/net/corda/core/flows/LedgerRecoverFlow.kt index 5153f98e91..3e16d044ad 100644 --- a/core/src/main/kotlin/net/corda/core/flows/LedgerRecoverFlow.kt +++ b/core/src/main/kotlin/net/corda/core/flows/LedgerRecoverFlow.kt @@ -11,8 +11,42 @@ import net.corda.core.utilities.ProgressTracker */ @StartableByRPC class LedgerRecoveryFlow( - private val parameters: LedgerRecoveryParameters, - override val progressTracker: ProgressTracker = ProgressTracker()) : FlowLogic() { + private val parameters: LedgerRecoveryParameters, + override val progressTracker: ProgressTracker = ProgressTracker()) : FlowLogic() { + + // constructors added to aid Corda Node Shell flow command invocation + constructor(recoveryPeer: Party) : this(LedgerRecoveryParameters(setOf(recoveryPeer))) + constructor(recoveryPeers: Collection) : this(LedgerRecoveryParameters(recoveryPeers)) + constructor(useAllNetworkNodes: Boolean) : this(LedgerRecoveryParameters(emptySet(), useAllNetworkNodes = useAllNetworkNodes)) + constructor(recoveryPeer: Party, timeWindow: RecoveryTimeWindow) : + this(LedgerRecoveryParameters(setOf(recoveryPeer), timeWindow)) + constructor(recoveryPeer: Party, timeWindow: RecoveryTimeWindow, dryRun: Boolean) : + this(LedgerRecoveryParameters(setOf(recoveryPeer), timeWindow, dryRun = dryRun)) + constructor(recoveryPeer: Party, timeWindow: RecoveryTimeWindow, dryRun: Boolean, verboseLogging: Boolean) : + this(LedgerRecoveryParameters(setOf(recoveryPeer), timeWindow, dryRun = dryRun, verboseLogging = verboseLogging)) + constructor(recoveryPeer: Party, timeWindow: RecoveryTimeWindow, dryRun: Boolean, verboseLogging: Boolean, alsoFinalize: Boolean) : + this(LedgerRecoveryParameters(setOf(recoveryPeer), timeWindow, dryRun = dryRun, verboseLogging = verboseLogging, alsoFinalize = alsoFinalize)) + constructor(recoveryPeers: Collection, timeWindow: RecoveryTimeWindow) : + this(LedgerRecoveryParameters(recoveryPeers, timeWindow)) + constructor(recoveryPeers: Collection, timeWindow: RecoveryTimeWindow, dryRun: Boolean) : + this(LedgerRecoveryParameters(recoveryPeers, timeWindow, dryRun = dryRun)) + constructor(recoveryPeers: Collection, timeWindow: RecoveryTimeWindow, dryRun: Boolean, verboseLogging: Boolean) : + this(LedgerRecoveryParameters(recoveryPeers, timeWindow, dryRun = dryRun, verboseLogging = verboseLogging)) + constructor(recoveryPeers: Collection, timeWindow: RecoveryTimeWindow, dryRun: Boolean, verboseLogging: Boolean, alsoFinalize: Boolean) : + this(LedgerRecoveryParameters(recoveryPeers, timeWindow, dryRun = dryRun, verboseLogging = verboseLogging, alsoFinalize = alsoFinalize)) + constructor(useAllNetworkNodes: Boolean, timeWindow: RecoveryTimeWindow) : + this(LedgerRecoveryParameters(emptySet(), timeWindow, useAllNetworkNodes = useAllNetworkNodes)) + constructor(useAllNetworkNodes: Boolean, timeWindow: RecoveryTimeWindow, dryRun: Boolean) : + this(LedgerRecoveryParameters(emptySet(), timeWindow, useAllNetworkNodes = useAllNetworkNodes, dryRun = dryRun)) + constructor(useAllNetworkNodes: Boolean, timeWindow: RecoveryTimeWindow, dryRun: Boolean, verboseLogging: Boolean) : + this(LedgerRecoveryParameters(emptySet(), timeWindow, useAllNetworkNodes = useAllNetworkNodes, dryRun = dryRun, verboseLogging = verboseLogging)) + constructor(useAllNetworkNodes: Boolean, timeWindow: RecoveryTimeWindow, dryRun: Boolean, verboseLogging: Boolean, recoveryBatchSize: Int, alsoFinalize: Boolean) : + this(LedgerRecoveryParameters(emptySet(), timeWindow, useAllNetworkNodes = useAllNetworkNodes, dryRun = dryRun, verboseLogging = verboseLogging, recoveryBatchSize = recoveryBatchSize, alsoFinalize = alsoFinalize)) + constructor(useAllNetworkNodes: Boolean, timeWindow: RecoveryTimeWindow, dryRun: Boolean, verboseLogging: Boolean, recoveryBatchSize: Int) : + this(LedgerRecoveryParameters(emptySet(), timeWindow, useAllNetworkNodes = useAllNetworkNodes, dryRun = dryRun, verboseLogging = verboseLogging, recoveryBatchSize = recoveryBatchSize)) + constructor(recoveryPeers: Collection, timeWindow: RecoveryTimeWindow, useAllNetworkNodes: Boolean, dryRun: Boolean, useTimeWindowNarrowing: Boolean, verboseLogging: Boolean, recoveryBatchSize: Int) : + this(LedgerRecoveryParameters(recoveryPeers, timeWindow, useAllNetworkNodes, + dryRun = dryRun, useTimeWindowNarrowing = useTimeWindowNarrowing, verboseLogging = verboseLogging, recoveryBatchSize = recoveryBatchSize)) @CordaInternal data class ExtraConstructorArgs(val parameters: LedgerRecoveryParameters) From 52e43d422377eac7e708405cbefc63e98fc1922f Mon Sep 17 00:00:00 2001 From: Jacob Scott Date: Thu, 16 Nov 2023 16:21:07 +0000 Subject: [PATCH 02/15] ES-1622: Switch corda/corda Github Actions to use Github App for authentication (#7577) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update jira_assign_issue.yml * Update jira_close_issue.yml * Update jira_create_issue.yml * Update .github/workflows/jira_assign_issue.yml * Update .github/workflows/jira_assign_issue.yml --------- Co-authored-by: Waldemar Żurowski <45210402+wzur-r3@users.noreply.github.com> --- .github/workflows/jira_assign_issue.yml | 8 +++++++- .github/workflows/jira_close_issue.yml | 8 +++++++- .github/workflows/jira_create_issue.yml | 9 ++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/jira_assign_issue.yml b/.github/workflows/jira_assign_issue.yml index 7d8b4fba96..9efd0f87a0 100644 --- a/.github/workflows/jira_assign_issue.yml +++ b/.github/workflows/jira_assign_issue.yml @@ -8,12 +8,18 @@ jobs: sync_assigned: runs-on: ubuntu-latest steps: + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.AUTH_APP_ID }} + private-key: ${{ secrets.AUTH_APP_PK }} - name: Assign uses: corda/jira-sync-assigned-action@master with: jiraBaseUrl: ${{ secrets.JIRA_BASE_URL }} jiraEmail: ${{ secrets.JIRA_USER_EMAIL }} jiraToken: ${{ secrets.JIRA_API_TOKEN }} - token: ${{ secrets.GH_TOKEN }} + token: ${{ steps.generate_token.outputs.token }} owner: corda repository: corda diff --git a/.github/workflows/jira_close_issue.yml b/.github/workflows/jira_close_issue.yml index dfe3d2443a..00f5b06363 100644 --- a/.github/workflows/jira_close_issue.yml +++ b/.github/workflows/jira_close_issue.yml @@ -8,12 +8,18 @@ jobs: sync_closed: runs-on: ubuntu-latest steps: + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.AUTH_APP_ID }} + private-key: ${{ secrets.AUTH_APP_PK }} - name: Close uses: corda/jira-sync-closed-action@master with: jiraBaseUrl: https://r3-cev.atlassian.net jiraEmail: ${{ secrets.JIRA_USER_EMAIL }} jiraToken: ${{ secrets.JIRA_API_TOKEN }} - token: ${{ secrets.GH_TOKEN }} + token: ${{ steps.generate_token.outputs.token }} owner: corda repository: corda diff --git a/.github/workflows/jira_create_issue.yml b/.github/workflows/jira_create_issue.yml index 66a3bbdc37..066fb8ca45 100644 --- a/.github/workflows/jira_create_issue.yml +++ b/.github/workflows/jira_create_issue.yml @@ -10,6 +10,13 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Generate a token + id: generate_token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.AUTH_APP_ID }} + private-key: ${{ secrets.AUTH_APP_PK }} + - name: Jira Create issue id: create uses: corda/jira-create-issue-action@master @@ -30,7 +37,7 @@ jobs: - name: Create comment uses: peter-evans/create-or-update-comment@v1 with: - token: ${{ secrets.GH_TOKEN }} + token: ${{ steps.generate_token.outputs.token }} issue-number: ${{ github.event.issue.number }} body: | Automatically created Jira issue: ${{ steps.create.outputs.issue }} From 5b846406c844052cde88c27154470b9dc0dc2d2a Mon Sep 17 00:00:00 2001 From: Connel McGovern <100574906+mcgovc@users.noreply.github.com> Date: Fri, 17 Nov 2023 17:41:45 +0000 Subject: [PATCH 03/15] ES-1331: Enable Gradle Enterprise build scans & remote caching (#7574) * ES-1131: Enable Gradle Enterprise build scans & remote caching --- .ci/dev/compatibility/JenkinsfileJDK11Compile | 12 ++++-- .ci/dev/pr-code-checks/Jenkinsfile | 20 ++++++---- .ci/dev/regression/Jenkinsfile | 20 +++++++--- Jenkinsfile | 23 ++++++++---- build.gradle | 37 ++++++++++++++++--- buildCacheSettings.gradle | 16 -------- gradle.properties | 7 +++- settings.gradle | 19 +++++++++- 8 files changed, 106 insertions(+), 48 deletions(-) delete mode 100644 buildCacheSettings.gradle diff --git a/.ci/dev/compatibility/JenkinsfileJDK11Compile b/.ci/dev/compatibility/JenkinsfileJDK11Compile index 69bda8be33..38fa96129d 100644 --- a/.ci/dev/compatibility/JenkinsfileJDK11Compile +++ b/.ci/dev/compatibility/JenkinsfileJDK11Compile @@ -24,26 +24,32 @@ pipeline { environment { ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials') + BUILD_CACHE_CREDENTIALS = credentials('gradle-ent-cache-credentials') + BUILD_CACHE_PASSWORD = "${env.BUILD_CACHE_CREDENTIALS_PSW}" + BUILD_CACHE_USERNAME = "${env.BUILD_CACHE_CREDENTIALS_USR}" CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}" CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}" + CORDA_GRADLE_SCAN_KEY = credentials('gradle-build-scans-key') CORDA_USE_CACHE = "corda-remotes" } stages { stage('JDK 11 Compile') { steps { - sh "./gradlew --no-daemon -Pcompilation.allWarningsAsErrors=true -Ptests.failFast=false " + + sh "./gradlew --no-daemon --parallel --build-cache -Pcompilation.allWarningsAsErrors=true -Ptests.failFast=false " + "-Ptests.ignoreFailures=true clean compileAll --stacktrace" } } stage('Deploy nodes') { steps { - sh "./gradlew --no-daemon deployNodes" + sh "./gradlew --no-daemon --build-cache deployNodes" } } } - post { + always { + findBuildScans() + } cleanup { deleteDir() /* clean up our workspace */ } diff --git a/.ci/dev/pr-code-checks/Jenkinsfile b/.ci/dev/pr-code-checks/Jenkinsfile index 3693cdfce8..89e8bd1206 100644 --- a/.ci/dev/pr-code-checks/Jenkinsfile +++ b/.ci/dev/pr-code-checks/Jenkinsfile @@ -15,24 +15,28 @@ pipeline { * List environment variables in alphabetical order */ environment { - SNYK_API_TOKEN = credentials('c4-os-snyk-api-token-secret') - C4_OS_SNYK_ORG_ID = credentials('c4-os-snyk-org-id') ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials') + BUILD_CACHE_CREDENTIALS = credentials('gradle-ent-cache-credentials') + BUILD_CACHE_PASSWORD = "${env.BUILD_CACHE_CREDENTIALS_PSW}" + BUILD_CACHE_USERNAME = "${env.BUILD_CACHE_CREDENTIALS_USR}" CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}" CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}" + CORDA_GRADLE_SCAN_KEY = credentials('gradle-build-scans-key') CORDA_USE_CACHE = "corda-remotes" + C4_OS_SNYK_ORG_ID = credentials('c4-os-snyk-org-id') + SNYK_API_TOKEN = credentials('c4-os-snyk-api-token-secret') } stages { stage('Detekt check') { steps { - sh "./gradlew --no-daemon clean detekt" + sh "./gradlew --no-daemon --parallel --build-cache clean detekt" } } stage('Compilation warnings check') { steps { - sh "./gradlew --no-daemon -Pcompilation.warningsAsErrors=true compileAll" + sh "./gradlew --no-daemon --parallel --build-cache -Pcompilation.warningsAsErrors=true compileAll" } } @@ -57,19 +61,21 @@ pipeline { stage('No API change check') { steps { - sh "./gradlew --no-daemon generateApi" + sh "./gradlew --no-daemon --parallel --build-cache generateApi" sh ".ci/check-api-changes.sh" } } stage('Deploy Nodes') { steps { - sh "./gradlew --no-daemon jar deployNodes" + sh "./gradlew --no-daemon --build-cache jar deployNodes" } } } - post { + always { + findBuildScans() + } cleanup { deleteDir() /* clean up our workspace */ } diff --git a/.ci/dev/regression/Jenkinsfile b/.ci/dev/regression/Jenkinsfile index e934bc0cd9..20210fb4bd 100644 --- a/.ci/dev/regression/Jenkinsfile +++ b/.ci/dev/regression/Jenkinsfile @@ -27,6 +27,7 @@ String COMMON_GRADLE_PARAMS = [ '--info', '-Pcompilation.warningsAsErrors=false', '-Ptests.failFast=true', + '--build-cache' ].join(' ') pipeline { @@ -52,8 +53,12 @@ pipeline { environment { ARTIFACTORY_BUILD_NAME = "Corda :: Publish :: Publish Release to Artifactory :: ${env.BRANCH_NAME}" ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials') + BUILD_CACHE_CREDENTIALS = credentials('gradle-ent-cache-credentials') + BUILD_CACHE_PASSWORD = "${env.BUILD_CACHE_CREDENTIALS_PSW}" + BUILD_CACHE_USERNAME = "${env.BUILD_CACHE_CREDENTIALS_USR}" CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}" CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}" + CORDA_GRADLE_SCAN_KEY = credentials('gradle-build-scans-key') CORDA_USE_CACHE = "corda-remotes" DOCKER_URL = "https://index.docker.io/v1/" EMAIL_RECIPIENTS = credentials('corda4-email-recipient') @@ -69,7 +74,8 @@ pipeline { './gradlew', COMMON_GRADLE_PARAMS, 'clean', - 'jar' + 'jar', + '--parallel' ].join(' ') } } @@ -129,8 +135,8 @@ pipeline { } post { always { - archiveArtifacts artifacts: '**/*.log', fingerprint: false - junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true + archiveArtifacts artifacts: '**/*.log', allowEmptyArchive: true, fingerprint: false + junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true, allowEmptyResults: true /* * Copy all JUnit results files into a single top level directory. * This is necessary to stop the allure plugin from hitting out @@ -165,7 +171,8 @@ pipeline { sh script: [ './gradlew', COMMON_GRADLE_PARAMS, - 'jar' + 'jar', + '--parallel' ].join(' ') } } @@ -201,8 +208,8 @@ pipeline { stage('Same agent') { post { always { - archiveArtifacts artifacts: '**/*.log', fingerprint: false - junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true + archiveArtifacts artifacts: '**/*.log', allowEmptyArchive: true, fingerprint: false + junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true, allowEmptyResults: true /* * Copy all JUnit results files into a single top level directory. * This is necessary to stop the allure plugin from hitting out @@ -324,6 +331,7 @@ pipeline { post { always { script { + findBuildScans() if (gitUtils.isReleaseTag()) { gitUtils.getGitLog(env.TAG_NAME, env.GIT_URL.replace('https://github.com/corda/', '')) } diff --git a/Jenkinsfile b/Jenkinsfile index a824a677d0..20e051a742 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,6 +24,7 @@ String COMMON_GRADLE_PARAMS = [ '-Ptests.failFast=true', '-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!!!! + '--build-cache', ].join(' ') pipeline { @@ -45,8 +46,12 @@ pipeline { */ environment { ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials') + BUILD_CACHE_CREDENTIALS = credentials('gradle-ent-cache-credentials') + BUILD_CACHE_PASSWORD = "${env.BUILD_CACHE_CREDENTIALS_PSW}" + BUILD_CACHE_USERNAME = "${env.BUILD_CACHE_CREDENTIALS_USR}" CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}" CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}" + CORDA_GRADLE_SCAN_KEY = credentials('gradle-build-scans-key') CORDA_USE_CACHE = "corda-remotes" } @@ -57,7 +62,8 @@ pipeline { './gradlew', COMMON_GRADLE_PARAMS, 'clean', - 'jar' + 'jar', + '--parallel' ].join(' ') } } @@ -79,8 +85,8 @@ pipeline { } post { always { - archiveArtifacts artifacts: '**/*.log', fingerprint: false - junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true + archiveArtifacts artifacts: '**/*.log', allowEmptyArchive: true, fingerprint: true + junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true,allowEmptyResults: true } cleanup { deleteDir() /* clean up our workspace */ @@ -97,7 +103,8 @@ pipeline { sh script: [ './gradlew', COMMON_GRADLE_PARAMS, - 'jar' + 'jar', + '--parallel' ].join(' ') } } @@ -115,8 +122,8 @@ pipeline { stage('Same agent') { post { always { - archiveArtifacts artifacts: '**/*.log', fingerprint: false - junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true + archiveArtifacts artifacts: '**/*.log', allowEmptyArchive: true, fingerprint: true + junit testResults: '**/build/test-results/**/*.xml', keepLongStdio: true, allowEmptyResults: true } } stages { @@ -134,8 +141,10 @@ pipeline { } } } - post { + always { + findBuildScans() + } cleanup { deleteDir() /* clean up our workspace */ } diff --git a/build.gradle b/build.gradle index e599ca1140..e0642a270a 100644 --- a/build.gradle +++ b/build.gradle @@ -188,6 +188,7 @@ buildscript { includeGroupByRegex 'com\\.r3(\\..*)?' } } + gradlePluginPortal() mavenCentral() jcenter() } @@ -213,6 +214,8 @@ buildscript { classpath "us.kirchmeier:gradle-capsule-plugin:1.0.4_r3" classpath group: "com.r3.testing", name: "gradle-distributed-testing-plugin", version: '1.3.0' classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8" + classpath "com.gradle:gradle-enterprise-gradle-plugin:$gradleEnterprisePlugin" + classpath "com.gradle:common-custom-user-data-gradle-plugin:$customUserDataGradlePlugin" } configurations.all { @@ -223,7 +226,6 @@ buildscript { plugins { // Add the shadow plugin to the plugins classpath for the entire project. id 'com.github.johnrengelman.shadow' version '2.0.4' apply false - id "com.gradle.build-scan" version "2.2.1" id "org.ajoberstar.grgit" version "4.0.0" } @@ -232,7 +234,22 @@ apply plugin: 'com.github.ben-manes.versions' apply plugin: 'net.corda.plugins.publish-utils' apply plugin: 'com.jfrog.artifactory' apply plugin: 'com.r3.testing.distributed-testing' +apply plugin: "com.gradle.build-scan" +apply plugin: "com.gradle.common-custom-user-data-gradle-plugin" +buildScan { + server = gradleEnterpriseUrl + allowUntrustedServer = false + def apiKey = project.findProperty('CORDA_GRADLE_SCAN_KEY') ?: System.getenv('CORDA_GRADLE_SCAN_KEY') + if (apiKey?.trim()) { + publishAlways() + capture { + taskInputFiles = true + } + uploadInBackground = false + accessKey = apiKey + } +} // If the command line project option -PversionFromGit is added to the gradle invocation, we'll resolve // the latest git commit hash and timestamp and create a version postfix from that @@ -277,6 +294,19 @@ allprojects { ) } + // we do this to allow for Gradle task caching. + // below block tells Gradle to ignore specifically the dymaically generated files in the manifest when checking if a file is up to date + // this has no impact on publishing or production of jar, This only reates to Grades mechamish for verifying the Cache key + normalization { + runtimeClasspath { + ignore("**/*.EC") //signing related + ignore("**/*.SF") //signing related + ignore("**/*.MF") + ignore("**/*.kotlin_module") + ignore("**/Cordapp-Dependencies") + } + } + dependencyCheck { suppressionFile = '.ci/dependency-checker/suppressedLibraries.xml' cveValidForHours = 1 @@ -729,11 +759,6 @@ wrapper { distributionType = Wrapper.DistributionType.ALL } -buildScan { - termsOfServiceUrl = 'https://gradle.com/terms-of-service' - termsOfServiceAgree = 'yes' -} - distributedTesting { profilesURL = 'https://raw.githubusercontent.com/corda/infrastructure-profiles/master' diff --git a/buildCacheSettings.gradle b/buildCacheSettings.gradle deleted file mode 100644 index b4d0175f6e..0000000000 --- a/buildCacheSettings.gradle +++ /dev/null @@ -1,16 +0,0 @@ -// Gradle Build Cache configuration recommendation: https://docs.gradle.org/current/userguide/build_cache.html -ext { - isCiServer = System.getenv().containsKey("CORDA_CI") - gradleBuildCacheURL = System.getenv().containsKey("GRADLE_BUILD_CACHE_URL") ? System.getenv().get("GRADLE_BUILD_CACHE_URL") : 'http://localhost:5071/cache/' -} - -buildCache { - local { - enabled = !isCiServer - } - remote(HttpBuildCache) { - enabled = isCiServer - url = gradleBuildCacheURL - push = isCiServer - } -} diff --git a/gradle.properties b/gradle.properties index d70b133fa3..a54780ad19 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,12 @@ kotlin.incremental=true org.gradle.jvmargs=-XX:+UseG1GC -Xmx4g -Dfile.encoding=UTF-8 -org.gradle.caching=false +org.gradle.caching=true owasp.failOnError=false owasp.failBuildOnCVSS=11.0 compilation.allWarningsAsErrors=false test.parallel=false + +# Gradle Enterprise +gradleEnterpriseUrl = https://gradle.dev.r3.com +gradleEnterprisePlugin = 3.8.1 +customUserDataGradlePlugin = 1.6.3 diff --git a/settings.gradle b/settings.gradle index a6ade1959e..bad03080bb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -117,8 +117,6 @@ include 'common-logging' project(":common-logging").projectDir = new File("$settingsDir/common/logging") // Common libraries - end -apply from: 'buildCacheSettings.gradle' - include 'core-deterministic' include 'core-deterministic:testing' include 'core-deterministic:testing:data' @@ -128,3 +126,20 @@ include 'serialization-deterministic' include 'detekt-plugins' include 'tools:error-tool' +buildCache { + local { enabled = false } + remote(HttpBuildCache) { + url = "${gradleEnterpriseUrl}/cache/" + credentials { + username = settings.ext.find('BUILD_CACHE_CREDENTIALS_USR') ?: System.getenv('BUILD_CACHE_CREDENTIALS_USR') + password = settings.ext.find('BUILD_CACHE_CREDENTIALS_PSW') ?: System.getenv('BUILD_CACHE_CREDENTIALS_PSW') + } + if (System.getenv().containsKey("JENKINS_URL")) { + push = true + enabled = true + } else { + push = false + enabled = false + } + } +} From fa899c55c2661b39d670e6719797d455c647a8fa Mon Sep 17 00:00:00 2001 From: Connel McGovern Date: Mon, 20 Nov 2023 11:05:54 +0000 Subject: [PATCH 04/15] ES-1131: Re-add authenticateGradleWrapper --- .ci/dev/compatibility/JenkinsfileJDK11Compile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/dev/compatibility/JenkinsfileJDK11Compile b/.ci/dev/compatibility/JenkinsfileJDK11Compile index 38fa96129d..83d4923df3 100644 --- a/.ci/dev/compatibility/JenkinsfileJDK11Compile +++ b/.ci/dev/compatibility/JenkinsfileJDK11Compile @@ -36,6 +36,7 @@ pipeline { stages { stage('JDK 11 Compile') { steps { + authenticateGradleWrapper() sh "./gradlew --no-daemon --parallel --build-cache -Pcompilation.allWarningsAsErrors=true -Ptests.failFast=false " + "-Ptests.ignoreFailures=true clean compileAll --stacktrace" } From 7c681e025d1ec4bae9f6920c04e847ba7bb772ff Mon Sep 17 00:00:00 2001 From: Connel McGovern Date: Mon, 20 Nov 2023 11:06:46 +0000 Subject: [PATCH 05/15] ES-1131: Re-add authenticateGradleWrapper --- .ci/dev/compatibility/JenkinsfileJDK11Compile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/dev/compatibility/JenkinsfileJDK11Compile b/.ci/dev/compatibility/JenkinsfileJDK11Compile index 38fa96129d..83d4923df3 100644 --- a/.ci/dev/compatibility/JenkinsfileJDK11Compile +++ b/.ci/dev/compatibility/JenkinsfileJDK11Compile @@ -36,6 +36,7 @@ pipeline { stages { stage('JDK 11 Compile') { steps { + authenticateGradleWrapper() sh "./gradlew --no-daemon --parallel --build-cache -Pcompilation.allWarningsAsErrors=true -Ptests.failFast=false " + "-Ptests.ignoreFailures=true clean compileAll --stacktrace" } From d8b19de46e4d34840dc286d5b6b6fedcf0787487 Mon Sep 17 00:00:00 2001 From: Chris Cochrane Date: Tue, 21 Nov 2023 11:48:37 +0000 Subject: [PATCH 06/15] Renamed index to keep Oracle happy --- node/src/main/resources/migration/node-core.changelog-v25.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/src/main/resources/migration/node-core.changelog-v25.xml b/node/src/main/resources/migration/node-core.changelog-v25.xml index 75a4144667..28ae879bc1 100644 --- a/node/src/main/resources/migration/node-core.changelog-v25.xml +++ b/node/src/main/resources/migration/node-core.changelog-v25.xml @@ -75,7 +75,7 @@ - + From 47fd1ec1e4a510f28ee5d129c4a4ad971569ddac Mon Sep 17 00:00:00 2001 From: Adel El-Beik Date: Thu, 23 Nov 2023 11:33:16 +0000 Subject: [PATCH 07/15] ENT-11171: Updated JDK8 to 392. --- docker/src/docker/Dockerfile | 2 +- docker/src/docker/Dockerfile-debug | 2 +- docker/src/docker/DockerfileAL | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/src/docker/Dockerfile b/docker/src/docker/Dockerfile index 84b259361b..a6014f8973 100644 --- a/docker/src/docker/Dockerfile +++ b/docker/src/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM azul/zulu-openjdk:8u382 +FROM azul/zulu-openjdk:8u392 ## Remove Azul Zulu repo, as it is gone by now RUN rm -rf /etc/apt/sources.list.d/zulu.list diff --git a/docker/src/docker/Dockerfile-debug b/docker/src/docker/Dockerfile-debug index aa19ffcd5b..b7dd204884 100644 --- a/docker/src/docker/Dockerfile-debug +++ b/docker/src/docker/Dockerfile-debug @@ -1,4 +1,4 @@ -FROM azul/zulu-openjdk:8u382 +FROM azul/zulu-openjdk:8u392 ## Add packages, clean cache, create dirs, create corda user and change ownership RUN apt-get update && \ diff --git a/docker/src/docker/DockerfileAL b/docker/src/docker/DockerfileAL index 7447d84496..816ef57027 100644 --- a/docker/src/docker/DockerfileAL +++ b/docker/src/docker/DockerfileAL @@ -1,4 +1,4 @@ -FROM amazoncorretto:8u382-al2 +FROM amazoncorretto:8u392-al2 ## Add packages, clean cache, create dirs, create corda user and change ownership RUN yum -y install bash && \ From 72e5c4fed226e26a6e6383e12c86c31866b25596 Mon Sep 17 00:00:00 2001 From: Adel El-Beik <48713346+adelel1@users.noreply.github.com> Date: Tue, 28 Nov 2023 07:10:53 +0000 Subject: [PATCH 08/15] ENT-11036: initiatedBy is now a list of CordaX500Names. (#7592) --- .../main/kotlin/net/corda/core/flows/FinalityRecoveryFlow.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/net/corda/core/flows/FinalityRecoveryFlow.kt b/core/src/main/kotlin/net/corda/core/flows/FinalityRecoveryFlow.kt index 2e0adf9eb2..1d03305243 100644 --- a/core/src/main/kotlin/net/corda/core/flows/FinalityRecoveryFlow.kt +++ b/core/src/main/kotlin/net/corda/core/flows/FinalityRecoveryFlow.kt @@ -56,7 +56,7 @@ class FlowRecoveryException(message: String, cause: Throwable? = null) : FlowExc @CordaSerializable data class FlowRecoveryQuery( val timeframe: FlowTimeWindow? = null, - val initiatedBy: CordaX500Name? = null, + val initiatedBy: List? = null, val counterParties: List? = null) { init { require(timeframe != null || initiatedBy != null || counterParties != null) { From 59ff476a409270999cf63cce7adaa273a544d959 Mon Sep 17 00:00:00 2001 From: Rick Parker Date: Tue, 28 Nov 2023 11:15:21 +0000 Subject: [PATCH 09/15] ENT-11050: Support flag to indicate if in transaction back chain resolution, and use it to drop deserialization errors to warn (#7591) * Support flag to indicate if in transaction back chain resolution, and use it to drop deserialization errors to warn * Fix and rename test that has different outcome now --- .../node/VaultUpdateDeserializationTest.kt | 33 ++++++++----------- .../node/services/DbTransactionsResolver.kt | 3 +- .../node/services/api/ServiceHubInternal.kt | 14 ++++---- .../node/services/api/VaultServiceInternal.kt | 3 +- .../node/services/vault/NodeVaultService.kt | 19 ++++++----- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/node/src/integration-test/kotlin/net/corda/node/VaultUpdateDeserializationTest.kt b/node/src/integration-test/kotlin/net/corda/node/VaultUpdateDeserializationTest.kt index 9b0bc3f0e9..48aadf45d4 100644 --- a/node/src/integration-test/kotlin/net/corda/node/VaultUpdateDeserializationTest.kt +++ b/node/src/integration-test/kotlin/net/corda/node/VaultUpdateDeserializationTest.kt @@ -4,7 +4,6 @@ import co.paralleluniverse.strands.Strand import junit.framework.TestCase.assertEquals import junit.framework.TestCase.assertNotNull import junit.framework.TestCase.assertTrue -import net.corda.core.flows.UnexpectedFlowEndException import net.corda.core.internal.InputStreamAndHash import net.corda.core.internal.deleteRecursively import net.corda.core.internal.div @@ -55,13 +54,15 @@ class VaultUpdateDeserializationTest { /* * Transaction sent from A -> B with Notarisation * Test that a deserialization error is raised where the receiver node of a transaction has an incompatible contract jar. - * In the case of a notarised transaction, a deserialisation error is thrown in the receiver SignTransactionFlow (before finality) - * upon receiving the transaction to be signed and attempting to record its dependencies. - * The ledger will not record any transactions, and the flow must be retried by the sender upon installing the correct contract jar + * But only on new transactions, and not in the back chain. + * In the case of a notarised transaction, a deserialisation error is thrown in the receiver in the second phase of finality + * when updating the vault. The sender will not block, and the back chain is successfully recorded + * on the receiver even though those states have deserialization errors too. The flow on the receiver is hospitalised. + * The flow will be retried by the receiver upon installing the correct contract jar * version at the receiver and re-starting the node. */ - @Test(timeout=300_000) - fun `Notarised transaction fails completely upon receiver deserialization failure collecting signatures when using incompatible contract jar`() { + @Test(timeout = 300_000) + fun `Notarised transaction fails but back chain succeeds upon receiver deserialization failure when using incompatible contract jar`() { driver(driverParameters(listOf(flowVersion1, contractVersion1))) { val alice = startNode(NodeParameters(additionalCordapps = listOf(flowVersion1, contractVersion1)), providedName = ALICE_NAME).getOrThrow() @@ -75,20 +76,15 @@ class VaultUpdateDeserializationTest { val stx = alice.rpc.startFlow(::AttachmentIssueFlow, hash, defaultNotaryIdentity).returnValue.getOrThrow(30.seconds) val spendableState = stx.coreTransaction.outRef(0) - // NOTE: exception is propagated from Receiver - try { - alice.rpc.startFlow(::AttachmentFlowV1, bob.nodeInfo.singleIdentity(), defaultNotaryIdentity, hash, spendableState).returnValue.getOrThrow(30.seconds) - } - catch(e: UnexpectedFlowEndException) { - println("Bob fails to deserialise transaction upon receipt of transaction for signing.") - } + alice.rpc.startFlow(::AttachmentFlowV1, bob.nodeInfo.singleIdentity(), defaultNotaryIdentity, hash, spendableState).returnValue.getOrThrow(30.seconds) + assertEquals(0, bob.rpc.vaultQueryBy().states.size) assertEquals(1, alice.rpc.vaultQueryBy().states.size) // check transaction records @Suppress("DEPRECATION") - assertEquals(1, alice.rpc.internalVerifiedTransactionsSnapshot().size) // issuance only + assertEquals(2, alice.rpc.internalVerifiedTransactionsSnapshot().size) // both @Suppress("DEPRECATION") - assertTrue(bob.rpc.internalVerifiedTransactionsSnapshot().isEmpty()) + assertEquals(1, bob.rpc.internalVerifiedTransactionsSnapshot().size) // issuance only // restart Bob with correct contract jar version (bob as OutOfProcess).process.destroyForcibly() @@ -97,13 +93,12 @@ class VaultUpdateDeserializationTest { val restartedBob = startNode(NodeParameters(additionalCordapps = listOf(flowVersion1, contractVersion1)), providedName = BOB_NAME).getOrThrow() - // re-run failed flow - alice.rpc.startFlow(::AttachmentFlowV1, restartedBob.nodeInfo.singleIdentity(), defaultNotaryIdentity, hash, spendableState).returnValue.getOrThrow(30.seconds) - + // original hospitalized transaction should now have been re-processed with correct contract jar assertEquals(1, waitForVaultUpdate(restartedBob)) assertEquals(1, alice.rpc.vaultQueryBy().states.size) @Suppress("DEPRECATION") - assertTrue(restartedBob.rpc.internalVerifiedTransactionsSnapshot().isNotEmpty()) + assertEquals(2, restartedBob.rpc.internalVerifiedTransactionsSnapshot().size) // both + assertEquals(1, restartedBob.rpc.vaultQueryBy().states.size) } } diff --git a/node/src/main/kotlin/net/corda/node/services/DbTransactionsResolver.kt b/node/src/main/kotlin/net/corda/node/services/DbTransactionsResolver.kt index 668b95ff92..9a8e9d5eda 100644 --- a/node/src/main/kotlin/net/corda/node/services/DbTransactionsResolver.kt +++ b/node/src/main/kotlin/net/corda/node/services/DbTransactionsResolver.kt @@ -13,6 +13,7 @@ import net.corda.core.transactions.SignedTransaction import net.corda.core.utilities.debug import net.corda.core.utilities.seconds import net.corda.core.utilities.trace +import net.corda.node.services.api.ServiceHubInternal import net.corda.node.services.api.WritableTransactionStorage import java.util.* @@ -107,7 +108,7 @@ class DbTransactionsResolver(private val flow: ResolveTransactionsFlow) : Transa } if (txStatus == TransactionStatus.UNVERIFIED) { tx.verify(flow.serviceHub) - flow.serviceHub.recordTransactions(usedStatesToRecord, listOf(tx)) + (flow.serviceHub as ServiceHubInternal).recordTransactions(usedStatesToRecord, listOf(tx), false, disableSoftLocking = true) } else { logger.debug { "No need to record $txId as it's already been verified" } } diff --git a/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt b/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt index 0ee732b210..b283c137c4 100644 --- a/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt +++ b/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt @@ -5,8 +5,8 @@ import net.corda.core.context.InvocationContext import net.corda.core.crypto.SecureHash import net.corda.core.crypto.TransactionSignature import net.corda.core.flows.FlowLogic -import net.corda.core.flows.TransactionMetadata import net.corda.core.flows.StateMachineRunId +import net.corda.core.flows.TransactionMetadata import net.corda.core.identity.CordaX500Name import net.corda.core.internal.FlowStateMachineHandle import net.corda.core.internal.NamedCacheFactory @@ -38,7 +38,6 @@ import net.corda.node.services.persistence.AttachmentStorageInternal import net.corda.node.services.statemachine.ExternalEvent import net.corda.node.services.statemachine.FlowStateMachineImpl import net.corda.nodeapi.internal.persistence.CordaPersistence -import java.lang.IllegalStateException import java.security.SignatureException import java.util.ArrayList import java.util.Collections @@ -88,6 +87,7 @@ interface ServiceHubInternal : ServiceHubCoreInternal { stateMachineRecordedTransactionMapping: StateMachineRecordedTransactionMappingStorage, vaultService: VaultServiceInternal, database: CordaPersistence, + disableSoftLocking: Boolean = false, updateFn: (SignedTransaction) -> Boolean = validatedTransactions::addTransaction ) { @@ -147,7 +147,7 @@ interface ServiceHubInternal : ServiceHubCoreInternal { // // Because the primary use case for recording irrelevant states is observer/regulator nodes, who are unlikely // to make writes to the ledger very often or at all, we choose to punt this issue for the time being. - vaultService.notifyAll(statesToRecord, recordedTransactions.map { it.coreTransaction }, previouslySeenTxs.map { it.coreTransaction }) + vaultService.notifyAll(statesToRecord, recordedTransactions.map { it.coreTransaction }, previouslySeenTxs.map { it.coreTransaction }, disableSoftLocking) } } @@ -202,15 +202,14 @@ interface ServiceHubInternal : ServiceHubCoreInternal { @Suppress("NestedBlockDepth") @VisibleForTesting - fun recordTransactions(statesToRecord: StatesToRecord, txs: Iterable, disableSignatureVerification: Boolean) { + fun recordTransactions(statesToRecord: StatesToRecord, txs: Iterable, disableSignatureVerification: Boolean, disableSoftLocking: Boolean = false) { txs.forEach { requireSupportedHashType(it) if (it.coreTransaction is WireTransaction) { if (disableSignatureVerification) { log.warnOnce("The current usage of recordTransactions is unsafe." + "Recording transactions without signature verification may lead to severe problems with ledger consistency.") - } - else { + } else { try { it.verifyRequiredSignatures() } @@ -226,7 +225,8 @@ interface ServiceHubInternal : ServiceHubCoreInternal { validatedTransactions, stateMachineRecordedTransactionMapping, vaultService, - database + database, + disableSoftLocking ) } diff --git a/node/src/main/kotlin/net/corda/node/services/api/VaultServiceInternal.kt b/node/src/main/kotlin/net/corda/node/services/api/VaultServiceInternal.kt index e95ba4b015..3c54a3321d 100644 --- a/node/src/main/kotlin/net/corda/node/services/api/VaultServiceInternal.kt +++ b/node/src/main/kotlin/net/corda/node/services/api/VaultServiceInternal.kt @@ -15,7 +15,8 @@ interface VaultServiceInternal : VaultService { * indicate whether an update consists entirely of regular or notary change transactions, which may require * different processing logic. */ - fun notifyAll(statesToRecord: StatesToRecord, txns: Iterable, previouslySeenTxns: Iterable = emptyList()) + fun notifyAll(statesToRecord: StatesToRecord, txns: Iterable, previouslySeenTxns: Iterable = emptyList(), + disableSoftLocking: Boolean = false) /** * Same as notifyAll but with a single transaction. diff --git a/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt b/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt index a2623b638d..e0fdce29c0 100644 --- a/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt +++ b/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt @@ -69,7 +69,8 @@ import java.security.PublicKey import java.sql.SQLException import java.time.Clock import java.time.Instant -import java.util.* +import java.util.Arrays +import java.util.UUID import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CopyOnWriteArraySet import java.util.stream.Stream @@ -80,8 +81,6 @@ import javax.persistence.criteria.CriteriaQuery import javax.persistence.criteria.CriteriaUpdate import javax.persistence.criteria.Predicate import javax.persistence.criteria.Root -import kotlin.collections.ArrayList -import kotlin.collections.LinkedHashSet import kotlin.collections.component1 import kotlin.collections.component2 @@ -284,12 +283,13 @@ class NodeVaultService( internal val publishUpdates get() = mutex.locked { updatesPublisher } /** Groups adjacent transactions into batches to generate separate net updates per transaction type. */ - override fun notifyAll(statesToRecord: StatesToRecord, txns: Iterable, previouslySeenTxns: Iterable) { + override fun notifyAll(statesToRecord: StatesToRecord, txns: Iterable, previouslySeenTxns: Iterable, + disableSoftLocking: Boolean) { if (statesToRecord == StatesToRecord.NONE || (!txns.any() && !previouslySeenTxns.any())) return val batch = mutableListOf() fun flushBatch(previouslySeen: Boolean) { - val updates = makeUpdates(batch, statesToRecord, previouslySeen) + val updates = makeUpdates(batch, statesToRecord, previouslySeen, disableSoftLocking) processAndNotify(updates) batch.clear() } @@ -308,7 +308,8 @@ class NodeVaultService( processTransactions(txns, false) } - private fun makeUpdates(batch: Iterable, statesToRecord: StatesToRecord, previouslySeen: Boolean): List> { + @Suppress("ComplexMethod", "ThrowsCount") + private fun makeUpdates(batch: Iterable, statesToRecord: StatesToRecord, previouslySeen: Boolean, disableSoftLocking: Boolean): List> { fun withValidDeserialization(list: List, txId: SecureHash): Map { var error: TransactionDeserialisationException? = null @@ -320,13 +321,15 @@ class NodeVaultService( // This will cause a failure as we can't deserialize such states in the context of the `appClassloader`. // For now we ignore these states. // In the future we will use the AttachmentsClassloader to correctly deserialize and asses the relevancy. - if (IGNORE_TRANSACTION_DESERIALIZATION_ERRORS) { + // Disabled if soft locking disabled, as assumes you are in the back chain and that maybe it is less important than top + // level transaction. + if (IGNORE_TRANSACTION_DESERIALIZATION_ERRORS || disableSoftLocking) { log.warnOnce("The current usage of transaction deserialization for the vault is unsafe." + "Ignoring vault updates due to failed deserialized states may lead to severe problems with ledger consistency. ") log.warn("Could not deserialize state $idx from transaction $txId. Cause: $e") } else { log.error("Could not deserialize state $idx from transaction $txId. Cause: $e") - if(error == null) error = e + if (error == null) error = e } null } From 8f87b2060be4ea14e986fd706e1503675e2c3503 Mon Sep 17 00:00:00 2001 From: Jose Coll Date: Thu, 30 Nov 2023 19:13:34 +0000 Subject: [PATCH 10/15] ENT-11245 Catch and transform new enum type value. (#7596) --- core/src/main/kotlin/net/corda/core/internal/FetchDataFlow.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/net/corda/core/internal/FetchDataFlow.kt b/core/src/main/kotlin/net/corda/core/internal/FetchDataFlow.kt index 07564bcbf4..441a0e669a 100644 --- a/core/src/main/kotlin/net/corda/core/internal/FetchDataFlow.kt +++ b/core/src/main/kotlin/net/corda/core/internal/FetchDataFlow.kt @@ -80,7 +80,8 @@ sealed class FetchDataFlow( // against not having unknown by using the platform version as a guard. @CordaSerializationTransformEnumDefaults( CordaSerializationTransformEnumDefault("BATCH_TRANSACTION", "TRANSACTION"), - CordaSerializationTransformEnumDefault("UNKNOWN", "TRANSACTION") + CordaSerializationTransformEnumDefault("UNKNOWN", "TRANSACTION"), + CordaSerializationTransformEnumDefault("TRANSACTION_RECOVERY", "TRANSACTION") ) @CordaSerializable enum class DataType { From 97310a8895e77dcf46cc6a09f64cd04c65df5a10 Mon Sep 17 00:00:00 2001 From: Maciej Swierad Date: Thu, 14 Dec 2023 14:57:13 +0000 Subject: [PATCH 11/15] ENT-11281/Activating forward merge logic --- .ci/dev/forward-merge/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/dev/forward-merge/Jenkinsfile b/.ci/dev/forward-merge/Jenkinsfile index df905a8262..258dc7acc2 100644 --- a/.ci/dev/forward-merge/Jenkinsfile +++ b/.ci/dev/forward-merge/Jenkinsfile @@ -28,4 +28,5 @@ forwardMerger( targetBranch: targetBranch, originBranch: originBranch, slackChannel: '#c4-forward-merge-bot-notifications', + cloneTickets: true, ) From c1fe0e739a1827a852808771d7cdba77bd503d0c Mon Sep 17 00:00:00 2001 From: Jose Coll Date: Tue, 19 Dec 2023 08:46:26 +0000 Subject: [PATCH 12/15] Resolve conflicts. --- .ci/dev/compatibility/JenkinsfileJDK11Compile | 58 ---- .ci/dev/pr-code-checks/Jenkinsfile | 39 +-- build.gradle | 318 ++++++------------ docker/src/docker/Dockerfile | 6 +- docker/src/docker/Dockerfile-debug | 6 +- docker/src/docker/DockerfileAL | 6 +- gradle.properties | 12 +- .../node/services/api/ServiceHubInternal.kt | 5 +- 8 files changed, 129 insertions(+), 321 deletions(-) delete mode 100644 .ci/dev/compatibility/JenkinsfileJDK11Compile diff --git a/.ci/dev/compatibility/JenkinsfileJDK11Compile b/.ci/dev/compatibility/JenkinsfileJDK11Compile deleted file mode 100644 index 83d4923df3..0000000000 --- a/.ci/dev/compatibility/JenkinsfileJDK11Compile +++ /dev/null @@ -1,58 +0,0 @@ -#!groovy -/** - * Jenkins pipeline to build Corda Opensource Pull Requests with JDK11. - */ - -@Library('corda-shared-build-pipeline-steps') -import static com.r3.build.BuildControl.killAllExistingBuildsForJob - -killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger()) - -pipeline { - agent { - dockerfile { - label 'standard' - additionalBuildArgs '--build-arg USER="${USER}"' // DON'T change quotation - USER variable is substituted by SHELL!!!! - filename '.ci/dev/compatibility/DockerfileJDK11' - } - } - options { - timestamps() - timeout(time: 3, unit: 'HOURS') - buildDiscarder(logRotator(daysToKeepStr: '14', artifactDaysToKeepStr: '14')) - } - - environment { - ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials') - BUILD_CACHE_CREDENTIALS = credentials('gradle-ent-cache-credentials') - BUILD_CACHE_PASSWORD = "${env.BUILD_CACHE_CREDENTIALS_PSW}" - BUILD_CACHE_USERNAME = "${env.BUILD_CACHE_CREDENTIALS_USR}" - CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}" - CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}" - CORDA_GRADLE_SCAN_KEY = credentials('gradle-build-scans-key') - CORDA_USE_CACHE = "corda-remotes" - } - - stages { - stage('JDK 11 Compile') { - steps { - authenticateGradleWrapper() - sh "./gradlew --no-daemon --parallel --build-cache -Pcompilation.allWarningsAsErrors=true -Ptests.failFast=false " + - "-Ptests.ignoreFailures=true clean compileAll --stacktrace" - } - } - stage('Deploy nodes') { - steps { - sh "./gradlew --no-daemon --build-cache deployNodes" - } - } - } - post { - always { - findBuildScans() - } - cleanup { - deleteDir() /* clean up our workspace */ - } - } -} diff --git a/.ci/dev/pr-code-checks/Jenkinsfile b/.ci/dev/pr-code-checks/Jenkinsfile index f2996ce6df..5e7085cc1f 100644 --- a/.ci/dev/pr-code-checks/Jenkinsfile +++ b/.ci/dev/pr-code-checks/Jenkinsfile @@ -15,48 +15,35 @@ pipeline { * List environment variables in alphabetical order */ environment { + SNYK_API_TOKEN = credentials('c4-os-snyk-api-token-secret') + C4_OS_SNYK_ORG_ID = credentials('c4-os-snyk-org-id') ARTIFACTORY_CREDENTIALS = credentials('artifactory-credentials') - BUILD_CACHE_CREDENTIALS = credentials('gradle-ent-cache-credentials') - BUILD_CACHE_PASSWORD = "${env.BUILD_CACHE_CREDENTIALS_PSW}" - BUILD_CACHE_USERNAME = "${env.BUILD_CACHE_CREDENTIALS_USR}" CORDA_ARTIFACTORY_PASSWORD = "${env.ARTIFACTORY_CREDENTIALS_PSW}" CORDA_ARTIFACTORY_USERNAME = "${env.ARTIFACTORY_CREDENTIALS_USR}" - CORDA_GRADLE_SCAN_KEY = credentials('gradle-build-scans-key') CORDA_USE_CACHE = "corda-remotes" - C4_OS_SNYK_ORG_ID = credentials('c4-os-snyk-org-id') - SNYK_API_TOKEN = credentials('c4-os-snyk-api-token-secret') + JAVA_HOME = "/usr/lib/jvm/java-17-amazon-corretto" } stages { stage('Detekt check') { steps { authenticateGradleWrapper() - sh "./gradlew --no-daemon --parallel --build-cache clean detekt" + sh "./gradlew --no-daemon clean detekt" } } stage('Compilation warnings check') { steps { - sh "./gradlew --no-daemon --parallel --build-cache -Pcompilation.warningsAsErrors=true compileAll" + /* + * TODO JDK17: Re-enable warnings as errors + */ + sh "./gradlew --no-daemon -Pcompilation.warningsAsErrors=false compileAll" } } stage('Snyk Delta') { - agent { - docker { - image 'build-zulu-openjdk:8' - reuseNode true - registryUrl 'https://engineering-docker.software.r3.com/' - registryCredentialsId 'artifactory-credentials' - args '-v /tmp:/host_tmp' - } - } - environment { - GRADLE_USER_HOME = "/host_tmp/gradle" - } + agent { label 'standard' } steps { - authenticateGradleWrapper() - sh 'mkdir -p ${GRADLE_USER_HOME}' authenticateGradleWrapper() snykDeltaScan(env.SNYK_API_TOKEN, env.C4_OS_SNYK_ORG_ID) } @@ -64,21 +51,19 @@ pipeline { stage('No API change check') { steps { - sh "./gradlew --no-daemon --parallel --build-cache generateApi" + sh "./gradlew --no-daemon generateApi" sh ".ci/check-api-changes.sh" } } stage('Deploy Nodes') { steps { - sh "./gradlew --no-daemon --build-cache jar deployNodes" + sh "./gradlew --no-daemon jar deployNodes" } } } + post { - always { - findBuildScans() - } cleanup { deleteDir() /* clean up our workspace */ } diff --git a/build.gradle b/build.gradle index c63f8e5370..c615101f0a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,11 @@ import com.r3.testing.DistributeTestsBy import com.r3.testing.PodLogLevel +import net.corda.plugins.apiscanner.GenerateApi +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import static org.gradle.api.JavaVersion.VERSION_11 -import static org.gradle.api.JavaVersion.VERSION_1_8 +import static org.gradle.api.JavaVersion.VERSION_17 +import static org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 +import static org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8 buildscript { // For sharing constants between builds @@ -15,26 +18,18 @@ buildscript { ext.corda_build_edition = System.getenv("CORDA_BUILD_EDITION")?.trim() ?: "Corda Open Source" ext.corda_platform_version = constants.getProperty("platformVersion") + ext.corda_shell_version = constants.getProperty("cordaShellVersion") ext.gradle_plugins_version = constants.getProperty("gradlePluginsVersion") // Dependency versions. Can run 'gradle dependencyUpdates' to find new versions of things. // // TODO: Sort this alphabetically. - ext.kotlin_version = constants.getProperty("kotlinVersion") ext.warnings_as_errors = project.hasProperty("compilation.warningsAsErrors") ? project.property("compilation.warningsAsErrors").toBoolean() : false ext.quasar_group = 'co.paralleluniverse' // Set version of Quasar according to version of Java used: - if (JavaVersion.current().isJava8()) { - ext.quasar_version = constants.getProperty("quasarVersion") - ext.quasar_classifier = constants.getProperty("quasarClassifier") - ext.jdkClassifier = constants.getProperty("jdkClassifier") - } else { - ext.quasar_version = constants.getProperty("quasarVersion11") - ext.quasar_classifier = constants.getProperty("quasarClassifier11") - ext.jdkClassifier = constants.getProperty("jdkClassifier11") - } - ext.cordaScanApiClassifier = jdkClassifier + ext.quasar_version = constants.getProperty("quasarVersion") + ext.quasar_classifier = constants.getProperty("quasarClassifier") ext.quasar_exclusions = [ 'co.paralleluniverse**', 'groovy**', @@ -49,7 +44,7 @@ buildscript { 'org.junit**', 'org.slf4j**', 'worker.org.gradle.**', - 'com.nhaarman.mockito_kotlin**', + 'org.mockito.kotlin**', 'org.assertj**', 'org.hamcrest**', 'org.mockito**', @@ -116,7 +111,6 @@ buildscript { ext.class_graph_version = constants.getProperty('classgraphVersion') ext.jcabi_manifests_version = constants.getProperty("jcabiManifestsVersion") ext.picocli_version = constants.getProperty("picocliVersion") - ext.commons_lang_version = constants.getProperty("commonsLangVersion") ext.commons_io_version = constants.getProperty("commonsIoVersion") ext.controlsfx_version = constants.getProperty("controlsfxVersion") ext.detekt_version = constants.getProperty('detektVersion') @@ -124,20 +118,27 @@ buildscript { ext.commons_configuration2_version = constants.getProperty("commonsConfiguration2Version") ext.commons_text_version = constants.getProperty("commonsTextVersion") ext.snake_yaml_version = constants.getProperty("snakeYamlVersion") + ext.fontawesomefx_commons_version = constants.getProperty("fontawesomefxCommonsVersion") + ext.fontawesomefx_fontawesome_version = constants.getProperty("fontawesomefxFontawesomeVersion") ext.javaassist_version = constants.getProperty("javaassistVersion") + ext.test_add_opens = [ + '--add-opens', 'java.base/java.time=ALL-UNNAMED', + '--add-opens', 'java.base/java.io=ALL-UNNAMED', + '--add-opens', 'java.base/java.util=ALL-UNNAMED', + '--add-opens', 'java.base/java.net=ALL-UNNAMED', + '--add-opens', 'java.base/java.nio=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang.invoke=ALL-UNNAMED', + '--add-opens', 'java.base/java.security.cert=ALL-UNNAMED', + '--add-opens', 'java.base/java.security=ALL-UNNAMED', + '--add-opens', 'java.base/javax.net.ssl=ALL-UNNAMED', + '--add-opens', 'java.base/java.lang=ALL-UNNAMED', + '--add-opens', 'java.base/java.util.concurrent=ALL-UNNAMED', + '--add-opens', 'java.sql/java.sql=ALL-UNNAMED' + ] + ext.test_add_exports = [ + '--add-exports', 'java.base/sun.nio.ch=ALL-UNNAMED' + ] - if (JavaVersion.current().isJava8()) { - ext.fontawesomefx_commons_version = constants.getProperty("fontawesomefxCommonsJava8Version") - ext.fontawesomefx_fontawesome_version = constants.getProperty("fontawesomefxFontawesomeJava8Version") - } else { - ext.fontawesomefx_commons_version = constants.getProperty("fontawesomefxCommonsVersion") - ext.fontawesomefx_fontawesome_version = constants.getProperty("fontawesomefxFontawesomeVersion") - } - - // Update 121 is required for ObjectInputFilter. - // Updates [131, 161] also have zip compression bugs on MacOS (High Sierra). - // when the java version in NodeStartup.hasMinimumJavaVersion() changes, so must this check - ext.java8_minUpdateVersion = constants.getProperty('java8MinUpdateVersion') ext.corda_revision = { try { "git rev-parse HEAD".execute().text.trim() @@ -171,6 +172,7 @@ buildscript { content { includeGroupByRegex 'net\\.corda(\\..*)?' includeGroupByRegex 'com\\.r3(\\..*)?' + includeGroup 'co.paralleluniverse' } } maven { @@ -180,34 +182,27 @@ buildscript { includeGroupByRegex 'com\\.r3(\\..*)?' } } - gradlePluginPortal() mavenCentral() jcenter() } } dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version" - classpath "net.corda.plugins:publish-utils:$gradle_plugins_version" classpath "net.corda.plugins:quasar-utils:$gradle_plugins_version" classpath "net.corda.plugins:cordformation:$gradle_plugins_version" classpath "net.corda.plugins:cordapp:$gradle_plugins_version" classpath "net.corda.plugins:api-scanner:$gradle_plugins_version" classpath "net.corda.plugins:jar-filter:$gradle_plugins_version" - classpath "net.sf.proguard:proguard-gradle:$proguard_version" + classpath "com.guardsquare:proguard-gradle:$proguard_version" classpath 'com.github.ben-manes:gradle-versions-plugin:0.15.0' - classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}" + classpath "org.jetbrains.dokka:dokka-base:$dokka_version" classpath "net.i2p.crypto:eddsa:$eddsa_version" // Needed for ServiceIdentityGenerator in the build environment. - classpath "org.owasp:dependency-check-gradle:${dependency_checker_version}" + classpath "org.owasp:dependency-check-gradle:$dependency_checker_version" classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$artifactory_plugin_version" // Capsule gradle plugin forked and maintained locally to support Gradle 5.x // See https://github.com/corda/gradle-capsule-plugin - classpath "us.kirchmeier:gradle-capsule-plugin:1.0.4_r3" + classpath "us.kirchmeier:gradle-capsule-plugin:1.0.5_r3" classpath group: "com.r3.testing", name: "gradle-distributed-testing-plugin", version: '1.3.0' classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8" - classpath "com.gradle:gradle-enterprise-gradle-plugin:$gradleEnterprisePlugin" - classpath "com.gradle:common-custom-user-data-gradle-plugin:$customUserDataGradlePlugin" } configurations.classpath { @@ -217,34 +212,20 @@ buildscript { } plugins { - // Add the shadow plugin to the plugins classpath for the entire project. - id 'com.github.johnrengelman.shadow' version '2.0.4' apply false + id 'org.jetbrains.kotlin.jvm' apply false + id 'org.jetbrains.kotlin.plugin.allopen' apply false + id 'org.jetbrains.kotlin.plugin.jpa' apply false + id 'com.github.johnrengelman.shadow' version '7.1.2' apply false id "org.ajoberstar.grgit" version "4.0.0" + id 'corda.root-publish' + id "org.jetbrains.dokka" version "1.8.20" } apply plugin: 'project-report' apply plugin: 'com.github.ben-manes.versions' -apply plugin: 'net.corda.plugins.publish-utils' -apply plugin: 'com.jfrog.artifactory' apply plugin: 'com.r3.testing.distributed-testing' -apply plugin: "com.gradle.build-scan" -apply plugin: "com.gradle.common-custom-user-data-gradle-plugin" -buildScan { - server = gradleEnterpriseUrl - allowUntrustedServer = false - def apiKey = project.findProperty('CORDA_GRADLE_SCAN_KEY') ?: System.getenv('CORDA_GRADLE_SCAN_KEY') - if (apiKey?.trim()) { - publishAlways() - capture { - taskInputFiles = true - } - uploadInBackground = false - accessKey = apiKey - } -} - -// If the command line project option -PversionFromGit is added to the gradle invocation, we'll resolve +// If the command line project option -PversionFromGit is added to the gradle invocation, we'll resolve // the latest git commit hash and timestamp and create a version postfix from that if (project.hasProperty("versionFromGit")){ ext.versionSuffix = "${grgit.head().dateTime.format("yyyyMMdd_HHmmss")}-${grgit.head().abbreviatedId}" @@ -257,26 +238,17 @@ if (ext.versionSuffix != ""){ ext.corda_release_version = "${ext.baseVersion}".toString() } -// We need the following three lines even though they're inside an allprojects {} block below because otherwise -// IntelliJ gets confused when importing the project and ends up erasing and recreating the .idea directory, along -// with the run configurations. It also doesn't realise that the project is a Java 8 project and misconfigures -// the resulting import. This fixes it. -apply plugin: 'java' - -logger.lifecycle("Java version: {}", JavaVersion.current()) -sourceCompatibility = VERSION_1_8 -targetCompatibility = JavaVersion.current().isJava8() ? VERSION_1_8 : VERSION_11 -logger.lifecycle("Java source compatibility: {}", sourceCompatibility) -logger.lifecycle("Java target compatibility: {}", targetCompatibility) +logger.lifecycle("JDK: {}", System.getProperty("java.home")) logger.lifecycle("Quasar version: {}", quasar_version) logger.lifecycle("Quasar classifier: {}", quasar_classifier.toString()) logger.lifecycle("Building Corda version: {}", corda_release_version) +logger.lifecycle("User home: {}", System.getProperty('user.home')) allprojects { - apply plugin: 'kotlin' + apply plugin: 'org.jetbrains.kotlin.jvm' + apply plugin: 'kotlin-allopen' apply plugin: 'jacoco' apply plugin: 'org.owasp.dependencycheck' - apply plugin: 'kotlin-allopen' apply plugin: 'org.sonarqube' allOpen { @@ -287,19 +259,6 @@ allprojects { ) } - // we do this to allow for Gradle task caching. - // below block tells Gradle to ignore specifically the dymaically generated files in the manifest when checking if a file is up to date - // this has no impact on publishing or production of jar, This only reates to Grades mechamish for verifying the Cache key - normalization { - runtimeClasspath { - ignore("**/*.EC") //signing related - ignore("**/*.SF") //signing related - ignore("**/*.MF") - ignore("**/*.kotlin_module") - ignore("**/Cordapp-Dependencies") - } - } - dependencyCheck { suppressionFile = '.ci/dependency-checker/suppressedLibraries.xml' cveValidForHours = 1 @@ -314,12 +273,23 @@ allprojects { nugetconfEnabled = false } } - sourceCompatibility = VERSION_1_8 - targetCompatibility = JavaVersion.current().isJava8() ? VERSION_1_8 : VERSION_11 + + sourceCompatibility = VERSION_17 + targetCompatibility = VERSION_17 jacoco { // JDK11 official support (https://github.com/jacoco/jacoco/releases/tag/v0.8.3) - toolVersion = "0.8.3" + toolVersion = "0.8.7" + } + + test { + jvmArgs test_add_opens + jvmArgs test_add_exports + } + + java { + withSourcesJar() + withJavadocJar() } tasks.withType(JavaCompile).configureEach { @@ -334,13 +304,13 @@ allprojects { options.encoding = 'UTF-8' } - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { - kotlinOptions { - languageVersion = "1.2" - apiVersion = "1.2" - jvmTarget = VERSION_1_8 + tasks.withType(KotlinCompile).configureEach { + compilerOptions { + languageVersion = KOTLIN_1_8 + apiVersion = KOTLIN_1_8 + jvmTarget = JVM_17 javaParameters = true // Useful for reflection. - freeCompilerArgs = ['-Xjvm-default=compatibility'] + freeCompilerArgs = ['-Xjvm-default=all-compatibility'] allWarningsAsErrors = warnings_as_errors } } @@ -378,7 +348,7 @@ allprojects { // Required to use Gradle build cache (until Gradle 5.0 is released with default value of "append" set to false) // See https://github.com/gradle/gradle/issues/5269 and https://github.com/gradle/gradle/pull/6419 extensions.configure(TypeOf.typeOf(JacocoTaskExtension)) { ex -> - ex.append = false +// ex.append = false } maxParallelForks = (System.env.CORDA_TESTING_FORKS == null) ? 1 : "$System.env.CORDA_TESTING_FORKS".toInteger() @@ -392,13 +362,6 @@ allprojects { } } - if (jdkClassifier) { - jar { - // JDK11 built and published artifacts to include classifier - archiveClassifier = jdkClassifier - } - } - group 'net.corda' version "$corda_release_version" @@ -437,6 +400,16 @@ allprojects { includeGroup 'com.github.bft-smart' includeGroup 'com.github.detro' } + metadataSources { + mavenPom() + artifact() + } + } + maven { + url "${publicArtifactURL}/corda-dependencies-dev" + content { + includeGroup 'co.paralleluniverse' + } } maven { url "${publicArtifactURL}/corda-dev" @@ -467,8 +440,6 @@ allprojects { all { resolutionStrategy { // Force dependencies to use the same version of Kotlin as Corda. - force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - force "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" force "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" // Force dependencies to use the same version of Guava as Corda. @@ -525,8 +496,6 @@ allprojects { cfg.resolutionStrategy { dependencySubstitution { // Force dependencies to use the same version of Kotlin as Corda. - substitute module('org.jetbrains.kotlin:kotlin-stdlib-jdk8') with module("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version") - substitute module('org.jetbrains.kotlin:kotlin-stdlib-jdk7') with module("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version") substitute module('org.jetbrains.kotlin:kotlin-stdlib-common') with module("org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version") substitute module('org.jetbrains.kotlin:kotlin-stdlib') with module("org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version") substitute module('org.jetbrains.kotlin:kotlin-reflect') with module("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version") @@ -550,37 +519,29 @@ sonarqube { } } -// Check that we are running on a Java 8 JDK. The source/targetCompatibility values above aren't sufficient to -// guarantee this because those are properties checked by the Java plugin, but we're using Kotlin. -// -// We recommend a specific minor version (unfortunately, not checkable directly) because JavaFX adds APIs in -// minor releases, so we can't work with just any Java 8, it has to be a recent one. -if (!JavaVersion.current().java8Compatible) - throw new GradleException("Corda requires Java 8, please upgrade to at least 1.8.0_$java8_minUpdateVersion") - configurations { detekt } // Required for building out the fat JAR. dependencies { - compile project(':node') - compile "com.google.guava:guava:$guava_version" + implementation project(':node') + implementation "com.google.guava:guava:$guava_version" - // Set to corda compile to ensure it exists now deploy nodes no longer relies on build - compile project(path: ":node:capsule", configuration: 'runtimeArtifacts') - compile project(path: ":testing:testserver:testcapsule:", configuration: 'runtimeArtifacts') + // Set to corda implementation to ensure it exists now deploy nodes no longer relies on build + implementation project(path: ":node:capsule", configuration: 'runtimeArtifacts') + implementation project(path: ":testing:testserver:testcapsule:", configuration: 'runtimeArtifacts') // For the buildCordappDependenciesJar task - runtime project(':client:jfx') - runtime project(':client:mock') - runtime project(':client:rpc') - runtime project(':core') - runtime project(':confidential-identities') - runtime project(':finance:workflows') - runtime project(':finance:contracts') - runtime project(':testing:testserver') - testCompile project(':test-utils') + runtimeOnly project(':client:jfx') + runtimeOnly project(':client:mock') + runtimeOnly project(':client:rpc') + runtimeOnly project(':core') + runtimeOnly project(':confidential-identities') + runtimeOnly project(':finance:workflows') + runtimeOnly project(':finance:contracts') + runtimeOnly project(':testing:testserver') + testImplementation project(':test-utils') detekt 'io.gitlab.arturbosch.detekt:detekt-cli:1.0.1' } @@ -589,12 +550,12 @@ jar { enabled = false } -task jacocoRootReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) { +tasks.register('jacocoRootReport', JacocoReport) { dependsOn = subprojects.test - additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs) - sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs) - classDirectories = files(subprojects.sourceSets.main.output) - executionData = files(subprojects.jacocoTestReport.executionData) +// additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs) +// sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs) +// classDirectories = files(subprojects.sourceSets.main.output) +// executionData = files(subprojects.jacocoTestReport.executionData) reports { html.enabled = true xml.enabled = true @@ -618,13 +579,13 @@ tasks.register('detekt', JavaExec) { def plugins = detektPluginsJar.outputs.files.singleFile def params = ['-i', input, '-c', config, '-b', baseline, '--plugins', plugins] inputs.files(detektPluginsJar, config, baseline) - main = "io.gitlab.arturbosch.detekt.cli.Main" + mainClass = "io.gitlab.arturbosch.detekt.cli.Main" classpath = configurations.detekt args(params) } tasks.register('detektBaseline', JavaExec) { - main = "io.gitlab.arturbosch.detekt.cli.Main" + mainClass = "io.gitlab.arturbosch.detekt.cli.Main" classpath = configurations.detekt def input = "$projectDir" def config = "$projectDir/detekt-config.yml, $projectDir/detekt-baseline-config.yml" @@ -637,100 +598,25 @@ tasks.withType(Test).configureEach { reports.html.destination = file("${reporting.baseDir}/${name}") } -task testReport(type: TestReport) { +tasks.register('testReport', TestReport) { destinationDir = file("$buildDir/reports/allTests") // Include the results from the `test` task in all subprojects reportOn subprojects*.test } -bintrayConfig { - user = System.getenv('CORDA_BINTRAY_USER') - key = System.getenv('CORDA_BINTRAY_KEY') - repo = 'corda' - org = 'r3' - licenses = ['Apache-2.0'] - vcsUrl = 'https://github.com/corda/corda' - projectUrl = 'https://github.com/corda/corda' - gpgSign = true - gpgPassphrase = System.getenv('CORDA_BINTRAY_GPG_PASSPHRASE') - publications = [ - 'corda-opentelemetry', - 'corda-opentelemetry-driver', - 'corda-jfx', - 'corda-mock', - 'corda-rpc', - 'corda-core', - 'corda', - 'corda-finance-workflows', - 'corda-finance-contracts', - 'corda-node', - 'corda-node-api', - 'corda-test-common', - 'corda-core-test-utils', - 'corda-test-utils', - 'corda-test-db', - 'corda-jackson', - 'corda-testserver-impl', - 'corda-testserver', - 'corda-node-driver', - 'corda-confidential-identities', - 'corda-shell', - 'corda-tools-shell-cli', - 'corda-serialization', - 'corda-tools-blob-inspector', - 'corda-tools-explorer', - 'corda-tools-network-bootstrapper', - 'corda-tools-cliutils', - 'corda-common-configuration-parsing', - 'corda-common-validation', - 'corda-common-logging', - 'corda-tools-network-builder', - 'corda-tools-checkpoint-agent' - ] - license { - name = 'Apache-2.0' - url = 'https://www.apache.org/licenses/LICENSE-2.0' - distribution = 'repo' - } - developer { - id = 'R3' - name = 'R3' - email = 'dev@corda.net' - } -} - -// Build a ZIP of all JARs required to compile the Cordapp template // Note: corda.jar is used at runtime so no runtime ZIP is necessary. // Resulting ZIP can be found in "build/distributions" -task buildCordappDependenciesZip(type: Zip) { +tasks.register('buildCordappDependenciesZip', Zip) { baseName 'corda-deps' - from configurations.runtime - from configurations.compile - from configurations.testCompile + from configurations.runtimeOnly + from configurations.implementation + from configurations.testImplementation from buildscript.configurations.classpath from 'node/capsule/NOTICE' // CDDL notice duplicatesStrategy = DuplicatesStrategy.EXCLUDE } -artifactory { - publish { - contextUrl = artifactory_contextUrl - repository { - repoKey = 'corda-dev' - username = System.getenv('CORDA_ARTIFACTORY_USERNAME') - password = System.getenv('CORDA_ARTIFACTORY_PASSWORD') - } - - defaults { - // Root project applies the plugin (for this block) but does not need to be published - if (project != rootProject) { - publications(project.extensions.publish.name()) - } - } - } -} - -tasks.register('generateApi', net.corda.plugins.apiscanner.GenerateApi) { +tasks.register('generateApi', GenerateApi) { baseName = "api-corda" } diff --git a/docker/src/docker/Dockerfile b/docker/src/docker/Dockerfile index a6014f8973..ecd3bb48d5 100644 --- a/docker/src/docker/Dockerfile +++ b/docker/src/docker/Dockerfile @@ -1,11 +1,11 @@ -FROM azul/zulu-openjdk:8u392 +FROM azul/zulu-openjdk:17.0.8.1 ## Remove Azul Zulu repo, as it is gone by now RUN rm -rf /etc/apt/sources.list.d/zulu.list ## Add packages, clean cache, create dirs, create corda user and change ownership RUN apt-get update && \ - apt-mark hold zulu8-jdk && \ + apt-mark hold zulu17-jdk && \ apt-get -y upgrade && \ apt-get -y install bash curl unzip && \ rm -rf /var/lib/apt/lists/* && \ @@ -33,7 +33,7 @@ ENV CORDAPPS_FOLDER="/opt/corda/cordapps" \ MY_RPC_PORT=10201 \ MY_RPC_ADMIN_PORT=10202 \ PATH=$PATH:/opt/corda/bin \ - JVM_ARGS="-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap " \ + JVM_ARGS="-XX:+UnlockExperimentalVMOptions " \ CORDA_ARGS="" ##CORDAPPS FOLDER diff --git a/docker/src/docker/Dockerfile-debug b/docker/src/docker/Dockerfile-debug index b7dd204884..8b36530f5e 100644 --- a/docker/src/docker/Dockerfile-debug +++ b/docker/src/docker/Dockerfile-debug @@ -1,8 +1,8 @@ -FROM azul/zulu-openjdk:8u392 +FROM azul/zulu-openjdk:17.0.8.1 ## Add packages, clean cache, create dirs, create corda user and change ownership RUN apt-get update && \ - apt-mark hold zulu8-jdk && \ + apt-mark hold zulu17-jdk && \ apt-get -y upgrade && \ apt-get -y install bash curl unzip netstat lsof telnet netcat && \ rm -rf /var/lib/apt/lists/* && \ @@ -28,7 +28,7 @@ ENV CORDAPPS_FOLDER="/opt/corda/cordapps" \ MY_RPC_PORT=10201 \ MY_RPC_ADMIN_PORT=10202 \ PATH=$PATH:/opt/corda/bin \ - JVM_ARGS="-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap " \ + JVM_ARGS="-XX:+UnlockExperimentalVMOptions " \ CORDA_ARGS="" ##CORDAPPS FOLDER diff --git a/docker/src/docker/DockerfileAL b/docker/src/docker/DockerfileAL index 816ef57027..73a21334d7 100644 --- a/docker/src/docker/DockerfileAL +++ b/docker/src/docker/DockerfileAL @@ -1,4 +1,4 @@ -FROM amazoncorretto:8u392-al2 +FROM amazoncorretto:17.0.9 ## Add packages, clean cache, create dirs, create corda user and change ownership RUN yum -y install bash && \ @@ -31,7 +31,7 @@ ENV CORDAPPS_FOLDER="/opt/corda/cordapps" \ MY_RPC_PORT=10201 \ MY_RPC_ADMIN_PORT=10202 \ PATH=$PATH:/opt/corda/bin \ - JVM_ARGS="-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap " \ + JVM_ARGS="-XX:+UnlockExperimentalVMOptions " \ CORDA_ARGS="" ##CORDAPPS FOLDER @@ -65,4 +65,4 @@ COPY --chown=corda:corda starting-node.conf /opt/corda/starting-node.conf USER "corda" EXPOSE ${MY_P2P_PORT} ${MY_RPC_PORT} ${MY_RPC_ADMIN_PORT} WORKDIR /opt/corda -CMD ["run-corda"] \ No newline at end of file +CMD ["run-corda"] diff --git a/gradle.properties b/gradle.properties index a54780ad19..1e6c30d918 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,10 @@ kotlin.incremental=true -org.gradle.jvmargs=-XX:+UseG1GC -Xmx4g -Dfile.encoding=UTF-8 -org.gradle.caching=true +org.gradle.jvmargs=-Xmx6g -Dfile.encoding=UTF-8 --add-opens 'java.base/java.time=ALL-UNNAMED' --add-opens 'java.base/java.io=ALL-UNNAMED' +org.gradle.caching=false owasp.failOnError=false owasp.failBuildOnCVSS=11.0 compilation.allWarningsAsErrors=false test.parallel=false - -# Gradle Enterprise -gradleEnterpriseUrl = https://gradle.dev.r3.com -gradleEnterprisePlugin = 3.8.1 -customUserDataGradlePlugin = 1.6.3 +kotlin_version=1.9.0 +commons_lang3_version=3.12.0 +json_api_version=1.1.4 diff --git a/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt b/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt index b283c137c4..a0e8fe83c7 100644 --- a/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt +++ b/node/src/main/kotlin/net/corda/node/services/api/ServiceHubInternal.kt @@ -38,12 +38,9 @@ import net.corda.node.services.persistence.AttachmentStorageInternal import net.corda.node.services.statemachine.ExternalEvent import net.corda.node.services.statemachine.FlowStateMachineImpl import net.corda.nodeapi.internal.persistence.CordaPersistence +import java.security.PublicKey import java.security.SignatureException -import java.util.ArrayList import java.util.Collections -import java.util.HashMap -import java.util.HashSet -import java.util.LinkedHashSet interface NetworkMapCacheInternal : NetworkMapCache, NetworkMapCacheBase { override val nodeReady: OpenFuture From d049f8a6f3e69cb35ab33a2a1c0ed5f51b36a67b Mon Sep 17 00:00:00 2001 From: Jose Coll Date: Tue, 19 Dec 2023 09:20:31 +0000 Subject: [PATCH 13/15] Re-add build cache configuration. --- buildCacheSettings.gradle | 16 ++++++++++++++++ settings.gradle | 18 +----------------- 2 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 buildCacheSettings.gradle diff --git a/buildCacheSettings.gradle b/buildCacheSettings.gradle new file mode 100644 index 0000000000..b4d0175f6e --- /dev/null +++ b/buildCacheSettings.gradle @@ -0,0 +1,16 @@ +// Gradle Build Cache configuration recommendation: https://docs.gradle.org/current/userguide/build_cache.html +ext { + isCiServer = System.getenv().containsKey("CORDA_CI") + gradleBuildCacheURL = System.getenv().containsKey("GRADLE_BUILD_CACHE_URL") ? System.getenv().get("GRADLE_BUILD_CACHE_URL") : 'http://localhost:5071/cache/' +} + +buildCache { + local { + enabled = !isCiServer + } + remote(HttpBuildCache) { + enabled = isCiServer + url = gradleBuildCacheURL + push = isCiServer + } +} diff --git a/settings.gradle b/settings.gradle index bf61ba16cf..8f2543aebb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -122,24 +122,8 @@ include 'common-logging' project(":common-logging").projectDir = new File("$settingsDir/common/logging") // Common libraries - end +apply from: 'buildCacheSettings.gradle' include 'detekt-plugins' include 'tools:error-tool' -buildCache { - local { enabled = false } - remote(HttpBuildCache) { - url = "${gradleEnterpriseUrl}/cache/" - credentials { - username = settings.ext.find('BUILD_CACHE_CREDENTIALS_USR') ?: System.getenv('BUILD_CACHE_CREDENTIALS_USR') - password = settings.ext.find('BUILD_CACHE_CREDENTIALS_PSW') ?: System.getenv('BUILD_CACHE_CREDENTIALS_PSW') - } - if (System.getenv().containsKey("JENKINS_URL")) { - push = true - enabled = true - } else { - push = false - enabled = false - } - } -} From 5a807e1eed997f85eab57abad49a15fca4deeb14 Mon Sep 17 00:00:00 2001 From: Jose Coll Date: Tue, 19 Dec 2023 09:25:43 +0000 Subject: [PATCH 14/15] Detekt. --- .../kotlin/net/corda/node/services/vault/NodeVaultService.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt b/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt index d64698f74b..ce21da56dd 100644 --- a/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt +++ b/node/src/main/kotlin/net/corda/node/services/vault/NodeVaultService.kt @@ -70,7 +70,6 @@ import java.security.PublicKey import java.sql.SQLException import java.time.Clock import java.time.Instant -import java.util.Arrays import java.util.UUID import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CopyOnWriteArraySet From 0bcebd3dc1b6a3b361ff365a3dd4ac2b50763c9a Mon Sep 17 00:00:00 2001 From: Jose Coll Date: Tue, 19 Dec 2023 10:02:12 +0000 Subject: [PATCH 15/15] Detekt. --- .ci/api-current.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.ci/api-current.txt b/.ci/api-current.txt index 918e6c3f9a..56c1bd80e4 100644 --- a/.ci/api-current.txt +++ b/.ci/api-current.txt @@ -3052,21 +3052,21 @@ public final class net.corda.core.flows.FlowRecoveryException extends net.corda. @CordaSerializable public final class net.corda.core.flows.FlowRecoveryQuery extends java.lang.Object public () - public (net.corda.core.flows.FlowTimeWindow, net.corda.core.identity.CordaX500Name, java.util.List) - public (net.corda.core.flows.FlowTimeWindow, net.corda.core.identity.CordaX500Name, java.util.List, int, kotlin.jvm.internal.DefaultConstructorMarker) + public (net.corda.core.flows.FlowTimeWindow, java.util.List, java.util.List) + public (net.corda.core.flows.FlowTimeWindow, java.util.List, java.util.List, int, kotlin.jvm.internal.DefaultConstructorMarker) @Nullable public final net.corda.core.flows.FlowTimeWindow component1() @Nullable - public final net.corda.core.identity.CordaX500Name component2() + public final java.util.List component2() @Nullable public final java.util.List component3() @NotNull - public final net.corda.core.flows.FlowRecoveryQuery copy(net.corda.core.flows.FlowTimeWindow, net.corda.core.identity.CordaX500Name, java.util.List) + public final net.corda.core.flows.FlowRecoveryQuery copy(net.corda.core.flows.FlowTimeWindow, java.util.List, java.util.List) public boolean equals(Object) @Nullable public final java.util.List getCounterParties() @Nullable - public final net.corda.core.identity.CordaX500Name getInitiatedBy() + public final java.util.List getInitiatedBy() @Nullable public final net.corda.core.flows.FlowTimeWindow getTimeframe() public int hashCode()