How can I disable agent caching for the kubernetes Jenkins plugin?

4/3/2019

I am using the kubernetes plugin with Jenkins to automate my builds and am using the BUILD_NUMBER in my pipeline definition:

def TEST = "${env.BUILD_NUMBER.toInteger() % 5}"
pipeline {
  agent {
    kubernetes {
      label 'kind'
      defaultContainer 'jnlp'
      yaml """
apiVersion: v1
kind: Pod
metadata:
  labels:
    name: "$TEST"
spec:
...

however Jenkins seems to be caching the value of TEST templated into the agent YAML. I'm getting name: 3 for multiple builds in a row for example.

Is it possible to disable this caching?

-- dippynark
jenkins
kubernetes

0 Answers