forked from scylladb/scylla-cluster-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
131 lines (120 loc) · 5.03 KB
/
Jenkinsfile
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
pipeline {
agent {
label {
label "sct-builders"
}
}
options {
timestamps()
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '10'))
}
stages {
stage("precommit") {
steps {
script {
try {
sh './docker/env/hydra.sh bash -c "cd /sct; pre-commit run -a"'
if (env.CHANGE_ID) {
pullRequest.createStatus(status: 'success',
context: 'jenkins/precommit',
description: 'Precommit passed',
targetUrl: "${env.JOB_URL}/workflow-stage")
}
} catch(Exception ex) {
if (env.CHANGE_ID) {
pullRequest.createStatus(status: 'failure',
context: 'jenkins/precommit',
description: 'Precommit failed',
targetUrl: "${env.JOB_URL}/workflow-stage")
}
currentBuild.result = 'UNSTABLE'
}
}
}
}
stage("unittest") {
steps {
script {
try {
sh './docker/env/hydra.sh unit-tests'
if (env.CHANGE_ID) {
pullRequest.createStatus(status: 'success',
context: 'jenkins/unittests',
description: 'All unit tests passed',
targetUrl: "${env.JOB_URL}/workflow-stage")
}
} catch(Exception ex) {
if (env.CHANGE_ID) {
pullRequest.createStatus(status: 'failure',
context: 'jenkins/unittests',
description: 'unit tests failed',
targetUrl: "${env.JOB_URL}/workflow-stage")
}
currentBuild.result = 'UNSTABLE'
}
}
}
}
stage("lint test-cases") {
steps {
script {
try {
sh ''' ./utils/lint_test_cases.sh '''
if (env.CHANGE_ID) {
pullRequest.createStatus(status: 'success',
context: 'jenkins/lint_test_cases',
description: 'all test cases are checked',
targetUrl: "${env.JOB_URL}/workflow-stage")
}
} catch(Exception ex) {
if (env.CHANGE_ID) {
pullRequest.createStatus(status: 'failure',
context: 'jenkins/lint_test_cases',
description: 'some test cases failed to check',
targetUrl: "${env.JOB_URL}/workflow-stage")
}
currentBuild.result = 'UNSTABLE'
}
}
}
}
stage("provision test") {
when { changeRequest() }
steps {
node('aws-sct-builders-eu-west-1') {
script {
def labels = []
pullRequest.labels.each { labels.add("${it}") }
def should_test = labels.find { it == "test-provision" }
if (should_test) {
echo "Going to Provision test Pull Request ID: ${env.CHANGE_ID}"
checkout scm
try {
sh """
#!/bin/bash
set -xe
env
echo "start test ......."
./docker/env/hydra.sh run-test longevity_test.LongevityTest.test_custom_time --config test-cases/PR-provision-test.yaml --backend aws --logdir /sct
echo "end test ....."
"""
pullRequest.createStatus(status: 'success',
context: 'jenkins/provision_test',
description: 'provision test succeeded',
targetUrl: "${env.JOB_URL}/workflow-stage")
}
catch(Exception ex) {
pullRequest.createStatus(status: 'failure',
context: 'jenkins/provision_test',
description: 'provision test failed',
targetUrl: "${env.JOB_URL}/workflow-stage")
currentBuild.result = 'UNSTABLE'
}
}
}
}
}
}
}
}