jenkins k8s plugin nested pod in declarative syntax

9/22/2019

I have the below pipeline that I want to convert to declarative syntax.

 podTemplate(
       cloud: "OCP_CLUSTER", 
       name: "CENTRAL_POD", 
       label: "CENTRAL_POD",
       namespace: "CENTRAL_NS", 
       inheritFrom: "my_pod_image") 
   {
          podTemplate(
                cloud: "OCP_CLUSTER", 
                name: "INTERNAL_POD", 
                label: "INTERNAL_PROD", 
                namespace: "MS_NS", 
                inheritFrom: "my_pod_image") 
             {
                   node("CENTRAL_POD") {
                       stage('Project Setup') {
                            create_k8s_ns('CREATE', "MS_NS")
                       }

                       node("INTERNAL_PROD") {
                           stage('Clone sources') {
                               echo "..."
                           }
                       }
                    }
               }
     }

I checked the below link, but didn't find solution for it. https://github.com/jenkinsci/kubernetes-plugin#nesting-pod-templates

Does the declarative syntax support the same option?

-- Shurik
jenkins
jenkins-declarative-pipeline
jenkins-pipeline
jenkins-plugins
kubernetes-jenkins-plugin

0 Answers