This commit is contained in:
Vendored
+19
-40
@@ -1,57 +1,36 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
kubernetes {
|
kubernetes {
|
||||||
label 'kaniko'
|
yaml '''
|
||||||
yaml """
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: kaniko
|
labels:
|
||||||
spec:
|
some-label: some-label-value
|
||||||
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: golang
|
- name: maven
|
||||||
image: golang:1.12
|
image: maven:3.9.9-eclipse-temurin-17
|
||||||
command:
|
command:
|
||||||
- cat
|
- cat
|
||||||
tty: true
|
tty: true
|
||||||
- name: kaniko
|
- name: busybox
|
||||||
image: gcr.io/kaniko-project/executor:debug
|
image: busybox
|
||||||
imagePullPolicy: Always
|
|
||||||
command:
|
command:
|
||||||
- /busybox/cat
|
- cat
|
||||||
tty: true
|
tty: true
|
||||||
volumeMounts:
|
'''
|
||||||
- name: jenkins-docker-cfg
|
retries 2
|
||||||
mountPath: /kaniko/.docker
|
|
||||||
volumes:
|
|
||||||
- name: jenkins-docker-cfg
|
|
||||||
projected:
|
|
||||||
sources:
|
|
||||||
- secret:
|
|
||||||
name: registry-credentials
|
|
||||||
items:
|
|
||||||
- key: .dockerconfigjson
|
|
||||||
path: config.json
|
|
||||||
"""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
|
stage('Run maven') {
|
||||||
stage('Make Image') {
|
|
||||||
environment {
|
|
||||||
PATH = "/busybox:$PATH"
|
|
||||||
REGISTRY = 'harbor.hnrx.net' // Configure your own registry
|
|
||||||
REPOSITORY = 'homelab/jenkins-casc'
|
|
||||||
IMAGE = 'cat'
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
container(name: 'kaniko', shell: '/busybox/sh') {
|
container('maven') {
|
||||||
ansiColor('xterm') {
|
sh 'mvn -version'
|
||||||
sh '''#!/busybox/sh
|
|
||||||
ls
|
|
||||||
pwd
|
|
||||||
/kaniko/executor -f ./Dockerfile --cache=true --no-push}
|
|
||||||
'''
|
|
||||||
}
|
}
|
||||||
|
container('busybox') {
|
||||||
|
sh '/bin/busybox'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user