-
Notifications
You must be signed in to change notification settings - Fork 179
/
Jenkinsfile1
37 lines (34 loc) · 1.13 KB
/
Jenkinsfile1
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
pipeline {
agent any
stages{
stage('Build Maven'){
steps{
git url:'https://github.com/akshu20791/Banking-java-project/', branch: "master"
sh 'mvn clean install'
}
}
stage('Build docker image'){
steps{
script{
sh 'docker build -t akshu20791/endtoendproject31july:v1 .'
}
}
}
stage('Docker login') {
steps {
withCredentials([usernamePassword(credentialsId: 'dockerhub-pwd', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh "echo $PASS | docker login -u $USER --password-stdin"
sh 'docker push akshu20791/endtoendproject31july:v1'
}
}
}
stage('Deploy to k8s'){
when{ expression {env.GIT_BRANCH == 'master'}}
steps{
script{
kubernetesDeploy (configs: 'deploymentservice.yaml' ,kubeconfigId: 'k8sconfigpwd')
}
}
}
}
}