#!/usr/bin/env groovy pipeline { agent { kubernetes { label 'build-pod' defaultContainer 'jnlp' yaml """ apiVersion: v1 kind: Pod spec: containers: - name: kaniko image: gcr.io/kaniko-project/executor:debug command: - /busybox/cat tty: true volumeMounts: - name: jenkins-docker-cfg mountPath: /kaniko/.docker resources: requests: memory: "4Gi" cpu: "0.5" limits: memory: "6Gi" cpu: "1.5" imagePullSecrets: - name: artifactory-pull-secret volumes: - name: jenkins-docker-cfg projected: sources: - secret: name: docker-creds-todd items: - key: .dockerconfigjson path: config.json """ } } stages { stage('Parallel Kaniko') { environment { ARTIFACTORY_CREDS = credentials('artifactory-credentials') } failFast true parallel { stage('Container One') { steps { sh "echo ********** Container One **********" container(name: 'kaniko', shell: '/busybox/sh') { withEnv(['PATH+EXTRA=/busybox']) { sh '''#!/busybox/sh /kaniko/executor --context `pwd` --cleanup --dockerfile=first/Dockerfile --destination=artifactory.company.com/repo/image1:tag ''' } } } } stage('Container Two') { steps { sh "echo ********** Container Two **********" container(name: 'kaniko', shell: '/busybox/sh') { withEnv(['PATH+EXTRA=/busybox']) { sh '''#!/busybox/sh /kaniko/executor --context `pwd` --cleanup --dockerfile=second/Dockerfile --destination=artifactory.company.com/repo/image2:tag ''' } } } } } } } // END STAGES } // END PIPELINE