I am currently working on a build pipeline in OpenShift using the following Configuration
openshift: v3.6.173.0.140
Jenkins: 2.017 (using the redhat images from https://github.com/openshift/jenkins)
Jenkins-Kubernetes plugin 1.12.2
As Jenkins Agents I am using the nodejs agents supplied by the openshift jenkins template and images that build up on them (e.g. one image that I also fittet with a typescript compiler)
Now what I want to do is to run pods with multiple containers (not just the jnlp one but standard node, go etc. containers) Now according to the documentation this should not be a problem (https://github.com/jenkinsci/kubernetes-plugin) as I should just add containers to my podTemplate like
podTemplate(label: mylabel, cloud: 'openshift',
containers: [
containerTemplate(
name: "jnlp",
resourceRequestMemory: "512Mi",
resourceLimitMemory: "2048Mi",
workingDir: "/home/default",
tty: "false",
imagePullPolicy: "Always",
image: 'private-registry:5000/namespace/nodejs-tsc-jnlp-image:latest',
args: '${computer.jnlpmac} ${computer.name}',
),
containerTemplate(
name: 'node',
resourceRequestMemory: '512Mi',
resourceLimitMemory: '2048Mi',
workingDir: '/home/default',
tty: 'true',
imagePullPolicy: 'Always',
image: 'node:alpine',
command: 'cat'
)
]
)
Now the problem is, that this is not working. Pulling the image for the node container just works fine, and if I use echo test for example instead of cat as command test will show in the containers log, but the container will just pass as completed and it will not execute anything that is described in the pipeline. Again this is completely written like stated in the documentation
node(mylabel){
stage('TEST NODE'){
container("node"){
sh("echo test node")
}
container("jnlp"){
sh("echo test jnlp")
}
}
Any idea what I am doing wrong?