-
Task
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins version: 2.249.1
kubernetes-plugin version: 1.27.0
I'm trying to reuse the same POD on all build executions but I can't even by setting the option idleMinutes to 1h for example. For each execution, the POD's name and it's labels are always different. Perhaps this is the main cause. I think that I must do something else together with idleMinutes to make it reusable by kubernetes-plugin, but I don't which option should I need to use to achieve that. The documentation isn't clear enough about it.
Here is a snippet: of what I'm doing:
I have a file called cicd-pod.yaml which serves as pod template. Here is it's contents:
apiVersion: v1 kind: Pod metadata: labels: eks.amazonaws.com/fargate-profile: jenkins nodegroup: fargate spec: containers: - name: kubernetes imagePullPolicy: IfNotPresent image: ubuntu:latest resources: requests: cpu: "3" limits: cpu: "4" command: ['cat'] tty: true
Here is the declarative pipeline snipet:
pipeline { agent { kubernetes { slaveConnectTimeout "600" idleMinutes "60" yamlFile "cicd-pod.yaml" } } stages { stage('Prepare POD') { steps { container('kubernetes') { sh 'echo test' } } } } }