This commit is contained in:
Vendored
+33
-54
@@ -1,59 +1,38 @@
|
||||
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
|
||||
"""
|
||||
}
|
||||
agent {
|
||||
kubernetes {
|
||||
yaml '''
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
labels:
|
||||
some-label: some-label-value
|
||||
spec:
|
||||
containers:
|
||||
- name: maven
|
||||
image: maven:3.9.9-eclipse-temurin-17
|
||||
command:
|
||||
- cat
|
||||
tty: true
|
||||
- name: busybox
|
||||
image: busybox
|
||||
command:
|
||||
- cat
|
||||
tty: true
|
||||
'''
|
||||
retries 2
|
||||
}
|
||||
stages {
|
||||
|
||||
stage('Make Image') {
|
||||
environment {
|
||||
PATH = "/busybox:$PATH"
|
||||
REGISTRY = 'harbor.hnrx.net' // Configure your own registry
|
||||
REPOSITORY = 'homelab/jenkins-casc'
|
||||
IMAGE = 'cat'
|
||||
}
|
||||
steps {
|
||||
container(name: 'kaniko', shell: '/busybox/sh') {
|
||||
ansiColor('xterm') {
|
||||
sh '''#!/busybox/sh
|
||||
ls
|
||||
pwd
|
||||
/kaniko/executor -f ./Dockerfile --cache=true --no-push}
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Run maven') {
|
||||
steps {
|
||||
container('maven') {
|
||||
sh 'mvn -version'
|
||||
}
|
||||
container('busybox') {
|
||||
sh '/bin/busybox'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user