jobs.<job_id>.services is a Preview feature.
|
|
A Preview feature:
Product features and documentation are frequently updated. If you find an issue or have a suggestion, please contact CloudBees Support. |
Use jobs.<job_id>.services to run a service in a separate container alongside the job for the duration of the run, providing functionality such as a database or application server.
Usage example
This example starts a PostgreSQL service, sets credentials with environment variables, and verifies connectivity with a simple SQL query.
jobs.<job_id>.services.<service_id>.args
Use jobs.<job_id>.services.<service_id>.args to set the arguments passed to the ENTRYPOINT of the service container. Follow these args specification guidelines:
-
Enter the
argsparameter as Unicode string. -
Arguments containing spaces must be surrounded by double quotes (
""). -
An escape character
\is supported. Use\for arguments that contain spaces. For example, surround an argument using\"or"\"".
When using CMD in the Dockerfile, use one of the following workflow guidelines:
-
(Recommended) delete any required arguments from
CMD. -
Define appropriate defaults so service runs without specifying arguments.
-
If a
--helpflag, or something similar is available, use that as the default for documentation.
jobs.<job_id>.services.<service_id>.env
Use jobs.<job_id>.services.<service_id>.env to set environment variables for the service.
For example, env defined for a service overrides the job and workflow env variables. For details related to defining env for the entire workflow refer to: jobs.<job_id>.env.
jobs.<job_id>.services.<service_id>.image
Use jobs.<job_id>.services.<service_id>.image to specify an image.
Specify a Docker image
Use jobs.<job_id>.services.<service_id>.image to add a Docker image to a workflow job.
To allow the steps within a job to access the service instances, use localhost or 127.0.0.1 as the host, and the corresponding port for the service.
|