How to reuse pod across job executions without the deprecated "label" option

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      We used to have jobs defined like follow to reuse pods across job executions:

      pipeline {
        agent {
          kubernetes {
            cloud 'kubernetes'
            idleMinutes 10
            label "testjob"
            defaultContainer 'fedora'
            yaml '''
              spec:
                containers:
                - name: fedora
                  image: 'registry.fedoraproject.org/fedora-minimal:latest'
                  command: [ 'sleep', 'infinity' ]
            '''
          }
        }
      
        stages {
          stage("Run Test") {
            steps {
              sh 'echo yes'
            }
          }
        }
      }
      

      With both "idleMinutes" and "label" are present, the job can be executed in the same pod without booting up a new pod, the reason for us to execute the job on same pod is our job can be triggered very frequently, booting up a new pod for each build can be time and resource consuming and almost unacceptable for us.

      Now I see there is a message says:

      [WARNING] label option is deprecated. To use a static pod template, use the 'inheritFrom' option.

      However I don't find a solution to achieve the same goal without the "label" option, could someone help on how I can do that without the "label" option? Or may I request not decommission the "label" option in the kubernetes plugin?

            Assignee:
            Unassigned
            Reporter:
            vgl
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: