BigW Consortium Gitlab

Add runners.cache section

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