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.
withEphemeralContainer
: Define an Ephemeral Container to add to the current Podimage : String
Container image reference for the container. The image must have a shell available (i.e. `sh`).
If the image defines an entrypoint it must be able to accept and execute a command and arguments. Jenkins must be able to stop the container and to do so it passes a process monitor command to know when to exit the container. If the image entrypoint to not perform the monitor task the ephemeral container may not work correctly.
Configure an empty command
list to disable the entrypoint.
Note: Windows containers are not supported.
alwaysPullImage : boolean
(optional)
command : Array / List of String
(optional)
commandLine : String
(optional)
Override the image entrypoint.
If an empty array, disable the default image entrypoint with the Jenkins monitor command.
If a non-empty command is provided, it must be able to accept a monitor command and arguments which must be executed. If entrypoint ignores the Jenkins provided monitor command the step may either exit early or failed to be terminated.
sh '''#!/bin/bash
# do some custom entrypoint stuff
# execute monitor command provided by jenkins
exec "$@"
'''
envVars
(optional)
containerEnvVar
key : String
value : String
envVar
key : String
value : String
podEnvVar
key : String
value : String
secretEnvVar
key : String
secretName : String
secretKey : String
optional : boolean
runAsGroup : String
(optional)
Specify the gid to run as. Defaults to the jnlp container group.
Must be a number, greater or equal to 0
If not set it will be inherited from agent current context. For example, if a nested withEphemeralContainer
step, it will inherit from its parent.
runAsUser : String
(optional)
Specify the uid to run as. Defaults to the jnlp container user.
Must be a number, greater or equal to 0
.
If not set it will be inherited from agent current context. For example, if a nested withEphemeralContainer
step, it will inherit from its parent.
shell : String
(optional)
Specifies a shell which will run inside the container and process requests from Jenkins to run executables, set environment variables, and similar infrastructure.
This does not affect the shell used to run user code, such as sh
steps. To run your scripts with a specific shell on Linux, use an interpreter line:
sh '''#!/bin/bash
for x in {0..9}; do echo x; done
'''
or just use a subprocess and an externally versioned script:
sh 'bash ci.sh'
For a pod running on Linux, defaults to sh
, which should be in $PATH
. Should not generally be overridden.
targetContainer : String
(optional)
ephemeralContainer
: Define an Ephemeral Container to add to the current Podimage : String
Container image reference for the container. The image must have a shell available (i.e. `sh`).
If the image defines an entrypoint it must be able to accept and execute a command and arguments. Jenkins must be able to stop the container and to do so it passes a process monitor command to know when to exit the container. If the image entrypoint to not perform the monitor task the ephemeral container may not work correctly.
Configure an empty command
list to disable the entrypoint.
Note: Windows containers are not supported.
alwaysPullImage : boolean
(optional)
command : Array / List of String
(optional)
commandLine : String
(optional)
Override the image entrypoint.
If an empty array, disable the default image entrypoint with the Jenkins monitor command.
If a non-empty command is provided, it must be able to accept a monitor command and arguments which must be executed. If entrypoint ignores the Jenkins provided monitor command the step may either exit early or failed to be terminated.
sh '''#!/bin/bash
# do some custom entrypoint stuff
# execute monitor command provided by jenkins
exec "$@"
'''
envVars
(optional)
containerEnvVar
key : String
value : String
envVar
key : String
value : String
podEnvVar
key : String
value : String
secretEnvVar
key : String
secretName : String
secretKey : String
optional : boolean
runAsGroup : String
(optional)
Specify the gid to run as. Defaults to the jnlp container group.
Must be a number, greater or equal to 0
If not set it will be inherited from agent current context. For example, if a nested withEphemeralContainer
step, it will inherit from its parent.
runAsUser : String
(optional)
Specify the uid to run as. Defaults to the jnlp container user.
Must be a number, greater or equal to 0
.
If not set it will be inherited from agent current context. For example, if a nested withEphemeralContainer
step, it will inherit from its parent.
shell : String
(optional)
Specifies a shell which will run inside the container and process requests from Jenkins to run executables, set environment variables, and similar infrastructure.
This does not affect the shell used to run user code, such as sh
steps. To run your scripts with a specific shell on Linux, use an interpreter line:
sh '''#!/bin/bash
for x in {0..9}; do echo x; done
'''
or just use a subprocess and an externally versioned script:
sh 'bash ci.sh'
For a pod running on Linux, defaults to sh
, which should be in $PATH
. Should not generally be overridden.
targetContainer : String
(optional)
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.