Module: Gitlab::Utils::Job
- Defined in:
- lib/gitlab/utils/job.rb
Class Method Summary collapse
Class Method Details
.group_name(job_name) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/gitlab/utils/job.rb', line 7 def group_name(job_name) # [\b\s:] -> whitespace or column # (\[.*\])|(\d+[\s:\/\\]+\d+) -> variables/matrix or parallel-jobs numbers # {1,3} -> number of times that matches the variables/matrix or parallel-jobs numbers # we limit this to 3 because of possible abuse regex = %r{([\b\s:]+((\[.*\])|(\d+[\s:\/\\]+\d+))){1,3}\s*\z} job_name.to_s.sub(regex, '').strip end |