SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 9cf4a0e5 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add gitlab command delays to avoid race condition

parent beedaa61
No related branches found
No related tags found
1 merge request!56Fix gitlab race conditions with repo creation
...@@ -5,6 +5,8 @@ from datetime import datetime ...@@ -5,6 +5,8 @@ from datetime import datetime
from functools import reduce from functools import reduce
from itertools import cycle from itertools import cycle
from typing import Any, Callable, Dict, List, Tuple from typing import Any, Callable, Dict, List, Tuple
from time import sleep
from django.core.management.base import BaseCommand, CommandParser from django.core.management.base import BaseCommand, CommandParser
from django.conf import settings from django.conf import settings
...@@ -189,6 +191,10 @@ class Command(BaseCommand): ...@@ -189,6 +191,10 @@ class Command(BaseCommand):
base_actions = self._get_project_cloning_actions(base_template_project) base_actions = self._get_project_cloning_actions(base_template_project)
journal_actions = self._get_project_cloning_actions(journal_template_project) journal_actions = self._get_project_cloning_actions(journal_template_project)
# Add some delays to avoid:
# - Commiting the files before the branch has finished being created
# - Changing the protected branch before the files have been commited
sleep(3)
# Commit the actions # Commit the actions
project.commits.create( project.commits.create(
{ {
...@@ -197,6 +203,7 @@ class Command(BaseCommand): ...@@ -197,6 +203,7 @@ class Command(BaseCommand):
"actions": base_actions + journal_actions, "actions": base_actions + journal_actions,
} }
) )
sleep(3)
# Allow Developers to push to the protected "main" branch # Allow Developers to push to the protected "main" branch
# Protected branches lay on top of the branches. Deleting and recreating them is # Protected branches lay on top of the branches. Deleting and recreating them is
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment