-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile-kaniko-test
42 lines (41 loc) · 1.25 KB
/
Jenkinsfile-kaniko-test
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
pipeline {
agent none
//agent {
// kubernetes {
// yamlFile 'Jenkins-maven.yaml'
// workspaceVolume dynamicPVC(storageClassName:'ebs-gp3-sc', accessModes: 'ReadWriteOnce', requestsSize: '10Gi')
// }
//}
stages {
stage('Build with Maven'){
agent {
kubernetes {
yamlFile 'Jenkins-maven.yaml'
workspaceVolume dynamicPVC(storageClassName:'ebs-gp3-sc', accessModes: 'ReadWriteOnce', requestsSize: '10Gi')
}
}
steps {
container('maven') {
sh 'mvn clean package -Dmaven.test.skip=true'
}
container('maven') {
sh 'ls -la'
}
}
}
stage('Build & Push docker image'){
agent {
kubernetes {
yamlFile 'Jenkins-maven.yaml'
workspaceVolume dynamicPVC(storageClassName:'ebs-gp3-sc', accessModes: 'ReadWriteOnce', requestsSize: '10Gi')
}
}
steps{
container('kaniko') {
sh 'pwd & ls'
sh '/kaniko/executor --context `pwd` --dockerfile `pwd`/DockerfileWithoutMaven --destination 899578970796.dkr.ecr.us-west-2.amazonaws.com/java-demo:202310-02-amd64'
}
}
}
}
}