-
Notifications
You must be signed in to change notification settings - Fork 41
/
Jenkinsfile-K8S
35 lines (29 loc) · 1.17 KB
/
Jenkinsfile-K8S
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
node {
def mvnHome = tool 'Maven3'
stage ('Checkout') {
checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'e2f1b466-b418-42ac-84a8-b6d6a5857928', url: 'https://bitbucket.org/ananthkannan/myawesomeangularapprepo']]])
}
stage ('build') {
sh "${mvnHome}/bin/mvn package -f MyAwesomeApp/pom.xml"
}
stage ('Docker Build') {
// Build and push image with Jenkins' docker-plugin
withDockerServer([uri: "tcp://localhost:4243"]) {
withDockerRegistry([credentialsId: "dockerhub", url: "https://index.docker.io/v1/"]) {
image = docker.build("ananthkannan/myspringbootapp", "MyAwesomeApp")
image.push()
}
}
}
stage ('Kubernetes Deploy') {
kubernetesDeploy(
configs: 'MyAwesomeApp/springBootDeploy.yml',
kubeconfigId: 'K8S',
enableConfigSubstitution: true
)
}
/*
stage ('Kubernetes Deploy using Kubectl') {
sh "kubectl apply -f MyAwesomeApp/springBootDeploy.yml"
}*/
}