-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathk8sSecret-declarative.Jenkinsfile
50 lines (50 loc) · 1.17 KB
/
k8sSecret-declarative.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
pipeline {
agent {
kubernetes {
defaultContainer 'kaniko'
yaml """
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug-v0.19.0
imagePullPolicy: Always
command:
- /busybox/cat
tty: true
volumeMounts:
- name: jenkins-docker-cfg
mountPath: /kaniko/.docker
volumes:
- name: jenkins-docker-cfg
projected:
sources:
- secret:
name: docker-credentials
items:
- key: .dockerconfigjson
path: config.json
"""
}
}
environment {
IMAGE_PUSH_DESTINATION="kyounger/kaniko-jenkins:k8s-secret-declarative"
}
stages {
stage('Build with Kaniko') {
steps {
checkout scm
container(name: 'kaniko', shell: '/busybox/sh') {
withEnv(['PATH+EXTRA=/busybox']) {
sh '''#!/busybox/sh
/kaniko/executor --context `pwd` --destination $IMAGE_PUSH_DESTINATION
'''
}
}
}
}
}
}