-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
61 lines (54 loc) · 1.77 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
60
61
pipeline {
agent any
stages {
stage('Checkout Source') {
steps {
git url:'https://github.com/GodaProjects/ci-testing-spring-boot.git', branch:'master'
}
}
stage('Build App') {
steps {
// retaining it see some debug info
sh "ls -ltr"
sh "pwd"
// This is the one which allowed me to run the ./mvnw
sh "chmod 755 *"
//Build the project
sh "./mvnw clean install -DskipTests"
}
}
stage('Test App') {
steps {
sh "./mvnw test"
}
}
stage('Build Image for App') {
steps {
script {
withCredentials([usernamePassword(credentialsId: 'godaprojects-dockercreds', passwordVariable: 'password', usernameVariable: 'username')]) {
sh "./mvnw compile jib:dockerBuild -Djib.to.auth.username=$username -Djib.to.auth.password=$password"
}
}
}
}
// Not needed anymore since Jib takes care of both creating and uploading the image.
/*stage('Upload the image to docker hub') {
steps {
withCredentials([usernamePassword(credentialsId: 'godaprojects-dockercreds', passwordVariable: 'password', usernameVariable: 'user')]) {
// the code in here can access $password and $user
sh "docker login -u $user -p $password"
}
sh "./mvnw exec:exec"
}
}*/
stage('Kubernates Deploy App') {
agent { label 'goda-kube-label' }
steps {
git url:'https://github.com/GodaProjects/ci-testing-spring-boot.git', branch:'master'
script {
kubernetesDeploy(configs: "goda-app.yaml", kubeconfigId: "goda-k8s-config")
}
}
}
}
}