the fix works as advertised. i dont see the original issue anymore. however, a couple of observations - please validate: 1. now each container step is required to declare which cloud it needs to be launched in. would be great to have this inherit this info from the pod template, but seems like the design challenge is each pod templates can be inherited and each pod template can bind to a cloud, we cant derive the intent clean. 2. if the containerstep fails to declare the cloud, that results in a null pointer exception, we may need to handle it in a clean way. test snippet below for reference (modified slightly from the original for build time): Note: 1. that my jenkins instance runs from docker swarm , where as the slave workloads are scheduled on minikube 2. built with latest from master (0.10-SNAPSHOT)
podTemplate(
cloud: 'minikube',
label: 'docker',
containers: [
//containerTemplate(name: 'jnlp', image: 'jenkinsci/jnlp-slave:2.62-alpine', args: '${computer.jnlpmac} ${computer.name}'),
containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine', ttyEnabled: true, command: 'cat'),
containerTemplate(name: 'golang', image: 'golang:1.6.3-alpine', ttyEnabled: true, command: 'cat')
],
volumes: [secretVolume(secretName: 'shared-secret', mountPath: '/etc/shared-secrets')],
) {
node ('docker') {
stage 'Get a Maven project'
git 'https://github.com/pgrimard/spring-boot-hello-world.git'
container(name:'maven', cloud:'minikube') {
stage 'Build a Maven project'
try {
sh 'mvn clean install'
}catch (Exception ex) {
ex.printStackTrace()
}
}
stage 'Get a Golang project'
git url: 'https://github.com/golang/example.git'
container(name:'golang', cloud:'minikube') {
stage 'Build a Go project'
sh """
mkdir -p /go/src/github.com/golang/
ln -s `pwd` /go/src/github.com/golang/example
export GOPATH=/go
cd /go/src/github.com/golang/example/hello && go build
"""
}
}
}
|