The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Kubernetes plugin

containerLog: Get container log from Kubernetes

  • name
    Name of the container, as specified in containerTemplate.
    • Type: String
  • limitBytes (optional)
    If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit.
    • Type: int
  • returnLog (optional)
    Return the container log. If not checked, the log will be printed to the build log.
    • Type: boolean
  • sinceSeconds (optional)
    A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned.
    • Type: int
  • tailingLines (optional)
    If set, the number of lines from the end of the log to show. If not specified, log is shown from the creation of the container or limited by "sinceSeconds".
    • Type: int

container: Run build steps in a container

Selects a container of the agent pod so that all shell steps are executed in that container.
  • name
    • Type: String

podTemplate: Define a podTemplate to use in the kubernetes plugin

Defines a container inside the kubernetes plugin configuration
  • label
    • Type: String
  • name
    The name prefix of the pod.
    • Type: String
  • activeDeadlineSeconds (optional)
    • Type: int
  • annotations (optional)
    Annotations to set on pod metadata
    https://kubernetes.io/docs/user-guide/annotations/
      Array/List
      Nested Object
    • key
      The annotation key.
      • Type: String
    • value
      The annotation value.
      • Type: String
  • cloud (optional)
    • Type: String
  • containers (optional)
      Array/List
      Nested Object
    • name (optional)
      The name for the container to be run. One container is automatically created with name jnlp, and runs the Jenkins JNLP agent service. In order to replace the default JNLP agent, the name of the container with the custom JNLP image must be jnlp.
      • Type: String
    • image (optional)
      Docker image ID for a jenkins JNLP agent. This image is responsible to run a jenkins jnlp bootstrap agent and connect to Jenkins master. Secret key and agent name as well as jenkins callback URL are passed as argument as expected by hudson.remoting.jnlp.Main.
      • Type: String
    • alwaysPullImage (optional)
      • Type: boolean
    • args (optional)
      Arguments to pass to the command. ${computer.jnlpmac} and ${computer.name} are replaced with the agent secret and name respectively.
      • Type: String
    • command (optional)
      Override the image entrypoint with a different one
      • Type: String
    • envVars (optional)
      The environment variables to pass to the container.
        Array/List
        Nested Choice of Objects
      • containerEnvVar
        • key
          The environment variable key.
          • Type: String
        • value
          The environment variable value.
          • Type: String
      • envVar
        • key
          The environment variable key.
          • Type: String
        • value
          The environment variable value.
          • Type: String
      • podEnvVar
        • key
          The environment variable key.
          • Type: String
        • value
          The environment variable value.
          • Type: String
      • secretEnvVar
        • key
          The environment variable key.
          • Type: String
        • secretName
          Name of secret to lookup from Kubernetes.
          • Type: String
        • secretKey
          Key of secret to lookup from Kubernetes.
          • Type: String
    • livenessProbe (optional)
        Nested Object
      • execArgs
        Command executed by the liveness probe.
        • Type: String
      • timeoutSeconds
        • Type: int
      • initialDelaySeconds
        • Type: int
      • failureThreshold
        • Type: int
      • periodSeconds
        • Type: int
      • successThreshold
        • Type: int
    • ports (optional)
        Array/List
        Nested Object
      • name (optional)
        The name of the port
        • Type: String
      • containerPort (optional)
        Port to expose into the pod
        • Type: int
      • hostPort (optional)
        Port to expose onto the host
        • Type: int
    • privileged (optional)
      Flag to mark the container as privileged.
      • Type: boolean
    • resourceLimitCpu (optional)
      Kubernetes Resources Limit of CPU This value can be set to control the CPU resource limit passed when creating the Jenkins agent Docker container in Kubernetes. Unlike a resource request, this is the upper limit of resources used by your Jenkins Agent container. When left blank, the defaults of your Kubernetes cluster will be used. For more info, see the Kubernetes docs. e.g. `500m`.
      • Type: String
    • resourceLimitMemory (optional)
      Kubernetes Resources Limit of Memory This value can be set to control the memory resource limit passed when creating the Jenkins agent Docker container in Kubernetes. Unlike a resource request, this is the upper limit of resources used by your Jenkins Agent container. When left blank, the defaults of your Kubernetes cluster will be used. For more info, see the Kubernetes docs. e.g. `250Mi`.
      • Type: String
    • resourceRequestCpu (optional)
      Kubernetes Resources Request of CPU This value can be set to control the CPU resources requested when creating the Jenkins agent Docker container in Kubernetes. When left blank, the defaults of your Kubernetes cluster will be used. For more info, see the Kubernetes docs. e.g. `500m`.
      • Type: String
    • resourceRequestMemory (optional)
      Kubernetes Resources Request of Memory This value can be set to control the memory resources requested when creating the Jenkins agent Docker container in Kubernetes. When left blank, the defaults of your Kubernetes cluster will be used. For more info, see the Kubernetes docs. e.g. `250Mi`.
      • Type: String
    • ttyEnabled (optional)
      • Type: boolean
    • workingDir (optional)
      Path to the root of the workspace from the view point of this node, such as "/home/jenkins", this need not be absolute provided that the launcher establishes a consistent working directory, such as "./.jenkins-agent".
      • Type: String
  • envVars (optional)
      Array/List
      Nested Choice of Objects
    • containerEnvVar
      • key
        The environment variable key.
        • Type: String
      • value
        The environment variable value.
        • Type: String
    • envVar
      • key
        The environment variable key.
        • Type: String
      • value
        The environment variable value.
        • Type: String
    • podEnvVar
      • key
        The environment variable key.
        • Type: String
      • value
        The environment variable value.
        • Type: String
    • secretEnvVar
      • key
        The environment variable key.
        • Type: String
      • secretName
        Name of secret to lookup from Kubernetes.
        • Type: String
      • secretKey
        Key of secret to lookup from Kubernetes.
        • Type: String
  • idleMinutes (optional)
    Time in minutes to retain agent when idle
    • Type: int
  • imagePullSecrets (optional)
      Array/List
    • Type: String
  • inheritFrom (optional)
    • Type: String
  • instanceCap (optional)
    Max number of containers to start from this template. If set to empty or negative number it means no limit.
    • Type: int
  • namespace (optional)
    • Type: String
  • nodeSelector (optional)
    • Type: String
  • nodeUsageMode (optional)
    • Type: String
  • serviceAccount (optional)
    The service account of the pod.
    • Type: String
  • slaveConnectTimeout (optional)
    • Type: int
  • volumes (optional)
      Array/List
      Nested Choice of Objects
    • configMapVolume
      • mountPath
        Path to mount this volume inside the pod.
        • Type: String
      • configMapName
        The name of the Kubernetes Config Map to mount into the pod.
        • Type: String
    • emptyDirVolume
      • mountPath
        Path to mount this volume inside the pod.
        • Type: String
      • memory
        Flag for in-memory volume.
        • Type: boolean
    • hostPathVolume
      • hostPath
        File or directory on the host node's filesystem to mount into the pod.
        • Type: String
      • mountPath
        Path to mount this volume inside the pod.
        • Type: String
    • nfsVolume
      • serverAddress
        NFS Server Address.
        • Type: String
      • serverPath
        NFS Server Path.
        • Type: String
      • readOnly
        • Type: boolean
      • mountPath
        Path to mount this volume inside the pod.
        • Type: String
    • persistentVolumeClaim
      • mountPath
        Path to mount this volume inside the pod.
        • Type: String
      • claimName
        The claim name.
        • Type: String
      • readOnly
        Flag for read-only volume.
        • Type: boolean
    • secretVolume
      • mountPath
        Path to mount this volume inside the pod.
        • Type: String
      • secretName
        The name of the Kubernetes Secret to mount into the pod.
        • Type: String
  • workingDir (optional)
    • Type: String
  • workspaceVolume (optional)
      Nested Choice of Objects
    • emptyDirWorkspaceVolume
      • memory
        Flag for in-memory volume.
        • Type: boolean
    • hostPathWorkspaceVolume
      • hostPath
        File or directory on the host node's filesystem to mount into the pod.
        • Type: String
    • nfsWorkspaceVolume
      • serverAddress
        NFS Server Address.
        • Type: String
      • serverPath
        NFS Server Path.
        • Type: String
      • readOnly
        • Type: boolean
    • persistentVolumeClaimWorkspaceVolume
      • claimName
        The claim name.
        • Type: String
      • readOnly
        Flag for read-only volume.
        • Type: boolean

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.