Skip to content

Commit 6c51739

Browse files
committed
Add run flag and improved logging
1 parent 32f9f7f commit 6c51739

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/universal_build/build_utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
FLAG_RELEASE = "release"
1414
FLAG_VERSION = "version"
1515
FLAG_CHECK = "check"
16+
FLAG_RUN = "run"
1617
FLAG_SKIP_PATH = "skip_path"
1718
FLAG_FORCE = "force"
1819
FLAG_DOCKER_IMAGE_PREFIX = "docker_image_prefix"
@@ -288,7 +289,9 @@ def _get_current_branch() -> Tuple[str, str]:
288289
Returns:
289290
Tuple: (branchname, type)
290291
"""
291-
full_branch_name = run("git branch --show-current").stdout.rstrip("\n")
292+
full_branch_name = run(
293+
"git branch --show-current", disable_stdout_logging=True
294+
).stdout.rstrip("\n")
292295
if full_branch_name == "":
293296
full_branch_name = "HEAD"
294297
path_parts = full_branch_name.split("/")
@@ -337,6 +340,11 @@ def _get_default_cli_arguments_parser(
337340
help="Release all artefacts to respective remote registries (e.g. DockerHub)",
338341
action="store_true",
339342
)
343+
parser.add_argument(
344+
f"--{FLAG_RUN}",
345+
help="Run the component for development (e.g. dev server).",
346+
action="store_true",
347+
)
340348
parser.add_argument(
341349
f"--{FLAG_VERSION}", help="Version of build (MAJOR.MINOR.PATCH-TAG)"
342350
)
@@ -383,10 +391,10 @@ def _is_valid_command_combination(args: argparse.Namespace) -> bool:
383391
)
384392
return False
385393
if args.release and not args.test and not args.force:
386-
log(f"Test must be executed before the deployment (--{FLAG_TEST})")
394+
log(f"The release steps requires test to be executed (--{FLAG_TEST})")
387395
return False
388396
if args.release and not args.make and not args.force:
389-
log(f"Build must be executed before the deployment (--{FLAG_MAKE})")
397+
log(f"The release steps requires make to be executed (--{FLAG_MAKE})")
390398
return False
391399

392400
if args.release:
@@ -428,7 +436,6 @@ def _get_latest_branch_version(branch_name: str = "") -> Optional["Version"]:
428436

429437
def _is_dev_tag_belonging_to_branch(version: "Version", branch_name: str = "") -> bool:
430438
# The found dev-version does not belong to the current branch
431-
print(version.to_string(), _get_dev_suffix(branch_name))
432439
return not (
433440
branch_name
434441
and version

0 commit comments

Comments
 (0)