Commit c934f913 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

BAD_ONES

parent bfe4672b
Pipeline #14811 failed with stage
in 2 minutes and 2 seconds
import re import re
from datetime import timedelta from datetime import timedelta
import github
from django.conf import settings from django.conf import settings
from django.core.management import call_command from django.core.management import call_command
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.db.models import F, Q from django.db.models import F, Q
from django.utils import timezone from django.utils import timezone
from rainboard.models import Branch, Forge, Image, Project, Repo, Robotpkg, IssuePr import github
from rainboard.models import BAD_ONES, Branch, Forge, Image, IssuePr, Project, Repo, Robotpkg
from rainboard.utils import SOURCES, update_robotpkg from rainboard.utils import SOURCES, update_robotpkg
MIN_DAYS_SINCE_UPDATED = 10 # Only show issues and pull requests older than this MIN_DAYS_SINCE_UPDATED = 10 # Only show issues and pull requests older than this
...@@ -17,8 +17,7 @@ SKIP_LABEL = 'skip dashboard' # Issues and prs with this label will not be adde ...@@ -17,8 +17,7 @@ SKIP_LABEL = 'skip dashboard' # Issues and prs with this label will not be adde
def update_issues_pr(): def update_issues_pr():
print('\nUpdating issues and pull requests') print('\nUpdating issues and pull requests')
for project in Project.objects.filter(archived=False, for project in Project.objects.exclude(BAD_ONES):
main_namespace__from_gepetto=True).exclude(name__endswith='release'):
try: try:
gh = project.github() gh = project.github()
main_repo = project.repo_set.filter(namespace=project.main_namespace, forge__source=SOURCES.github).first() main_repo = project.repo_set.filter(namespace=project.main_namespace, forge__source=SOURCES.github).first()
...@@ -71,8 +70,7 @@ class Command(BaseCommand): ...@@ -71,8 +70,7 @@ class Command(BaseCommand):
update_robotpkg(settings.RAINBOARD_RPKG) update_robotpkg(settings.RAINBOARD_RPKG)
log('\nUpdating gepetto projects\n') log('\nUpdating gepetto projects\n')
for project in Project.objects.filter(archived=False, for project in Project.objects.exclude(BAD_ONES):
main_namespace__from_gepetto=True).exclude(name__endswith='release'):
log(f' {project}') log(f' {project}')
project.update(only_main_branches=False) project.update(only_main_branches=False)
......
...@@ -50,6 +50,8 @@ TRAVIS_STATE = {'created': None, 'passed': True, 'started': None, 'failed': Fals ...@@ -50,6 +50,8 @@ TRAVIS_STATE = {'created': None, 'passed': True, 'started': None, 'failed': Fals
GITLAB_STATUS = {'failed': False, 'success': True, 'pending': None, 'skipped': None, 'canceled': None, 'running': None} GITLAB_STATUS = {'failed': False, 'success': True, 'pending': None, 'skipped': None, 'canceled': None, 'running': None}
GEPETTO_SLUGS = ['gepetto', 'stack-of-tasks', 'humanoid-path-planner', 'loco-3d'] GEPETTO_SLUGS = ['gepetto', 'stack-of-tasks', 'humanoid-path-planner', 'loco-3d']
BAD_ONES = Q(main_namespace__from_gepetto=False) | Q(robotpkg__isnull=True) | Q(archived=True)
class Namespace(NamedModel): class Namespace(NamedModel):
group = models.BooleanField(default=False) group = models.BooleanField(default=False)
...@@ -1291,9 +1293,8 @@ def to_release_in_robotpkg(): ...@@ -1291,9 +1293,8 @@ def to_release_in_robotpkg():
def ordered_projects(): def ordered_projects():
""" helper for gepetto/buildfarm/generate_all.py """ """ helper for gepetto/buildfarm/generate_all.py """
fields = 'category', 'name', 'project__main_namespace__slug', 'project__ccache' fields = 'category', 'name', 'project__main_namespace__slug', 'project__ccache'
bad_ones = Q(main_namespace__from_gepetto=False) | Q(robotpkg__isnull=True) | Q(archived=True)
projects = Project.objects.exclude(bad_ones) projects = Project.objects.exclude(BAD_ONES)
rpkgs = list(Robotpkg.objects.filter(project__in=projects).values_list(*fields)) rpkgs = list(Robotpkg.objects.filter(project__in=projects).values_list(*fields))
deps_cache = {} deps_cache = {}
......
import django_tables2 as tables
from django.urls import reverse from django.urls import reverse
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
import django_tables2 as tables
from . import models, utils from . import models, utils
...@@ -34,8 +35,7 @@ class ProjectTable(StrippedTable): ...@@ -34,8 +35,7 @@ class ProjectTable(StrippedTable):
class Meta: class Meta:
model = models.Project model = models.Project
fields = ('main_namespace', 'name', 'public', 'from_gepetto', 'archived', 'license', 'homepage', 'updated', fields = ('main_namespace', 'name', 'public', 'from_gepetto', 'license', 'homepage', 'updated', 'version')
'version')
def render_name(self, record): def render_name(self, record):
return record.get_link() return record.get_link()
......
from subprocess import PIPE, Popen, run from subprocess import PIPE, Popen, run
from django.http import Http404 from django.http import Http404
from django.http.response import HttpResponse, JsonResponse, HttpResponseRedirect from django.http.response import HttpResponse, HttpResponseRedirect, JsonResponse
from django.urls import reverse from django.urls import reverse
from django.views.generic import DetailView from django.views.generic import DetailView
...@@ -35,8 +35,7 @@ class ProjectsView(SingleTableMixin, FilterView): ...@@ -35,8 +35,7 @@ class ProjectsView(SingleTableMixin, FilterView):
class GepettoProjectsView(ProjectsView): class GepettoProjectsView(ProjectsView):
queryset = models.Project.objects.filter(main_namespace__from_gepetto=True, queryset = models.Project.objects.exclude(models.BAD_ONES)
archived=False).exclude(name__endswith='release')
class ProjectView(DetailView): class ProjectView(DetailView):
...@@ -146,8 +145,7 @@ def docker(request): ...@@ -146,8 +145,7 @@ def docker(request):
def graph_svg(request): def graph_svg(request):
with open('/tmp/graph', 'w') as f: with open('/tmp/graph', 'w') as f:
print('digraph { rankdir=LR;', file=f) print('digraph { rankdir=LR;', file=f)
for project in models.Project.objects.filter(main_namespace__from_gepetto=True, for project in models.Project.objects.exclude(models.BAD_ONES):
archived=False).exclude(name__endswith='release'):
print(f'{{I{project.pk} [label="{project}" URL="{project.get_absolute_url()}"];}}', file=f) print(f'{{I{project.pk} [label="{project}" URL="{project.get_absolute_url()}"];}}', file=f)
for dep in models.Dependency.objects.filter(project__main_namespace__from_gepetto=True, for dep in models.Dependency.objects.filter(project__main_namespace__from_gepetto=True,
library__main_namespace__from_gepetto=True, library__main_namespace__from_gepetto=True,
......
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