Add runners.cache section
This commit is contained in:
parent
801f6ac429
commit
e992471026
|
@ -111,78 +111,96 @@ check_interval = 0
|
|||
|
||||
Let's break it down to pieces.
|
||||
|
||||
- Global section
|
||||
### Global section
|
||||
|
||||
```toml
|
||||
concurrent = 3
|
||||
check_interval = 0
|
||||
```
|
||||
```toml
|
||||
concurrent = 3
|
||||
check_interval = 0
|
||||
```
|
||||
|
||||
- `[[runners]]`
|
||||
### `[[runners]]`
|
||||
|
||||
```toml
|
||||
[[runners]]
|
||||
name = "gitlab-aws-autoscaler"
|
||||
url = "<url to your GitLab CI host>"
|
||||
token = "<registration token>"
|
||||
executor = "docker+machine"
|
||||
limit = 4
|
||||
```
|
||||
```toml
|
||||
[[runners]]
|
||||
name = "gitlab-aws-autoscaler"
|
||||
url = "<url to your GitLab CI host>"
|
||||
token = "<registration token>"
|
||||
executor = "docker+machine"
|
||||
limit = 4
|
||||
```
|
||||
|
||||
- `[runners.docker]`
|
||||
### `[runners.docker]`
|
||||
|
||||
```toml
|
||||
[runners.docker]
|
||||
image = "alpine"
|
||||
privileged = true
|
||||
disable_cache = false
|
||||
volumes = ["/cache"]
|
||||
```
|
||||
```toml
|
||||
[runners.docker]
|
||||
image = "alpine"
|
||||
privileged = true
|
||||
disable_cache = false
|
||||
volumes = ["/cache"]
|
||||
```
|
||||
|
||||
- `[runners.cache]`
|
||||
### `[runners.cache]`
|
||||
|
||||
```toml
|
||||
[runners.cache]
|
||||
Type = "s3"
|
||||
ServerAddress = "s3.amazonaws.com"
|
||||
AccessKey = "<your AWS Access Key ID>"
|
||||
SecretKey = "<your AWS Secret Access Key>"
|
||||
BucketName = "<the bucket where your cache should be kept>"
|
||||
BucketLocation = "us-east-1"
|
||||
Shared = true
|
||||
```
|
||||
To speed up your jobs, GitLab Runner provides a cache mechanism where selected
|
||||
directories and/or files are saved and shared between subsequent jobs.
|
||||
While not required for this setup, it is recommended to use the shared cache
|
||||
mechanism that GitLab Runner provides. Since new instances will be created on
|
||||
demand, it is essential to have a common place where cache is stored.
|
||||
|
||||
- `[runners.machine]`
|
||||
In the following example, we use Amazon S3:
|
||||
|
||||
```toml
|
||||
[runners.machine]
|
||||
IdleCount = 1
|
||||
IdleTime = 1800
|
||||
MaxBuilds = 100
|
||||
MachineDriver = "amazonec2"
|
||||
MachineName = "gitlab-docker-machine-%s"
|
||||
OffPeakPeriods = ["* * 0-7,19-23 * * mon-fri *", "* * * * * sat,sun *"]
|
||||
OffPeakIdleCount = 0
|
||||
OffPeakIdleTime = 1200
|
||||
MachineOptions = [
|
||||
"amazonec2-access-key=XXXX",
|
||||
"amazonec2-secret-key=XXXX",
|
||||
"amazonec2-region=us-east-1",
|
||||
"amazonec2-vpc-id=vpc-xxxxx",
|
||||
"amazonec2-subnet-id=subnet-xxxxx",
|
||||
"amazonec2-use-private-address=true",
|
||||
"amazonec2-tags=Name,gitlab-runner-autoscale",
|
||||
"amazonec2-security-group=docker-machine-scaler",
|
||||
"amazonec2-instance-type=m4.2xlarge",
|
||||
"amazonec2-ssh-user=ubuntu",
|
||||
"amazonec2-ssh-keypath=/etc/gitlab-runner/certs/gitlab-aws-autoscaler",
|
||||
"amazonec2-zone=a",
|
||||
"amazonec2-root-size=32",
|
||||
]
|
||||
```
|
||||
```toml
|
||||
[runners.cache]
|
||||
Type = "s3"
|
||||
ServerAddress = "s3.amazonaws.com"
|
||||
AccessKey = "<your AWS Access Key ID>"
|
||||
SecretKey = "<your AWS Secret Access Key>"
|
||||
BucketName = "<the bucket where your cache should be kept>"
|
||||
BucketLocation = "us-east-1"
|
||||
Shared = true
|
||||
```
|
||||
|
||||
Under `MachineOptions` you can add anything that the [AWS Docker Machine driver
|
||||
supports](https://docs.docker.com/machine/drivers/aws/#options).
|
||||
Here's some more info to get you started:
|
||||
|
||||
- [The `[runners.cache]` section](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runners-cache-section)
|
||||
- [Deploying and using a cache server for GitLab Runner](https://docs.gitlab.com/runner/configuration/autoscale.html#distributed-runners-caching)
|
||||
- [How cache works](../../ci/yaml/README.md#cache)
|
||||
|
||||
### `[runners.machine]`
|
||||
|
||||
This is the most important part of the configuration and it's the one that
|
||||
tells GitLab Runner how and when to spawn new Docker Machine instances.
|
||||
|
||||
```toml
|
||||
[runners.machine]
|
||||
IdleCount = 1
|
||||
IdleTime = 1800
|
||||
MaxBuilds = 100
|
||||
MachineDriver = "amazonec2"
|
||||
MachineName = "gitlab-docker-machine-%s"
|
||||
OffPeakPeriods = ["* * 0-7,19-23 * * mon-fri *", "* * * * * sat,sun *"]
|
||||
OffPeakIdleCount = 0
|
||||
OffPeakIdleTime = 1200
|
||||
MachineOptions = [
|
||||
"amazonec2-access-key=XXXX",
|
||||
"amazonec2-secret-key=XXXX",
|
||||
"amazonec2-region=us-east-1",
|
||||
"amazonec2-vpc-id=vpc-xxxxx",
|
||||
"amazonec2-subnet-id=subnet-xxxxx",
|
||||
"amazonec2-use-private-address=true",
|
||||
"amazonec2-tags=Name,gitlab-runner-autoscale",
|
||||
"amazonec2-security-group=docker-machine-scaler",
|
||||
"amazonec2-instance-type=m4.2xlarge",
|
||||
"amazonec2-ssh-user=ubuntu",
|
||||
"amazonec2-ssh-keypath=/etc/gitlab-runner/certs/gitlab-aws-autoscaler",
|
||||
"amazonec2-zone=a",
|
||||
"amazonec2-root-size=32",
|
||||
]
|
||||
```
|
||||
|
||||
TIP: **Tip:**
|
||||
Under `MachineOptions` you can add anything that the [AWS Docker Machine driver
|
||||
supports](https://docs.docker.com/machine/drivers/aws/#options).
|
||||
|
||||
## Cutting down costs with Amazon EC2 Spot instances
|
||||
|
||||
|
|
Loading…
Reference in New Issue