-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
50 lines (49 loc) · 1.22 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
/**
* This pipeline will build and deploy a Docker image with Kaniko
* https://github.com/GoogleContainerTools/kaniko
* without needing a Docker host
*
* You need to create a secret with your registry credentials as described in
* https://github.com/GoogleContainerTools/kaniko#kubernetes-secret
* kubectl create secret generic kaniko-secret --from-file=kaniko-secret.json
*/
pipeline {
agent {
kubernetes {
label 'k8s-kaniko'
yaml """
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug
imagePullPolicy: Always
command: ["cat"]
tty: true
volumeMounts:
- name: kaniko-secret
mountPath: /secret
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /secret/kaniko-secret.json
volumes:
- name: kaniko-secret
secret:
secretName: kaniko-secret
"""
}
}
stages {
stage('Create kaniko job') {
steps {
container(name: 'kaniko', shell: '/busybox/sh'){
sh '''#!/busybox/sh -xe
/kaniko/executor -f `pwd`/Dockerfile -c `pwd` --cache=true --destination=eu.gcr.io/krzysiek-master-project/battleships-api:0.1.5
'''
}
}
}
}
}