Skip to content

Commit f5bfc0d

Browse files
committed
Merge branch 'azman0101-master'
2 parents 490a6a5 + 919beaf commit f5bfc0d

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

defaults/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,28 @@ gitlab_runner__machine_name: 'auto-scale-%s.{{ gitlab_runner__domain }}'
476476
# information about supported drivers.
477477
gitlab_runner__machine_driver: 'generic'
478478

479+
# ]]]
480+
# .. envvar:: gitlab_runner__machine_offpeakperiods [[[
481+
#
482+
# Autoscale can be configured with the support for Off Peak time mode periods.
483+
# Time periods when the scheduler is in the OffPeak mode.You should refer
484+
# to `Gitlab Runner Advanced configuration documentation
485+
# <https://docs.gitlab.com/runner/configuration/advanced-configuration.html#offpeakperiods-syntax>`_ for more
486+
# information about OffPeakPeriods syntax.
487+
gitlab_runner__machine_offpeakperiods: ["* * 0-7,19-23 * * mon-fri *", "* * * * * sat,sun *"]
488+
489+
# ]]]
490+
# .. envvar:: gitlab_runner__machine_offpeakidlecount [[[
491+
#
492+
# Like IdleCount, but for Off Peak time periods.
493+
gitlab_runner__machine_offpeakidlecount: 0
494+
495+
# ]]]
496+
# .. envvar:: gitlab_runner__machine_offpeakidletime [[[
497+
#
498+
# Like IdleTime, but for Off Peak time mperiods.
499+
gitlab_runner__machine_offpeakidletime: 1200
500+
479501
# ]]]
480502
# .. envvar:: gitlab_runner__machine_options [[[
481503
#

templates/etc/gitlab-runner/config.toml.j2

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,27 @@ concurrent = {{ gitlab_runner__concurrent }}
349349
MaxBuilds = {{ runner.machine_max_builds | d(gitlab_runner__machine_max_builds) }}
350350
MachineName = "{{ runner.machine_name | d(gitlab_runner__machine_name) }}"
351351
MachineDriver = "{{ runner.machine_driver | d(gitlab_runner__machine_driver) }}"
352+
{% if runner.machine_offpeakperiods|d() or gitlab_runner__machine_offpeakperiods %}
353+
OffPeakPeriods = [
354+
{% if runner.machine_offpeakperiods|d() %}
355+
{% for offpeakperiod in runner.machine_offpeakperiods %}
356+
"{{ offpeakperiod }}"{% if not loop.last %},
357+
{% endif %}
358+
{% endfor %}
359+
{% else %}
360+
{% for offpeakperiod in gitlab_runner__machine_offpeakperiods %}
361+
"{{ offpeakperiod }}"{% if not loop.last %},
362+
{% endif %}
363+
{% endfor %}
364+
{% endif %}
365+
]
366+
{% endif %}
367+
{% if runner.machine_offpeakidlecount|d() or gitlab_runner__machine_offpeakidlecount %}
368+
OffPeakIdleCount = {{ runner.machine_offpeakidlecount | d(gitlab_runner__machine_offpeakidlecount) }}
369+
{% endif %}
370+
{% if runner.machine_offpeakidletime|d() or gitlab_runner__machine_offpeakidletime %}
371+
OffPeakIdleTime = {{ runner.machine_offpeakidletime | d(gitlab_runner__machine_offpeakidletime) }}
372+
{% endif %}
352373
{% if runner.machine_options|d() or gitlab_runner__machine_options %}
353374
MachineOptions = [
354375
{% if runner.machine_options|d() %}

0 commit comments

Comments
 (0)