Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…runner into azman0101-master
  • Loading branch information
drybjed committed Aug 16, 2017
2 parents 490a6a5 + b9b8ea9 commit 919beaf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
22 changes: 22 additions & 0 deletions defaults/main.yml
Expand Up @@ -476,6 +476,28 @@ gitlab_runner__machine_name: 'auto-scale-%s.{{ gitlab_runner__domain }}'
# information about supported drivers.
gitlab_runner__machine_driver: 'generic'

# ]]]
# .. envvar:: gitlab_runner__machine_offpeakperiods [[[
#
# Autoscale can be configured with the support for Off Peak time mode periods.
# Time periods when the scheduler is in the OffPeak mode.You should refer
# to `Gitlab Runner Advanced configuration documentation
# <https://docs.gitlab.com/runner/configuration/advanced-configuration.html#offpeakperiods-syntax>`_ for more
# information about OffPeakPeriods syntax.
gitlab_runner__machine_offpeakperiods: ["* * 0-7,19-23 * * mon-fri *", "* * * * * sat,sun *"]

# ]]]
# .. envvar:: gitlab_runner__machine_offpeakidlecount [[[
#
# Like IdleCount, but for Off Peak time periods.
gitlab_runner__machine_offpeakidlecount: 0

# ]]]
# .. envvar:: gitlab_runner__machine_offpeakidletime [[[
#
# Like IdleTime, but for Off Peak time mperiods.
gitlab_runner__machine_offpeakidletime: 1200

# ]]]
# .. envvar:: gitlab_runner__machine_options [[[
#
Expand Down
21 changes: 21 additions & 0 deletions templates/etc/gitlab-runner/config.toml.j2
Expand Up @@ -349,6 +349,27 @@ concurrent = {{ gitlab_runner__concurrent }}
MaxBuilds = {{ runner.machine_max_builds | d(gitlab_runner__machine_max_builds) }}
MachineName = "{{ runner.machine_name | d(gitlab_runner__machine_name) }}"
MachineDriver = "{{ runner.machine_driver | d(gitlab_runner__machine_driver) }}"
{% if runner.machine_offpeakperiods|d() or gitlab_runner__machine_offpeakperiods %}
OffPeakPeriods = [
{% if runner.machine_offpeakperiods|d() %}
{% for offpeakperiod in runner.machine_offpeakperiods %}
"{{ offpeakperiod }}"{% if not loop.last %},
{% endif %}
{% endfor %}
{% else %}
{% for offpeakperiod in gitlab_runner__machine_offpeakperiods %}
"{{ offpeakperiod }}"{% if not loop.last %},
{% endif %}
{% endfor %}
{% endif %}
]
{% endif %}
{% if runner.machine_offpeakidlecount|d() or gitlab_runner__machine_offpeakidlecount %}
OffPeakIdleCount = {{ runner.machine_offpeakidlecount | d(gitlab_runner__machine_offpeakidlecount) }}
{% endif %}
{% if runner.machine_offpeakidletime|d() or gitlab_runner__machine_offpeakidletime %}
OffPeakIdleTime = {{ runner.machine_offpeakidletime | d(gitlab_runner__machine_offpeakidletime) }}
{% endif %}
{% if runner.machine_options|d() or gitlab_runner__machine_options %}
MachineOptions = [
{% if runner.machine_options|d() %}
Expand Down

0 comments on commit 919beaf

Please sign in to comment.