Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-64753

Using label feild while declaring Kubernetes agent gives a warning

XMLWordPrintable

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

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

      Is this deprecation intended as specifying label is helpul especially in monitoring.

      The declarative pipeline used is

      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'
                  }
              }
          }
      }
      

            csanchez Carlos Sanchez
            touseef Touseef
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: