From bfcac57759e284101fc1d64e9614a69ca08c1f88 Mon Sep 17 00:00:00 2001 From: matthias Date: Mon, 10 Mar 2025 23:56:25 +0000 Subject: [PATCH] Jenkinsfile aktualisiert --- Jenkinsfile | 65 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fd8f596..3fbd7f3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,20 +1,59 @@ pipeline { + agent { + kubernetes { + label 'kaniko' + yaml """ +kind: Pod +metadata: + name: kaniko +spec: + containers: + - name: golang + image: golang:1.12 + command: + - cat + tty: true + - name: kaniko + image: gcr.io/kaniko-project/executor:debug + imagePullPolicy: Always + 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 +""" + } + } stages { - stage('Buildo Roboto') { - agent { - kubernetes { - defaultContainer 'kaniko' - yamlFile 'kaniko.yaml' - } + stage('Checkout') { + + } + + stage('Make Image') { + environment { + PATH = "/busybox:$PATH" + REGISTRY = 'harbor.hnrx.net' // Configure your own registry + REPOSITORY = 'homelab/jenkins-casc' + IMAGE = 'cat' } steps { - /* - * Since we're in a different pod than the rest of the - * stages, we'll need to grab our source tree since we don't - * have a shared workspace with the other pod(s).. - */ - checkout scm - sh 'sh -c ./scripts/build-kaniko.sh' + container(name: 'kaniko', shell: '/busybox/sh') { + ansiColor('xterm') { + sh '''#!/busybox/sh + /kaniko/executor -f `pwd`/Dockerfile.run -c `pwd` --cache=true --destination=${REGISTRY}/${REPOSITORY}/${IMAGE} + ''' + } + } } } }