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

Missing DeclarativePipeline podTemplate parameters

      The issue is that the DeclarativePipeline support on kubernetes-plugin is:

      1. Not complete - some options are missing
      2. Not aligned with Documentation - by reading docs, I assume I can use all options in declarativePipeline

      Example: I'm trying to introduce `slaveConnectTimeout` in my pipeline, because 100 is ridiculously small if you want to pre-warm caches or so. Here is what I get

       

      WorkflowScript: 8: Invalid config option "slaveConnectTimeout" for agent type "kubernetes". Valid config options are [activeDeadlineSeconds, cloud, containerTemplate, containerTemplates, defaultContainer, idleMinutes, inheritFrom, instanceCap, label, nodeSelector, serviceAccount, workingDir, yaml, yamlFile] @ line 8, column 13.
                     slaveConnectTimeout 1800
      

      What's actually missing here:

      • slaveConnectTimeout Timeout in seconds for an agent to be online.
      • name The name of the pod.
      • namespace The namespace of the pod.
      • nodeUsageMode Either 'NORMAL' or 'EXCLUSIVE', this controls whether Jenkins only schedules jobs with label expressions matching or use the node as much as possible.
      • volumes Volumes that are defined for the pod and are mounted by ALL containers.
      • envVars Environment variables that are applied to ALL containers.
        • envVar An environment variable whose value is defined inline.
        • secretEnvVar An environment variable whose value is derived from a Kubernetes secret.
      • imagePullSecrets List of pull secret names
      • annotations Annotations to apply to the pod.

      Assuming that `volumes`, `envVars`, `imagePullSecrets` and `annotations` by design have a structure which is hard to read and `name` which looks quite useless here - I'd suggest to add `slaveConnectTimeout`, `namespace` and `nodeUsageMode` to Declarative Pipeline class.

      Gonna try to do this by myself, will create the branch/PR

       

          [JENKINS-55960] Missing DeclarativePipeline podTemplate parameters

          The goal was to move to yaml as much as possible but I guess it's ok to add it for now

          Carlos Sanchez added a comment - The goal was to move to yaml as much as possible but I guess it's ok to add it for now

          Tavin Cole added a comment -

          annotations would be very nice to have, e.g.:

          yamlFile 'pod.yaml'
          annotations [
            podAnnotation(key: 'iam.amazonaws.com/role', value: params.IAMRole)
          ]
          

          Tavin Cole added a comment - annotations would be very nice to have, e.g.: yamlFile 'pod.yaml' annotations [ podAnnotation(key: 'iam.amazonaws.com/role' , value: params.IAMRole) ]

            cazorla19 Mikhail Chinkov
            cazorla19 Mikhail Chinkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: