-
Bug
-
Resolution: Fixed
-
Major
-
None
Hi
I would like my Pods to be created in the namespace of my choice, and I would like to use several namespaces at the same time (depending on the job).
With this Jenkinsfile, it works as expected :
podTemplate( namespace: 'ci-space-test', label: 'mypod', containers: [ containerTemplate(name: 'jnlp', image: 'jenkins/jnlp-slave:3.10-1-alpine', args: '${computer.jnlpmac} ${computer.name}') ]) { node ('mypod') { container(name: 'jnlp') { sh "cat /var/run/secrets/kubernetes.io/serviceaccount/namespace" } } }
But with this syntax, it does not:
pipeline { agent { kubernetes { label 'unique-pod-name' defaultContainer 'container1' yaml """ apiVersion: v1 kind: Pod metadata: namespace: my-pod-namespace spec: containers: - name: container1 image: centos:7 command: - cat tty: true """ } } stages { stage('Print config') { steps { container('container1') { sh 'echo "in container container1"' sh 'env | sort' } } } } }
What am I missing?
- links to