From e750285629671ef9a52a187cc5a273eb4737dd83 Mon Sep 17 00:00:00 2001 From: victorc Date: Sun, 22 Sep 2024 07:16:25 +0000 Subject: [PATCH] Add Jenkinsfile --- Jenkinsfile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..57101e4 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,47 @@ +pipeline { + agent { + kubernetes { + workspaceVolume persistentVolumeClaimWorkspaceVolume(claimName: 'jenkins-agents-pvc', readOnly: false) + yaml """ +apiVersion: v1 +kind: Pod +spec: + containers: + - name: jnlp + image: jenkins/inbound-agent:latest + volumeMounts: + - name: workspace-volume + mountPath: /home/jenkins/agent + - name: kaniko + image: gcr.io/kaniko-project/executor:debug + imagePullPolicy: Always + command: + - sleep + args: + - 1d + volumeMounts: + - name: kaniko-secret + mountPath: /kaniko/.docker/config.json + subPath: .dockerconfigjson + - name: workspace-volume + mountPath: /home/jenkins/agent + volumes: + - name: kaniko-secret + secret: + secretName: build-kubix-harbor-registry-credentials + - name: workspace-volume + persistentVolumeClaim: + claimName: jenkins-agents-pvc +""" + } + } + stages { + stage('Build and Push Image with Kaniko') { + steps { + container('kaniko') { + sh '/kaniko/executor --dockerfile=./Dockerfile --context=dir://. --destination=gitea.kubix.siatel.ro/siatel/subversion' + } + } + } + } +}