Skip to content
Snippets Groups Projects
Commit d0dd662b authored by Emanuele Aina's avatar Emanuele Aina
Browse files

create-branches: Add a delay in the hope that no pipeline is created


Try to give more time to GitLab to realize we created a new branch so
hopefully it will stop creating pipelines for it.

Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
...@@ -7,10 +7,12 @@ import collections.abc ...@@ -7,10 +7,12 @@ import collections.abc
import concurrent.futures import concurrent.futures
import fnmatch import fnmatch
import logging import logging
import time
import sys import sys
import gitlab import gitlab
BRANCH_CREATION_SLEEP_SECONDS = 20
def item_id(item): def item_id(item):
itemid = None itemid = None
...@@ -105,6 +107,12 @@ def _create_branch(project, base_branch, new_branch, really): ...@@ -105,6 +107,12 @@ def _create_branch(project, base_branch, new_branch, really):
project.default_branch = new_branch project.default_branch = new_branch
if really: if really:
project.save() project.save()
# when creating many branches at the same time GitLab may need some time to realize
# if we re-enable the CI too soon, it will still create pipelines for the new refs
logging.info(
f"{project.path_with_namespace}: Sleeping for {BRANCH_CREATION_SLEEP_SECONDS}s to let GitLab realize {new_branch} has been created"
)
time.sleep(BRANCH_CREATION_SLEEP_SECONDS)
finally: finally:
logging.info( logging.info(
f"{project.path_with_namespace}: Restoring CI settings to {original_builds_access_level}" f"{project.path_with_namespace}: Restoring CI settings to {original_builds_access_level}"
...@@ -158,7 +166,7 @@ class Brancher: ...@@ -158,7 +166,7 @@ class Brancher:
def branch(self, branch_prefix, base_release, new_release, really): def branch(self, branch_prefix, base_release, new_release, really):
logging.info(f"Branching {new_release} from {base_release}") logging.info(f"Branching {new_release} from {base_release}")
num_worker_threads = 10 num_worker_threads = 30
branch_prefix = branch_prefix.rstrip("/") + "/" branch_prefix = branch_prefix.rstrip("/") + "/"
base_branch = branch_prefix + base_release base_branch = branch_prefix + base_release
new_branch = branch_prefix + new_release new_branch = branch_prefix + new_release
......
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