I have installed Kubernetes plugin - 1.23.3
in our Jenkins and able to execute shell commands on kubernetes pod(Dynamic Jenkins Slave). this is working with default jnlp & jenkins/jnlp-slave:latest
Suppose if I change the below "Name" & "Docker Image" section to use our private registry & image under
Manage Jenkins --> Configure System--> Cloud --> Pod Template --> Container Template
Name: sonatype
Docker image:sonatype:4546/ubuntu-16.04
It doesn’t uses our private docker image and even doesn't run the shell commands on the pod-containers. The idea is to perform build + static analysis
using our own docker image on Kubernetes cluster pods as dynamic Jenkins Build Agents.
How to use our private docker registry images and execute them as Jenkins slave in kubernetes cluster? i have below scripted pipeline code. Stage-1 "SCM Code checkout" to K8S work-node is working, next 2nd stage build it is launching pod agent from template Kubernetes Pod Template
. but if fails with docker: not found
. it seems trying to pull our registry image in pod. From our worker-node system's code need to be mounted in dynamic Jenkins slave pods and perform the build and next stages. Any direction to achieve would be helpful.
node ("kubupods") {
stage('Code Compile') {
sh 'hostname'
}
stage('Code Analysis') {
sh 'hostname'
}
}