Commit 7c501d5b authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

pipeline schedules

parent 8b05e014
Pipeline #4737 passed with stage
in 55 seconds
......@@ -408,6 +408,18 @@ class Project(Links, NamedModel, TimeStampedModel):
travis = self.badge_travis() if self.public else mark_safe('')
return travis + self.badge_gitlab() + self.badge_coverage()
def cron(self):
""" generate a cron-style interval description to run CI monthly on master """
hour, day = (self.pk // 30) % 24, self.pk % 30 + 1
return f'0 {hour} {day} * *'
def pipeline_schedules(self):
""" provides a link to gitlab's CI schedules page showing then cron rule to use with this project """
repo = self.filter(forge__source=SOURCES.gitlab, namespace__group=True)
if repo.exists():
link = repo.first().url + '/pipeline_schedules'
return mark_safe(f'<a href="{link}">{self.cron}</a>')
class Repo(TimeStampedModel):
name = models.CharField(max_length=200)
......
......@@ -13,14 +13,19 @@
{% else %}
{% bootstrap_label 'UNLICENSED' label_class='label label-warning' %}
{% endif %}
<br>
{% if project.public %}
{% bootstrap_label 'public' label_class='label label-success' %}
{% else %}
{% bootstrap_label 'private' label_class='label label-danger' %}
{% endif %}
<br>
{{ project.badges }}
<br>
{{ project.pipeline_schedules }}
</div>
<dl class="row" style="line-height: 1">
......
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