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
        '''
      retries 2
    }
  }
  stages {
    stage('Run kaniko') {
      steps {
        container(name: 'kaniko', shell: '/busybox/sh') {
          ansiColor('xterm') {
            sh '''#!/busybox/sh
            /kaniko/executor --dockerfile="Dockerfile" --context=`pwd` --no-push
            '''
          }
        }
      }
    }
  }
}