-
Notifications
You must be signed in to change notification settings - Fork 78
/
Copy pathJenkinsfile-k8s-kaniko
55 lines (55 loc) · 1.2 KB
/
Jenkinsfile-k8s-kaniko
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
pipeline {
agent {
kubernetes {
label "kaniko"
yaml """
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug-v0.10.0
imagePullPolicy: Always
command:
- /busybox/cat
tty: true
volumeMounts:
- name: jenkins-docker-cfg
mountPath: /kaniko/.docker
#nodeSelector:
# partition: regular-agents
#tolerations:
# - key: partition
# operator: Equal
# value: regular-agents
# effect: NoSchedule
volumes:
- name: jenkins-docker-cfg
projected:
sources:
- secret:
name: docker-credentials
items:
- key: .dockerconfigjson
path: config.json
"""
}
}
environment {
PATH = "/busybox:/kaniko:$PATH"
}
stages {
stage('Build and push with kaniko') {
steps {
container(name: 'kaniko', shell: '/busybox/sh') {
git 'https://github.com/cb-jeffduska/simple-docker-example.git'
sh """#!/busybox/sh
/kaniko/executor --context `pwd` --destination gcr.io/dpope/hello-kaniko:${env.COMMIT_ID} --cache=true
"""
}
}
}
}
}