Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cube-doctor
Commits
4c6ed1100ed0
Commit
1ca1adf9
authored
Oct 31, 2021
by
Laurent Peuch
Browse files
feat: relaunch old auto-mr function for cubes not under beta
parent
6f46f73cfcbe
Changes
3
Hide whitespace changes
Inline
Side-by-side
cube_doctor/__init__.py
View file @
4c6ed110
...
...
@@ -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
):
...
...
cube_doctor/doctor_hg.py
View file @
4c6ed110
...
...
@@ -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):
traceback
.
print_exc
()
# 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
():
...
...
cube_doctor/old.py
0 → 100644
View file @
4c6ed110
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
({
x
.
name
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
:
logger
.
info
(
f
"skip command
{
command
.
class_name
}
because we are in "
"merge_when_pipeline_succeeds mod and this command refuse to work on it"
)
continue
if
command
.
NO_AUTO_MR
:
logger
.
info
(
f
"skip command
{
command
.
class_name
}
because has been manually "
"excluded from auto-merge feature"
)
continue
if
target
not
in
command
.
TARGETS
:
logger
.
info
(
f
"skip command
{
command
.
class_name
}
because it is not meant to "
f
"work on
{
target
}
projects"
)
continue
try
:
logger
.
info
(
f
"Launch command
{
command
.
class_name
}
"
)
command
(
apply
=
True
,
interactif
=
False
,
merge_when_pipeline_succeeds
=
merge_when_pipeline_succeeds
,
additional_checks
=
[
doesnt_already_have_a_mr_from_another_command
],
target
=
target
,
delay
=
delay
,
)
except
EmptyCubeQueryResult
:
# it's actually good that we don't have any result
logger
.
info
(
f
"Command
{
command
.
class_name
}
didn't had any cube to work on, "
"it's all good"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment