-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
59 lines (53 loc) · 1.67 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
pipeline{
agent any
tools {
maven 'Maven3'
}
stages{
stage('checkout'){
steps{
deleteDir()
checkout scm
}
}
stage('run unit test'){
steps{
sh "mvn clean install -Dmaven.test.skip=false"
}
}
stage('build dockerfile and push to ecr'){
steps{
script{
docker.build('tours')
docker.withRegistry('https://828370275182.dkr.ecr.us-west-2.amazonaws.com', 'ecr:us-west-2:828370275182') {
docker.image('tours').push('2.0')
}
}
}
}
stage('deploy database'){
steps{
withAWS(region:'us-west-2',credentials:'828370275182') {
sh "aws eks --region us-west-2 update-kubeconfig --name eks-cluster"
sh "kubectl apply -f ./aws/aws-auth-cm.yaml"
sh "kubectl apply -f ./k8s-deployments/tours-web-and-db-cm.yaml"
sh "kubectl apply -f ./k8s-deployments/tours-db-deployment.yml"
}
}
}
stage('deploy front app'){
steps{
withAWS(region:'us-west-2',credentials:'828370275182') {
sh "kubectl apply -f ./k8s-deployments/tours-app-deployment.yml"
sh "kubectl get no -o wide"
sh "kubectl get all -o wide"
}
}
}
}
post{
success{
echo "====++++Successfully deployed++++===="
}
}
}