Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion config-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,20 @@ gitlab:
#cloud-config
package_upgrade: true

# List of networks this GitLab server is part of. This may be a private
# network uuid, or the constant "public" for public networks.
#
# Note that at least one network entry has to be shared with the GitLab
# runner config below, or the runners won't be able to contact the server.
networks:
- public

# GitLab runner instances settings
gitlab_runner:

# The fleeting plugin image to use
fleeting_image: quay.io/cloudscalech/fleeting-plugin-cloudscale:latest

# Unique name for this group of managed runner instances
group: fleeting

Expand All @@ -62,6 +73,13 @@ gitlab_runner:
# The size of the root disk
volume_size_gb: 25

# The networks attached to the GitLab runner. The first network is used to
# communicate with the GitLab server. The GitLab runner typically needs
# internet access, so if only private networks are configured, a default
# gateway has to be configured.
networks:
- public

# The user data applied to each instance. Note that GitLab expects to find
# a working docker configuration.
user_data: |
Expand Down Expand Up @@ -93,7 +111,7 @@ gitlab_runner:
# The number of jobs an instance completes, before it is removed
max_builds: 1024

# Delete instances when the controlling gitlab runner is shut down. This
# Delete instances when the controlling GitLab runner is shut down. This
# ensures that a new fleeting plugin release causes new runners to be
# created, but can introduce some instance churn.
#
Expand Down
4 changes: 4 additions & 0 deletions playbooks/gitlab-autoscale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Launch VM
# -------------------------------------------------------------------------
- name: Launch GitLab

Check warning on line 39 in playbooks/gitlab-autoscale.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

args[module]

dictionary requested, could not parse JSON or key=value
cloudscale_ch.cloud.server:
name: '{{ config.gitlab.name }}'
image: '{{ config.gitlab.image }}'
Expand All @@ -45,6 +45,10 @@
volume_size_gb: '{{ config.gitlab.volume_size_gb }}'
ssh_keys: '{{ config.gitlab.ssh_keys }}'
user_data: '{{ config.gitlab.user_data }}'
interfaces: |
[{% for network in config.gitlab.networks | default(["public"]) %}
{"network": "{{ network }}"}{% if not loop.last %},{% endif %}
{% endfor %}]
register: gitlab_server
until: gitlab_server.ssh_host_keys
retries: 60
Expand Down
7 changes: 6 additions & 1 deletion templates/gitlab-runner.toml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrent = {{
use_external_addr = true

[runners.autoscaler]
plugin = "quay.io/cloudscalech/fleeting-plugin-cloudscale:latest"
plugin = "{{ config.gitlab_runner.fleeting_image | default('quay.io/cloudscalech/fleeting-plugin-cloudscale:latest') }}"

capacity_per_instance = {{ config.gitlab_runner.capacity_per_instance }}
max_instances = {{ config.gitlab_runner.max_instances }}
Expand All @@ -38,6 +38,11 @@ concurrent = {{
zone = "{{ config.gitlab_runner.zone }}"
user_data = """{{ config.gitlab_runner.user_data }}"""
volume_size_gb = {{ config.gitlab_runner.volume_size_gb | default(10) }}
interfaces = [
{% for network in config.gitlab_runner.networks | default(["public"]) %}
{ network = "{{ network }}" },
{% endfor %}
]

{% for policy in config.gitlab_runner.policies %}
# {{ policy.name }}
Expand Down