-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
70 lines (63 loc) · 1.55 KB
/
Jenkinsfile
File metadata and controls
70 lines (63 loc) · 1.55 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
// Jenkins File for integrating all the components of CI/CD pipeline
// # Swathi Guptha - G01393328
// # Rajas Bipinchandra patil - G01393353
// # Poorvi Lakkadi - G01389351
/* groovylint-disable-next-line CompileStatic */
@NonCPS
def generateTag() {
return "build-" + new Date().format("yyyyMMdd-HHmmss")
}
pipeline{
environment
{
registry = "rbptl/student-survey-backend"
registryCredential = "docker-login"
}
agent any
tools
{
maven 'Maven'
}
stages
{
stage('BUILD')
{
steps
{
script
{
sh 'whoami'
sh 'rm -rf *.jar'
sh 'mvn clean package'
sh 'echo ${BUILD_TIMESTAMP}'
tag = generateTag()
image = docker.build("rbptl/student-survey-backend:latest")
}
}
}
stage('DEPLOY_DOCKER')
{
steps
{
script
{
docker.withRegistry('',registryCredential)
{
image.push()
}
}
}
}
stage('DEPLOY_KUBERNETES')
{
steps
{
script
{
sh 'pwd'
sh 'kubectl --kubeconfig=/home/ubuntu/.kube/config set image deployment/swe645-hw3 hw3=rbptl/student-survey-backend:latest'
}
}
}
}
}