-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile_IT_test
138 lines (112 loc) · 6.59 KB
/
Jenkinsfile_IT_test
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
132
133
134
135
136
137
138
node('TESTDOCKER'){
stage "CI Container setup"
try {
echo("the node is up")
def mycontainer = docker.image('elastest/ci-docker-compose-siblings:node11-npm6')
mycontainer.pull() // make sure we have the latest available from Docker Hub
mycontainer.inside("-u jenkins -p 37500:37500 -p 37501:37501 -p 37502:37502 -p 37503:37503 -v /var/run/docker.sock:/var/run/docker.sock:rw -v ${WORKSPACE}:/home/jenkins/.m2 -v /home/ubuntu/.gnupg:/home/jenkins/.gnupg") {
def epmClientJavaDirectory = 'epm-client-java'
def eusJavaDirectory = 'eus-java'
def k8sClientJavaDirectory = 'k8s-client-java'
git(
url: 'https://github.com/elastest/elastest-torm.git',
branch: "$ETM_BRANCH"
)
stage "Install Kubernetes-client as library"
def k8sClientDirectoryExists = fileExists k8sClientJavaDirectory
if (k8sClientDirectoryExists) {
echo 'Kubernetes client directory exists'
} else {
echo 'There isn not Kubernetes-client directory'
sh 'mkdir ' + k8sClientJavaDirectory
}
dir(k8sClientJavaDirectory) {
echo 'Existing files before cloning the git repository'
git(
url: 'https://github.com/franciscoRdiaz/kubernetes-client.git',
branch: "$K8_CLIENT_BRANCH"
)
}
echo ("Install Kubernetes-client as library")
sh "cd $k8sClientJavaDirectory/kubernetes-client; mvn clean install -DskipTests"
stage "Install et-epm-client-java"
def epmClientDirectoryExists = fileExists epmClientJavaDirectory
if (epmClientDirectoryExists) {
echo 'EPM client directory exists'
} else {
echo 'There isn not EPM client directory'
sh 'mkdir ' + epmClientJavaDirectory
}
dir(epmClientJavaDirectory) {
echo 'Existing files before cloning the git repository'
git 'https://github.com/mpauls/epm-client-java.git'
}
echo 'Installing epm-client-java'
sh "ls -lrt; cd $epmClientJavaDirectory; mvn clean install -Dmaven.test.skip=true"
stage "Test and deploy epm-client"
echo ("Test and deploy epm-client")
sh 'cd ./epm-client; mvn install -DskipTests -Dgpg.skip -Djenkins=true;'
stage "Install EUS as library"
def eusDirectoryExists = fileExists eusJavaDirectory
if (eusDirectoryExists) {
echo 'EUS client directory exists'
} else {
echo 'There isn not EUS directory'
sh 'mkdir ' + eusJavaDirectory
}
dir(eusJavaDirectory) {
echo 'Existing files before cloning the git repository'
git(
url: 'https://github.com/elastest/elastest-user-emulator-service.git',
branch: "$EUS_BRANCH"
)
}
echo ("Install EUS as library")
sh "cd $eusJavaDirectory; cd ./eus; mvn clean package install -Pdependency -DskipTests -Dgpg.skip;"
stage "Build elastest-torm-gui"
echo ("Build elastest-torm-gui")
sh 'export PATH=$MVN_CMD_DIR:$PATH;cd ./elastest-torm-gui; mvn package;'
stage "Build elastest-torm"
echo ("Build elastest-torm")
sh 'cd ./elastest-torm; mvn -Pci package;'
stage "Unit Test elastest-torm"
echo ("Starting TORM unit tests")
sh 'cd ./elastest-torm; mvn -Pci-no-it-test test;'
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
stage "Test DB changes"
echo ("Test DB changes")
sh 'cd ./scripts/db; ls -lrt; chmod +777 test-liquibase-changelogs.sh;./test-liquibase-changelogs.sh;'
stage ("IT Test elastest-torm")
echo ("Starting TORM integration tests")
try{
sh 'cd ./scripts; ./it.sh'
step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml'])
} catch (err) {
def errString = err.toString()
currentBuild.result = getJobStatus(errString)
throw err
}
}
} catch (err) {
if (currentBuild.result != "UNSTABLE") {
def errString = err.toString()
echo 'Error: ' + errString
currentBuild.result = getJobStatus(errString)
}
echo 'Error!!! Send email to the people responsible for the builds.'
emailext body: 'Please go to ${BUILD_URL} and verify the build',
replyTo: '${BUILD_USER_EMAIL}',
subject: 'Job ${JOB_NAME} - ${BUILD_NUMBER} RESULT: ${BUILD_STATUS}',
to: '${MAIL_LIST}'
throw err
}
}
def getJobStatus(exceptionString) {
def status = 'SUCCESS'
if (exceptionString.contains('FlowInterruptedException') || exceptionString.contains('AbortException')) {
status = 'ABORTED'
} else {
status = 'FAILURE'
}
return status;
}