forked from elastest/elastest-bigdata-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
71 lines (57 loc) · 2.9 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
node('docker'){
stage "Container Prep"
echo("the node is up")
//sh 'echo 262144 | sudo tee /proc/sys/vm/max_map_count'
def mycontainer = docker.image('sgioldasis/ci-docker-in-docker')
mycontainer.pull()
mycontainer.inside("-u jenkins -v /var/run/docker.sock:/var/run/docker.sock:rw") {
// Get EDM source code
git 'https://github.com/elastest/elastest-data-manager.git'
stage "Run EDM docker-compose"
sh 'chmod +x bin/* && bin/teardown-ci.sh && bin/startup-ci.sh'
echo ("EDM System is running..")
// Get EBS source code
git 'https://github.com/elastest/elastest-bigdata-service.git'
stage "Build REST API image - Package"
echo ("building..")
def rest_api_image = docker.build("elastest/ebs:latest","./rest-api")
stage "Build Spark Base image - Package"
echo ("building..")
def spark_base_image = docker.build("elastest/ebs-spark:latest","./spark")
// Run EBS docker-compose
stage "Run EBS docker-compose"
sh 'chmod +x bin/* && bin/teardown-linux.sh && bin/startup-linux.sh'
echo ("EBS System is running..")
stage "Unit tests"
echo ("Starting unit tests...")
sh 'bin/run-tests.sh'
step([$class: 'JUnitResultArchiver', testResults: '**/rest-api/nosetests.xml'])
stage "Cobertura"
//sh 'bin/run-tests.sh'
sh('cd rest-api && git rev-parse HEAD > GIT_COMMIT')
git_commit=readFile('rest-api/GIT_COMMIT')
sh 'export GIT_COMMIT=$git_commit'
sh 'export GIT_BRANCH=master'
def codecovArgs = "-v -t $COB_EBS_TOKEN"
// def codecovArgs = "-v -t 64f66b26-1b9c-48ab-b412-9021cdbc36cd"
echo "$codecovArgs"
def exitCode = sh(
returnStatus: true,
script: "curl -s https://codecov.io/bash | bash -s - $codecovArgs")
if (exitCode != 0) {
echo( exitCode +': Failed to upload code coverage to codecov')
}
stage "publish"
echo ("publishing..")
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'elastestci-dockerhub',
usernameVariable: 'USERNAME',
passwordVariable: 'PASSWORD']]) {
sh 'docker login -u "$USERNAME" -p "$PASSWORD"'
//here your code
rest_api_image.push()
spark_base_image.push()
}
}
}