Using label field while declaring Kubernetes agent gives a deprecation warning even when using yaml format

503 views
Skip to first unread message

touseef

unread,
Feb 26, 2021, 12:23:52 AM2/26/21
to Jenkins Users
 [WARNING] label option is deprecated. To use a static pod template, use the 'inheritFrom' option.
 Is there a workaround or different way to specify the agent labels

Below is the pipeline script 
```
pipeline { 
 agent {  
 kubernetes {
 label 'sample-label' 
 yaml '''
    apiVersion: v1 
    kind: Pod
    spec: 
      containers:
        - name: shell
          image: ubuntu 
          command: 
             - sleep 
           args: 
             - infinity
 ''' 
       } 
 } 
 stages { 
 stage('Main') {
 steps {
 sh 'hostname' 
 }
 }  } }



    ```
    test.png
    Reply all
    Reply to author
    Forward
    0 new messages