From d95c3e2b8b066558e2fee6c1851e8101e569cf58 Mon Sep 17 00:00:00 2001 From: Stefano Franz Date: Mon, 27 Jan 2020 14:58:21 +0000 Subject: [PATCH] Use a local instance of k8s instead of remote cluster for parallel testing (#5897) * switch to new version of plugin * change plugin version to force refresh * try using pre-populated cache * do not preallocate * no daemon * reduce cores per fork to increase parallelism * even more aggresive cpu allocation --- .ci/dev/localStorageClass.yml | 5 +++++ Jenkinsfile | 14 +++++++------- build.gradle | 6 +++--- 3 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .ci/dev/localStorageClass.yml diff --git a/.ci/dev/localStorageClass.yml b/.ci/dev/localStorageClass.yml new file mode 100644 index 0000000000..f380c51dbe --- /dev/null +++ b/.ci/dev/localStorageClass.yml @@ -0,0 +1,5 @@ +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: testing-storage +provisioner: microk8s.io/hostpath \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 0c5b0f188f..f7ea019654 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ import static com.r3.build.BuildControl.killAllExistingBuildsForJob killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger()) pipeline { - agent { label 'k8s' } + agent { label 'local-k8s' } options { timestamps() } environment { @@ -19,12 +19,12 @@ pipeline { stage('Corda Pull Request - Generate Build Image') { steps { withCredentials([string(credentialsId: 'container_reg_passwd', variable: 'DOCKER_PUSH_PWD')]) { - sh "./gradlew " + + sh "./gradlew --no-daemon " + "-Dkubenetize=true " + "-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " + "-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " + "-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" + - " clean pushBuildImage preAllocateForAllParallelIntegrationTest preAllocateForAllParallelUnitTest --stacktrace" + " clean pushBuildImage --stacktrace" } sh "kubectl auth can-i get pods" } @@ -34,7 +34,7 @@ pipeline { parallel { stage('Integration Tests') { steps { - sh "./gradlew " + + sh "./gradlew --no-daemon " + "-DbuildId=\"\${BUILD_ID}\" " + "-Dkubenetize=true " + "-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\" " + @@ -42,12 +42,12 @@ pipeline { "-Dartifactory.password=\"\${ARTIFACTORY_CREDENTIALS_PSW}\" " + "-Dgit.branch=\"\${GIT_BRANCH}\" " + "-Dgit.target.branch=\"\${CHANGE_TARGET}\" " + - " deAllocateForAllParallelIntegrationTest allParallelIntegrationTest --stacktrace" + " allParallelIntegrationTest --stacktrace" } } stage('Unit Tests') { steps { - sh "./gradlew " + + sh "./gradlew --no-daemon " + "-DbuildId=\"\${BUILD_ID}\" " + "-Dkubenetize=true " + "-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\" " + @@ -55,7 +55,7 @@ pipeline { "-Dartifactory.password=\"\${ARTIFACTORY_CREDENTIALS_PSW}\" " + "-Dgit.branch=\"\${GIT_BRANCH}\" " + "-Dgit.target.branch=\"\${CHANGE_TARGET}\" " + - " deAllocateForAllParallelUnitTest allParallelUnitTest --stacktrace" + " allParallelUnitTest --stacktrace" } } } diff --git a/build.gradle b/build.gradle index bdb66ed4ec..1228d771bf 100644 --- a/build.gradle +++ b/build.gradle @@ -183,7 +183,7 @@ buildscript { // 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 group: "com.r3.testing", name: "gradle-distributed-testing-plugin", version: "1.2-SNAPSHOT", changing: true + classpath group: "com.r3.testing", name: "gradle-distributed-testing-plugin", version: "1.2-LOCAL-K8S-SHARED-CACHE-SNAPSHOT", changing: true classpath "com.bmuschko:gradle-docker-plugin:5.0.0" } } @@ -634,7 +634,7 @@ task allParallelIntegrationTest(type: ParallelTestGroup) { testGroups "integrationTest" numberOfShards 10 streamOutput false - coresPerFork 5 + coresPerFork 2 memoryInGbPerFork 12 distribute DistributeTestsBy.METHOD nodeTaints "big" @@ -644,7 +644,7 @@ task allParallelUnitTest(type: ParallelTestGroup) { testGroups "test" numberOfShards 10 streamOutput false - coresPerFork 3 + coresPerFork 2 memoryInGbPerFork 12 distribute DistributeTestsBy.CLASS nodeTaints "small"