Commit db2169d4 authored by Laurent Peuch's avatar 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
......@@ -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,
from pathlib import Path
import shutil
from cube_doctor import NoMRCommand
class RunScriptNoMr(NoMRCommand):
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:
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 /
raise Exception(
"ERROR: there is already a file in the target repository that has the same "
"name than the script at {}"
shutil.copyfile(other_args.script, repo.path /
repo.run_command(f"bash {}")
raise Exception()
yield {}
Supports Markdown
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