-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathJenkinsfile
More file actions
133 lines (118 loc) · 7.68 KB
/
Jenkinsfile
File metadata and controls
133 lines (118 loc) · 7.68 KB
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
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") {
git 'https://github.com/elastest/elastest-data-manager.git'
stage "Building Java API"
echo ("Starting to build Java API...")
sh 'chmod +x bin/* && bin/run-build-test-java.sh'
sh 'pwd'
step([$class: 'JUnitResultArchiver', testResults: '**/rest-java/rest_api_project/edm-rest/target/surefire-reports/*.xml'])
stage "Cobertura Java API"
sh('cd rest-java/rest_api_project/edm-rest/target/site/cobertura && git rev-parse HEAD > GIT_COMMIT')
git_commit=readFile('rest-java/rest_api_project/edm-rest/target/site/cobertura/GIT_COMMIT')
sh 'export GIT_COMMIT=$git_commit'
sh 'export GIT_BRANCH=master'
def codecovArgs = "-v -t $COB_EDM_TOKEN"
// 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 "Build Rest Java API image - Package"
echo ("building..")
// def rest_api_image = docker.build("elastest/edm:0.5","./rest-java")
//def rest_api_image = docker.build("elastest/edm:latest","./rest-java")
sh 'cd rest-java; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm:latest'
def rest_api_image = docker.image('elastest/edm:latest')
// stage "Build Rest API image - Package"
// echo ("building..")
// def rest_api_image = docker.build("elastest/edm:0.1","./rest")
stage "Build Alluxio image - Package"
echo ("building..")
sh 'chmod +x alluxio/entrypoint.sh'
// def alluxio_image = docker.build("elastest/edm-alluxio:0.1","./alluxio")
//def alluxio_image = docker.build("elastest/edm-alluxio:latest","./alluxio")
sh 'cd alluxio; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-alluxio:latest'
def alluxio_image = docker.image('elastest/edm-alluxio:latest')
stage "Build Hadoop image - Package"
echo ("building..")
// def hadoop_image = docker.build("elastest/edm-hadoop:0.1","./hadoop")
// def hadoop_image = docker.build("elastest/edm-hadoop:latest","./hadoop")
sh 'cd hadoop; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-hadoop:latest'
def hadoop_image = docker.image('elastest/edm-hadoop:latest')
stage "Build Elasticsearch image - Package"
echo ("building..")
// def elasticsearch_image = docker.build("elastest/edm-elasticsearch:0.1","./elasticsearch")
//def elasticsearch_image = docker.build("elastest/edm-elasticsearch:latest","./elasticsearch")
sh 'cd elasticsearch; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-elasticsearch:latest'
def elasticsearch_image = docker.image('elastest/edm-elasticsearch:latest')
stage "Build Kibana image - Package"
echo ("building..")
// def kibana_image = docker.build("elastest/edm-kibana:0.1","./kibana")
//def kibana_image = docker.build("elastest/edm-kibana:latest","./kibana")
sh 'cd kibana; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-kibana:latest'
def kibana_image = docker.image('elastest/edm-kibana:latest')
stage "Build Cerebro image - Package"
echo ("building..")
// def cerebro_image = docker.build("elastest/edm-cerebro:0.1","./cerebro")
//def cerebro_image = docker.build("elastest/edm-cerebro:latest","./cerebro")
sh 'cd cerebro; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-cerebro:latest'
def cerebro_image = docker.image('elastest/edm-cerebro:latest')
stage "Build MySQL image - Package"
echo ("building..")
//def mysql_image = docker.build("elastest/edm-mysql:latest","./mysql")
sh 'cd mysql; docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S) . -t elastest/edm-mysql:latest'
def mysql_image = docker.image('elastest/edm-mysql:latest')
// stage "Run EDM docker-compose"
// sh 'chmod +x bin/* && bin/teardown-ci.sh && bin/startup-ci.sh'
// echo ("EDM System is running..")
// stage "Unit tests"
// echo ("Starting unit tests...")
// sh 'bin/run-tests.sh'
// step([$class: 'JUnitResultArchiver', testResults: '**/rest/rest_api_project/nosetests.xml'])
// stage "Cobertura"
// //sh 'bin/run-tests.sh'
// sh('cd rest/rest_api_project && git rev-parse HEAD > GIT_COMMIT')
// git_commit=readFile('rest/rest_api_project/GIT_COMMIT')
//
// sh 'export GIT_COMMIT=$git_commit'
//
// sh 'export GIT_BRANCH=master'
// def codecovArgs = "-v -t $COB_EDM_TOKEN"
//
// echo "$codecovArgs"
//
// def exitCode = sh(
// returnStatus: true,
// script: "curl -s https://codecov.io/bash | bash -s - $codecovArgs")
// //script: "curl -s https://raw.githubusercontent.com/codecov/codecov-bash/master/codecov | bash -s - $codecovArgs")
// //script: " pip install --user codecov && codecov -v -t $COB_EDM_TOKEN")
// 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()
alluxio_image.push()
hadoop_image.push()
elasticsearch_image.push()
kibana_image.push()
cerebro_image.push()
mysql_image.push()
}
}
}