Add instructions for pipeline compute resource configurations

This commit is contained in:
gitlawr
2019-03-08 14:29:28 +08:00
committed by Denise Schannon
parent b6d9201a2f
commit a35d591b0f
@@ -491,6 +491,7 @@ During the process of configuring a pipeline, you can configure advanced options
- [Configuring Environment Variables](#configuring-environment-variables)
- [Configuring Pipeline Secrets](#configuring-pipeline-secrets)
- [Configuring the Executor Quota](#configuring-the-executor-quota)
- [Configuring the Compute Resources](#configuring-the-compute-resources)
### Configuring Pipeline Trigger Rules
@@ -784,3 +785,54 @@ The _executor quota_ decides how many builds can run simultaneously in the proje
1. From the main menu, select **Tools > Pipelines**.
1. From `The maximum number of pipeline executors` increment the **Scale** up or down to change the quota. A value of `0` or less removes the quota limit.
### Configuring the Compute Resources
When a pipeline execution is triggered, a build pod is dynamically provisioned to run your CI tasks. Under the hood, A build pod consists of one Jenkins agent container and one container for each pipeline step. You can [manage compute resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/) for every containers in the pod.
To configure compute resources for Jenkins agent containers:
1. From the context menu, open the project for which you've configured a pipeline.
1. From the main menu, select **Tools > Pipelines**.
1. From `Configure the resource limit and reservation for executors` edit the **Memory Reservation**, **Memory Limit**, **CPU Reservation** or **CPU Limit**, then click **Update Limit and Reservation**.
To configure compute resources for pipeline-step containers:
{{% tabs %}}
{{% tab "By YAML" %}}
You can configure compute resources for pipeline-step containers in the `.rancher-pipeline.yml` file.
Under a `step` section, you will provide the following information:
* CpuRequest: CPU request for the container of a pipeline step.
* CpuLimit: CPU limit for the container of a pipeline step.
* MemoryRequest: Memory request for the container of a pipeline step.
* MemoryLimit: Memory limit for the container of a pipeline step.
```yaml
# example
stages:
- name: Build something
steps:
- runScriptConfig:
image: busybox
shellScript: ls
cpuRequest: 100m
cpuLimit: 1
memoryRequest:100Mi
memoryLimit: 1Gi
- publishImageConfig:
dockerfilePath: ./Dockerfile
buildContext: .
tag: repo/app:v1
cpuRequest: 100m
cpuLimit: 1
memoryRequest:100Mi
memoryLimit: 1Gi
```
>**Note:** Rancher sets default compute resources for pipeline steps except for `Build and Publish Images` and `Run Script` steps. You can override the default value by specifying compute resources in the same way.
{{% /tab %}}
{{% /tabs %}}