-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
44 lines (37 loc) · 986 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
36
37
38
39
40
41
42
43
44
#!groovy
node {
def git
def commitHash
def buildImage
stage('Checkout') {
git = checkout scm
commitHash = git.GIT_COMMIT
}
stage('Test') {
try{
sh './gradlew check'
} finally {
junit 'build/test-results/**/*.xml'
}
}
stage('Build') {
sh './gradlew build -x test'
}
stage('Build Docker Image') {
buildImage = docker.build("hubtea/spring-cloud-eureka:${commitHash}")
}
stage('Archive') {
parallel (
"Archive Artifacts" : {
archiveArtifacts artifacts: '**/build/libs/*.jar', fingerprint: true
},
"Docker Image Push" : {
buildImage.push("${commitHash}")
buildImage.push("latest")
}
)
}
stage('Kubernetes Deploy') {
sh 'kubectl apply --namespace=development -f deployment.yaml'
}
}