Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cube-doctor
Commits
2ce6258785b6
Commit
db2169d4
authored
Aug 06, 2021
by
Laurent Peuch
Browse files
feat: add a new command run-script-no-mr
parent
df60b80bd65c
Pipeline
#76425
passed with stage
in 19 minutes and 52 seconds
Changes
2
Pipelines
104
Hide whitespace changes
Inline
Side-by-side
cube_doctor/doctor_hg.py
View file @
2ce62587
...
...
@@ -19,6 +19,7 @@ from cube_doctor.transforms.update_cube_licence_dates import UpdateCubeLicenceDa
from
cube_doctor.transforms.add_yamllint
import
AddYamlLint
from
cube_doctor.transforms.add_release_new
import
AddReleaseNew
from
cube_doctor.transforms.run_script
import
RunScript
from
cube_doctor.transforms.run_script_no_mr
import
RunScriptNoMr
from
cube_doctor.transforms.regenerate_gitlab_ci
import
RegenerateGitlabCI
from
cube_doctor.transforms.rebase_all
import
RebaseAllMyMRs
...
...
@@ -94,6 +95,7 @@ commands = {
"auto-upgrade-dependencies"
:
AutoUpgradeDependencies
().
workflow
,
"regenerate-gitlab-ci"
:
RegenerateGitlabCI
().
workflow
,
"run-script"
:
RunScript
().
workflow
,
"run-script-no-mr"
:
RunScriptNoMr
().
workflow
,
"rebase-all-my-mrs"
:
RebaseAllMyMRs
().
workflow
,
}
...
...
cube_doctor/transforms/run_script_no_mr.py
0 → 100644
View file @
2ce62587
from
pathlib
import
Path
import
shutil
from
cube_doctor
import
NoMRCommand
class
RunScriptNoMr
(
NoMRCommand
):
TARGETS
=
()
def
modify_code
(
self
,
cube
,
repo
,
root_files
,
branches
,
apply
,
other_args
):
assert
other_args
.
script
is
not
None
or
other_args
.
script_command
is
not
None
if
other_args
.
script_command
:
repo
.
run_command
(
other_args
.
script_command
)
elif
other_args
.
script
:
script_path
=
Path
(
other_args
.
script
)
if
not
script_path
.
exists
():
raise
Exception
(
f
"ERROR: couldn't find script at
{
other_args
.
script
}
"
)
if
(
repo
.
path
/
script_path
.
name
).
exists
():
raise
Exception
(
"ERROR: there is already a file in the target repository that has the same "
"name than the script at {script_path.name}"
)
shutil
.
copyfile
(
other_args
.
script
,
repo
.
path
/
script_path
.
name
)
repo
.
run_command
(
f
"bash
{
script_path
.
name
}
"
)
repo
.
remove_file
(
script_path
.
name
)
else
:
raise
Exception
()
yield
{}
Write
Preview
Supports
Markdown
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