forked from elastest/elastest-torm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
59 lines (43 loc) · 2.21 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
node('docker'){
stage "CI Container setup"
echo("the node is up")
def mycontainer = docker.image('elastest/ci-docker-compose-siblings')
mycontainer.pull() // make sure we have the latest available from Docker Hub
mycontainer.inside("-u jenkins -v /var/run/docker.sock:/var/run/docker.sock:rw -v ${WORKSPACE}:/home/jenkins/.m2") {
git 'https://github.com/elastest/elastest-torm.git'
stage "Build elastest-torm-gui"
echo ("Build elastest-torm-gui")
sh 'cd ./elastest-torm-gui; npm install; mvn clean package;'
stage "Build elastest-torm"
echo ("Build elastest-torm")
sh 'cd ./elastest-torm; mvn -B clean -Pci package;'
stage "Unit Test elastest-torm"
echo ("Starting maven unit tests")
sh 'cd ./elastest-torm; mvn -B clean -Pci-no-it-test package;'
stage ("IT Test elastest-torm") {
sh 'cd ./scripts; ./it.sh'
//Error executing this command in Jenkinsfile
//sh "bash <(curl -s https://codecov.io/bash) -t fa48b15c-ceb8-409d-996f-8f34d53addd2"
}
stage "Create etm docker image"
echo ("Creating elastest/etm image..")
sh 'cd ./docker/elastest-torm; ./build-image.sh;'
stage "Publish etm docker image"
echo ("Publish elastest/etm image")
def myimage = docker.image('elastest/etm')
//this is work arround as withDockerRegistry is not working properly
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'elastestci-dockerhub',
usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh 'docker login -u "$USERNAME" -p "$PASSWORD"'
myimage.push()
}
}
}
def containerIp(service) {
containerIp = sh (
script: "docker inspect --format=\"{{.NetworkSettings.Networks."+env.COMPOSE_PROJECT_NAME+"_elastest.IPAddress}}\" "+env.COMPOSE_PROJECT_NAME+"_"+service+"_1",
returnStdout: true
).trim()
echo service+" IP = " + containerIp;
return containerIp;
}