mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-24 02:32:26 +08:00
Streamlined cmd line options for local builds
Signed-off-by: Martin Curlej <mcurlej@redhat.com>
This commit is contained in:
committed by
Ralph Bean
parent
b4c3daa155
commit
03cff80e4a
@@ -317,31 +317,39 @@ def submit_module_build(scm_url, branch, server, id_provider, pyrpkg, verify=Tru
|
||||
return -3, None
|
||||
|
||||
|
||||
def do_local_build(scm_url, branch, skiptests, local_builds_nsvs, log_flag=None):
|
||||
def do_local_build(scm_url, branch, skiptests, local_builds_nsvs, log_flag=None,
|
||||
yaml_file=None, stream=None):
|
||||
"""
|
||||
Starts the local build using the 'mbs-manager build_module_locally'
|
||||
command. Returns exit code of that command or None when scm_url or
|
||||
branch are not set and cannot be obtained from the CWD.
|
||||
"""
|
||||
scm_url = get_scm_url(scm_url, None, local=True)
|
||||
branch = get_scm_branch(branch)
|
||||
if not scm_url or not branch:
|
||||
return None
|
||||
|
||||
logging.info("Starting local build of %s, branch %s", scm_url, branch)
|
||||
command = ['mbs-manager']
|
||||
if log_flag:
|
||||
command.append(log_flag)
|
||||
command.append('build_module_locally')
|
||||
if skiptests:
|
||||
command.append('--skiptests')
|
||||
logging.info("Tests will be skipped due to --skiptests option.")
|
||||
if yaml_file:
|
||||
command.append('build_module_locally_from_file')
|
||||
logging.info("Starting local build from yaml file %s" % yaml_file)
|
||||
command.extend(["--file", yaml_file])
|
||||
if stream:
|
||||
command.extend(["--stream", stream])
|
||||
else:
|
||||
command.append('build_module_locally')
|
||||
scm_url = get_scm_url(scm_url, None, local=True)
|
||||
branch = get_scm_branch(branch)
|
||||
if not scm_url or not branch:
|
||||
return None
|
||||
|
||||
if local_builds_nsvs:
|
||||
for build_id in local_builds_nsvs:
|
||||
command += ['--add-local-build', build_id]
|
||||
logging.info("Starting local build of %s, branch %s", scm_url, branch)
|
||||
if log_flag:
|
||||
command.append(log_flag)
|
||||
if skiptests:
|
||||
command.append('--skiptests')
|
||||
logging.info("Tests will be skipped due to --skiptests option.")
|
||||
|
||||
command.extend([scm_url, branch])
|
||||
if local_builds_nsvs:
|
||||
for build_id in local_builds_nsvs:
|
||||
command += ['--add-local-build', build_id]
|
||||
|
||||
command.extend([scm_url, branch])
|
||||
|
||||
process = subprocess.Popen(command)
|
||||
process.communicate()
|
||||
@@ -494,6 +502,11 @@ def main():
|
||||
dest="local_builds_nsvs", metavar='BUILD_ID')
|
||||
parser_local.add_argument('--skiptests', dest='skiptests', action='store_true',
|
||||
help="add macro for skipping check section/phase")
|
||||
parser_local.add_argument('--file', dest='file', action='store',
|
||||
help="Path to the modulemd yaml file")
|
||||
parser_local.add_argument('--stream', dest='stream', action='store',
|
||||
help=("Name of the stream of this build."
|
||||
" (builds from files only)"))
|
||||
|
||||
parser_overview = subparsers.add_parser(
|
||||
'overview', help="show overview of module builds",
|
||||
@@ -540,7 +553,8 @@ def main():
|
||||
print("Submitted module build %r" % build_id)
|
||||
elif args.cmd_name == "local":
|
||||
sys.exit(do_local_build(args.scm_url, args.branch, args.skiptests,
|
||||
args.local_builds_nsvs, log_flag))
|
||||
args.local_builds_nsvs, log_flag, args.file,
|
||||
args.stream))
|
||||
elif args.cmd_name == "watch":
|
||||
# Watch the module build.
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user