Commit 1ca1adf9 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat: relaunch old auto-mr function for cubes not under beta

parent 6f46f73cfcbe
......@@ -410,6 +410,13 @@ class Command:
wrap.command_name = self.command_name
wrap.base_query = self.base_query
wrap.class_name = self.__class__.__name__
# set all BRANCH_NAME, AUTO_MR_AUTO_MERGE, NO_AUTO_MR etc... attribute to self.workflow
for attribute in dir(self):
if attribute.isupper():
setattr(wrap, attribute, getattr(self, attribute))
self.workflow = wrap
def pre_check(self, root_files):
......@@ -15,6 +15,7 @@ from cube_doctor import (
from cube_doctor.utils import COMMANDS, commands_to_run
from cube_doctor.transforms.propose_base_config import ProposeBaseConfig
from cube_doctor.old import auto_mr as old_auto_mr
propose_base_config = ProposeBaseConfig().workflow
......@@ -109,7 +110,12 @@ def auto_mr(delay):
# we want to generate MR with merge_when_pipeline_succeeds in priority
for target in ["clients", "cubes", "core"]:
old_auto_mr(merge_when_pipeline_succeeds=True, target=target, delay=delay)
for target in ["clients", "cubes", "core"]:
old_auto_mr(merge_when_pipeline_succeeds=False, target=target, delay=delay)
def main():
from loguru import logger
from cube_doctor import EmptyCubeQueryResult
from cube_doctor.utils import COMMANDS
def auto_mr(merge_when_pipeline_succeeds, target, delay):
def doesnt_already_have_a_mr_from_another_command(cube):
# if we already have a MR from at least one command, returns
if branch_names.intersection({ for x in cube.branches.list()}):
return "continue"
branch_names = {command.BRANCH_NAME for command in COMMANDS.values()}
for command in COMMANDS.values():
# we don't want to auto merge some more advanced commands
if merge_when_pipeline_succeeds and not command.AUTO_MR_AUTO_MERGE:
f"skip command {command.class_name} because we are in "
"merge_when_pipeline_succeeds mod and this command refuse to work on it"
if command.NO_AUTO_MR:
f"skip command {command.class_name} because has been manually "
"excluded from auto-merge feature"
if target not in command.TARGETS:
f"skip command {command.class_name} because it is not meant to "
f"work on {target} projects"
try:"Launch command {command.class_name}")
except EmptyCubeQueryResult:
# it's actually good that we don't have any result
f"Command {command.class_name} didn't had any cube to work on, "
"it's all good"
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