-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
57 lines (43 loc) · 1.01 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
pipeline{
agent any
environment{
registry = "gmu645/surveyhw3"
DOCKERHUB_PASS = ""
unique_Id = UUID.randomUUID().toString()
GOOGLE_APPLICATION_CREDENTIALS = 'gsa-key.json'
}
stages{
stage("Building jar"){
steps{
script{
checkout scm
sh 'mvn clean package'
sh 'mvn clean install'
sh 'echo ${BUILD_TIMESTAMP}'
sh 'docker login -u gmu645 --password-stdin < ~/my_password '
def customimage=docker.build("gmu645/surveyrestapi:${BUILD_ID}")
sh 'pwd'
}
}
}
stage("Pushing image to DockerHub"){
steps{
script{
sh 'docker push gmu645/surveyrestapi:${BUILD_ID}'
}
}
}
stage(' Deploying to GKE as single pod'){
steps{
sh ' kubectl set image deployment/swe645final student=gmu645/surveyrestapi:${BUILD_ID}'
}
}
/*
stage(' Deploying to GKE as with Load balancer'){
steps{
sh 'kubectl set image deployment/studentsurvey645-lb studentsurvey645-lb=hekme5/surveyhw3:${BUILD_TIMESTAMP} -n jenkins-pipeline'
}
}
*/
}
}