48 lines
1.2 KiB
Groovy
48 lines
1.2 KiB
Groovy
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-gitea-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/ant'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|