Files
Image-Deploy-Arm64/cicd/Jenkinsfile
Sciocatti 88e9eece19
Some checks failed
Home Cluster Builds/Image-Deploy-Arm64/pipeline/head There was a failure building this commit
Escaped backslash in Jenkinsfile.
2023-01-11 23:43:06 +02:00

47 lines
1.2 KiB
Groovy

#!groovy
pipeline {
agent {
kubernetes {
defaultContainer 'jnlp'
yaml """
apiVersion: v1
kind: Pod
metadata:
name: deploy-arm64-image-build
spec:
serviceAccountName: jenkins-admin
nodeSelector:
kubernetes.io/arch: arm64
containers:
- name: kaniko
image: gcr.io/kaniko-project/executor:debug
command: ["tail"]
args: ["-f", "/dev/null"]
volumeMounts:
- name: kaniko-secret
mountPath: /kaniko/.docker
restartPolicy: Never
volumes:
- name: kaniko-secret
secret:
secretName: dockercred
items:
- key: .dockerconfigjson
path: config.json
"""
}
}
stages {
stage('Docker Build and Push') {
steps {
container("kaniko") {
sh 'destinationRegistry=`sed -n \'s/^destinationRegistry=\\(.*\)/\\1/p\' < config.conf`'
sh 'imageName=`sed -n \'s/^imageName=\\(.*\)/\\1/p\' < config.conf`'
sh 'imageTag=`sed -n \'s/^imageTag=\\(.*\)/\\1/p\' < config.conf`'
sh '/kaniko/executor --dockerfile `pwd`/Dockerfile --context `pwd` --destination ${destinationRegistry}/${imageName}:${imageTag}'
}
}
}
}
}