Merge pull request #5662 from corda/setup_regression_builds

Setup regression builds in jenkins
This commit is contained in:
Stefano Franz 2019-11-01 16:51:07 +00:00 committed by GitHub
commit cf849fbdbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 23 deletions

View File

@ -8,7 +8,7 @@ pipeline {
options { timestamps() } options { timestamps() }
environment { environment {
DOCKER_TAG_TO_USE = "${UUID.randomUUID().toString().toLowerCase().subSequence(0, 12)}" DOCKER_TAG_TO_USE = "${env.GIT_COMMIT.subSequence(0, 8)}"
EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}" EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}"
BUILD_ID = "${env.BUILD_ID}-${env.JOB_NAME}" BUILD_ID = "${env.BUILD_ID}-${env.JOB_NAME}"
} }
@ -21,37 +21,28 @@ pipeline {
"-Dkubenetize=true " + "-Dkubenetize=true " +
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " + "-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " + "-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
"-Ddocker.provided.tag=\"\${DOCKER_TAG_TO_USE}\"" + "-Ddocker.build.tag=\"\${DOCKER_TAG_TO_USE}\"" +
" clean pushBuildImage" " clean pushBuildImage preAllocateForParallelRegressionTest --stacktrace"
} }
sh "kubectl auth can-i get pods" sh "kubectl auth can-i get pods"
} }
} }
stage('Corda Pull Request - Run Tests') { stage('Regression Test') {
stage('Unit and Integration Tests') { steps {
steps { sh "./gradlew " +
sh "./gradlew " + "-DbuildId=\"\${BUILD_ID}\" " +
"-DbuildId=\"\${BUILD_ID}\" " + "-Dkubenetize=true " +
"-Dkubenetize=true " + "-Ddocker.run.tag=\"\${DOCKER_TAG_TO_USE}\"" +
"-Ddocker.tag=\"\${DOCKER_TAG_TO_USE}\"" + " deAllocateForParallelRegressionTest parallelRegressionTest --stacktrace"
" allParallelUnitAndIntegrationTest"
}
}
stage('Slow Integration Tests') {
steps {
sh "./gradlew " +
"-DbuildId=\"\${BUILD_ID}\" " +
"-Dkubenetize=true " +
"-Ddocker.tag=\"\${DOCKER_TAG_TO_USE}\"" +
" allParallelSlowIntegrationTest"
}
} }
} }
} }
post { post {
always { always {
archiveArtifacts artifacts: '**/pod-logs/**/*.log', fingerprint: false
junit '**/build/test-results-xml/**/*.xml' junit '**/build/test-results-xml/**/*.xml'
} }
cleanup { cleanup {

View File

@ -104,8 +104,7 @@ public class KubesTest extends DefaultTask {
} }
List<Future<KubePodResult>> futures = IntStream.range(0, numberOfPods).mapToObj(i -> { List<Future<KubePodResult>> futures = IntStream.range(0, numberOfPods).mapToObj(i -> {
String potentialPodName = (taskToExecuteName + "-" + stableRunId + random + i).toLowerCase(); String podName = generatePodName(stableRunId, random, i);
String podName = potentialPodName.substring(0, Math.min(potentialPodName.length(), 62));
return submitBuild(NAMESPACE, numberOfPods, i, podName, printOutput, 3); return submitBuild(NAMESPACE, numberOfPods, i, podName, printOutput, 3);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -125,6 +124,16 @@ public class KubesTest extends DefaultTask {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@NotNull
private String generatePodName(String stableRunId, String random, int i) {
int magicMaxLength = 63;
String provisionalName = taskToExecuteName.toLowerCase() + "-" + stableRunId + "-" + random + "-" + i;
//length = 100
//100-63 = 37
//subString(37, 100) -? string of 63 characters
return provisionalName.substring(Math.max(provisionalName.length() - magicMaxLength, 0));
}
@NotNull @NotNull
private KubernetesClient getKubernetesClient() { private KubernetesClient getKubernetesClient() {
io.fabric8.kubernetes.client.Config config = new io.fabric8.kubernetes.client.ConfigBuilder() io.fabric8.kubernetes.client.Config config = new io.fabric8.kubernetes.client.ConfigBuilder()