SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
9cf4a0e5
Commit
9cf4a0e5
authored
1 year ago
by
George Katsikas
Browse files
Options
Downloads
Patches
Plain Diff
add gitlab command delays to avoid race condition
parent
beedaa61
No related branches found
No related tags found
1 merge request
!56
Fix gitlab race conditions with repo creation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scipost_django/production/management/commands/advance_git_repos.py
+7
-0
7 additions, 0 deletions
...jango/production/management/commands/advance_git_repos.py
with
7 additions
and
0 deletions
scipost_django/production/management/commands/advance_git_repos.py
+
7
−
0
View file @
9cf4a0e5
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment