-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
35 lines (35 loc) · 834 Bytes
/
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
pipeline {
agent any
environment {
DOCKER_PWD = 'swe645_homework'
DOCKER_TAG = 'v4'
}
stages {
stage("Building web app image"){
steps {
script {
checkout scm
sh 'mvn clean package'
sh 'echo ${DOCKER_PWD}'
sh 'echo ${DOCKER_TAG}'
sh "docker login -u jinal0217 -p ${DOCKER_PWD}"
sh "docker build . -t jinal0217/hw4_rest_kafka:${DOCKER_TAG}"
}
}
}
stage("Pushing image to dockerhub"){
steps {
script {
sh 'docker push jinal0217/hw4_rest_kafka:${DOCKER_TAG}'
}
}
}
stage("Deploying and executing service on K8"){
steps {
sh 'sed "s/tagVersion/${DOCKER_TAG}/g" deployment.yaml > deployment-app.yaml'
sh 'kubectl apply -f deployment-app.yaml'
sh 'kubectl apply -f service.yaml'
}
}
}
}