-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
76 lines (56 loc) · 3.59 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
node('dev-docker-64-slave-4') {
stage " Download Elastest-toolbox"
def mycontainer = docker.image('elastest/ci-docker-compose-siblings')
mycontainer.pull() // make sure we have the latest available from Docker Hub
mycontainer.inside("-u 0 -v /var/run/docker.sock:/var/run/docker.sock:rw -v /var/lib/jenkins/caches/durable-task:/var/lib/jenkins/caches/durable-task:rw -v ${WORKSPACE}:/home/jenkins/.m2") {
checkout([
$class: 'GitSCM',
branches: scm.branches,
doGenerateSubmoduleConfigurations: false,
extensions: [[
$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: true,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false
]],
submoduleCfg: [],
userRemoteConfigs: [[url: 'https://github.com/elastest/elastest-toolbox']]
])
stage "Commit platform submodules"
"Commit platform submodules"
echo ("Commit submodules if is necessary")
withCredentials([usernamePassword(credentialsId: 'GitHub-elastest', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) {
sh ('cd scripts; chmod 755 updateSubmodules.sh; ./updateSubmodules.sh')
}
stage "Platform-Services image build"
"Create platform-services docker image"
echo ("Creating elastest/platform-services image..")
sh 'docker build --build-arg GIT_COMMIT=$(git rev-parse HEAD) --build-arg COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d) --build-arg VERSION=dev -t elastest/platform-services:dev . -f platform-services/Dockerfile'
stage "Publish Platform-Services docker image"
echo ("Publish elastest/platform-services image")
def platformservicesimage = docker.image('elastest/platform-services:dev')
//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"'
platformservicesimage.push()
}
stage "Platform image build"
"Create platform docker image"
echo ("Creating elastest/platform image..")
sh '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) --build-arg VERSION=dev -t elastest/platform:dev .'
stage "IT Test ETM is running"
sh 'cd scripts; chmod 755 it.sh; ./it.sh'
stage "Publish Platform docker image"
echo ("Publish elastest/platform image")
def platformimage = docker.image('elastest/platform:dev')
//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"'
platformimage.push()
}
}
}