-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
58 lines (41 loc) · 1.28 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
node {
def app
environment {
PROJECT_ID = 'emerald-trilogy-313008'
CLUSTER_NAME = 'cluster-1'
LOCATION = 'europe-west6-a'
CREDENTIALS_ID = 'emerald-trilogy-313008'
}
stage('Clone repository') {
checkout scm
}
stage('Build')
{
sh './mvnw package'
}
stage('Build image') {
app = docker.build("mtorne/restservice")
}
stage('Test image') {
app.inside {
sh 'echo "Tests passed"'
}
}
stage('Push image') {
docker.withRegistry('https://registry.hub.docker.com', 'dockerhub') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
stage('Deploy to GKE') {
sh "sed -i 's/restservice:latest/restservice:${env.BUILD_ID}/g' manifest.yaml"
sh 'export PATH=$PATH:/usr/local/bin/'
step([$class: 'KubernetesEngineBuilder',
projectId: 'emerald-trilogy-313008',
clusterName: 'cluster-1',
location: 'europe-west6-a',
manifestPattern: 'manifest.yaml',
credentialsId: 'emerald-trilogy-313008',
verifyDeployments: false])
}
}