2020-01-24 10:39:23 +00:00
|
|
|
@Library('corda-shared-build-pipeline-steps')
|
2019-10-28 11:48:04 +00:00
|
|
|
import static com.r3.build.BuildControl.killAllExistingBuildsForJob
|
|
|
|
|
|
|
|
killAllExistingBuildsForJob(env.JOB_NAME, env.BUILD_NUMBER.toInteger())
|
|
|
|
|
|
|
|
pipeline {
|
2020-04-17 14:52:47 +00:00
|
|
|
agent { label 'k8s' }
|
2020-02-12 14:26:06 +00:00
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
overrideIndexTriggers(false)
|
|
|
|
timeout(time: 3, unit: 'HOURS')
|
|
|
|
}
|
2019-11-04 15:31:36 +00:00
|
|
|
|
2019-10-28 11:48:04 +00:00
|
|
|
triggers {
|
|
|
|
issueCommentTrigger('.*smoke tests.*')
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
|
|
|
EXECUTOR_NUMBER = "${env.EXECUTOR_NUMBER}"
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2019-11-04 16:18:31 +00:00
|
|
|
stage('Corda Smoke Tests') {
|
2019-10-28 11:48:04 +00:00
|
|
|
steps {
|
|
|
|
script {
|
2019-11-04 16:18:31 +00:00
|
|
|
if (currentBuildTriggeredByComment()) {
|
|
|
|
stage('Run Smoke Tests') {
|
|
|
|
script {
|
|
|
|
pullRequest.createStatus(status: 'pending',
|
|
|
|
context: 'continuous-integration/jenkins/pr-merge/smokeTest',
|
2019-11-04 16:19:55 +00:00
|
|
|
description: 'Smoke Tests Running',
|
2019-11-04 16:18:31 +00:00
|
|
|
targetUrl: "${env.JOB_URL}")
|
|
|
|
}
|
|
|
|
|
|
|
|
withCredentials([string(credentialsId: 'container_reg_passwd', variable: 'DOCKER_PUSH_PWD')]) {
|
|
|
|
sh "./gradlew " +
|
|
|
|
"-Dkubenetize=true " +
|
|
|
|
"-Ddocker.push.password=\"\${DOCKER_PUSH_PWD}\" " +
|
|
|
|
"-Ddocker.work.dir=\"/tmp/\${EXECUTOR_NUMBER}\" " +
|
|
|
|
" clean allParallelSmokeTest --stacktrace"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2019-10-28 11:48:04 +00:00
|
|
|
}
|
2019-11-04 15:31:36 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-04 16:19:55 +00:00
|
|
|
}
|
2019-11-04 15:31:36 +00:00
|
|
|
|
2019-11-04 16:19:55 +00:00
|
|
|
post {
|
|
|
|
always {
|
2019-11-04 16:28:52 +00:00
|
|
|
script {
|
|
|
|
if (currentBuildTriggeredByComment()) {
|
|
|
|
archiveArtifacts artifacts: '**/pod-logs/**/*.log', fingerprint: false
|
2020-06-18 11:52:33 +00:00
|
|
|
junit testResults: '**/build/test-results-xml/**/*.xml', keepLongStdio: true
|
2019-11-04 16:28:52 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-04 16:19:55 +00:00
|
|
|
}
|
2019-11-04 15:31:36 +00:00
|
|
|
|
|
|
|
|
2019-11-04 16:19:55 +00:00
|
|
|
success {
|
|
|
|
script {
|
2019-11-04 16:28:52 +00:00
|
|
|
if (currentBuildTriggeredByComment()) {
|
|
|
|
pullRequest.createStatus(status: 'success',
|
|
|
|
context: 'continuous-integration/jenkins/pr-merge/smokeTest',
|
|
|
|
description: 'Smoke Tests Passed',
|
2019-11-15 15:14:01 +00:00
|
|
|
targetUrl: "${env.BUILD_URL}testResults")
|
2019-11-04 16:28:52 +00:00
|
|
|
}
|
2019-10-28 11:48:04 +00:00
|
|
|
}
|
2019-11-04 16:19:55 +00:00
|
|
|
}
|
2019-10-28 11:48:04 +00:00
|
|
|
|
2019-11-04 16:19:55 +00:00
|
|
|
failure {
|
|
|
|
script {
|
2019-11-04 16:28:52 +00:00
|
|
|
if (currentBuildTriggeredByComment()) {
|
|
|
|
pullRequest.createStatus(status: 'failure',
|
|
|
|
context: 'continuous-integration/jenkins/pr-merge/smokeTest',
|
|
|
|
description: 'Smoke Tests Failed',
|
2019-11-15 15:14:01 +00:00
|
|
|
targetUrl: "${env.BUILD_URL}testResults")
|
2019-11-04 16:28:52 +00:00
|
|
|
}
|
2019-10-28 11:48:04 +00:00
|
|
|
}
|
2019-11-04 16:19:55 +00:00
|
|
|
}
|
2019-10-28 11:48:04 +00:00
|
|
|
|
2019-11-04 16:19:55 +00:00
|
|
|
cleanup {
|
|
|
|
deleteDir() /* clean up our workspace */
|
2019-10-28 11:48:04 +00:00
|
|
|
}
|
|
|
|
}
|
2019-11-04 15:31:36 +00:00
|
|
|
}
|
|
|
|
|
2019-11-04 16:18:31 +00:00
|
|
|
@NonCPS
|
|
|
|
def currentBuildTriggeredByComment() {
|
|
|
|
def triggerCause = currentBuild.rawBuild.getCause(org.jenkinsci.plugins.pipeline.github.trigger.IssueCommentCause)
|
|
|
|
if (triggerCause) {
|
|
|
|
echo("Build was started by ${triggerCause.userLogin}, who wrote: " +
|
|
|
|
"\"${triggerCause.comment}\", which matches the " +
|
|
|
|
"\"${triggerCause.triggerPattern}\" trigger pattern.")
|
|
|
|
} else {
|
|
|
|
echo('Build was not started by a trigger')
|
|
|
|
}
|
|
|
|
|
2019-11-04 16:24:14 +00:00
|
|
|
return triggerCause != null
|
2019-12-20 14:44:45 +00:00
|
|
|
}
|