forked from strimzi/strimzi-kafka-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile-pr
92 lines (88 loc) · 2.92 KB
/
Jenkinsfile-pr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env groovy
def lib
pipeline {
agent {
node {
label 'strimzi-pr'
}
}
parameters {
string(name: 'JUNIT_TAGS', defaultValue: 'acceptance,regression', description: 'maven parameter for executing specific subset of tests with specific tag')
string(name: 'TEST_CASE', defaultValue: '*ST', description: 'maven parameter for executing specific tests')
}
options {
timeout(time: 7, unit: 'HOURS')
ansiColor('xterm')
}
environment {
DOCKER_ORG="strimzi"
DOCKER_REGISTRY="docker.io"
DOCKER_TAG="pr"
OPENSHIFT_URL="https://github.com/openshift/origin/releases/download/v3.11.0/openshift-origin-client-tools-v3.11.0-0cbc58b-linux-64bit.tar.gz"
ARTIFACTS_DIR = 'systemtest/target/logs'
JOB_NAME_SUB = "${String.format("%.15s", JOB_NAME).toLowerCase()}"
}
stages {
stage('Clean WS') {
steps {
cleanWs()
}
}
stage('Checkout Strimzi') {
steps {
checkout scm
}
}
stage('Parse parameters from comment') {
steps {
script {
if (env.ghprbCommentBody.contains('tags=')) {
env.JUNIT_TAGS = env.ghprbCommentBody.split('tags=')[1].split(/\s/)[0]
}
echo "JUNIT_TAGS: ${env.JUNIT_TAGS}"
if (env.ghprbCommentBody.contains('testcase=')) {
env.TEST_CASE = env.ghprbCommentBody.split('testcase=')[1].split(/\s/)[0]
}
echo "TEST_CASE: ${env.TEST_CASE}"
}
}
}
stage('Start Openshift') {
steps {
timeout(time: 25, unit: 'MINUTES') {
script {
lib = evaluate readFile('./jenkins.groovy')
lib.setupEnvironment(env.WORKSPACE, env.OPENSHIFT_URL)
}
}
}
}
stage('Build images') {
steps {
script {
lib.buildStrimzi()
}
}
}
stage('Execute system tests') {
steps {
script {
lib.runSystemTests(env.WORKSPACE, env.JUNIT_TAGS, env.TEST_CASE)
}
}
}
}
post {
always {
script {
lib.postAction(env.ARTIFACTS_DIR, env.ghprbPullId, env.ghprbActualCommitAuthor, env.ghprbPullTitle, env.ghprbPullLink, env.BUILD_URL, env.WORKSPACE, env.STRIMZI_MAILING_LIST)
}
}
failure {
echo "Build failed"
script {
lib.sendMail(env.STRIMZI_MAILING_LIST, "failed", env.ghprbPullId, env.ghprbActualCommitAuthor, env.ghprbPullTitle, env.ghprbPullLink, env.BUILD_URL)
}
}
}
}