49 lines
1.2 KiB
Groovy
49 lines
1.2 KiB
Groovy
pipeline {
|
|
agent {
|
|
kubernetes {
|
|
yaml '''
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
labels:
|
|
some-label: some-label-value
|
|
spec:
|
|
containers:
|
|
- name: kaniko
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
command: ["/busybox/cat"]
|
|
tty: true
|
|
volumeMounts:
|
|
- name: jenkins-docker-cfg
|
|
mountPath: /kaniko/.docker
|
|
volumes:
|
|
- name: jenkins-docker-cfg
|
|
projected:
|
|
sources:
|
|
- secret:
|
|
name: registry-credentials
|
|
items:
|
|
- key: .dockerconfigjson
|
|
path: config.json
|
|
'''
|
|
retries 2
|
|
}
|
|
}
|
|
stages {
|
|
stage('Run kaniko') {
|
|
environment {
|
|
PATH = "/busybox:$PATH"
|
|
}
|
|
steps {
|
|
container(name: 'kaniko', shell: '/busybox/sh') {
|
|
ansiColor('xterm') {
|
|
sh '''#!/busybox/sh
|
|
cat /kaniko/.docker/*
|
|
/kaniko/executor --dockerfile="Dockerfile" --context=`pwd` --destination=harbor.hnrx.net/homelab/my-jenkins-casc:test-build-${env.BUILD_ID}
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |