Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TECH-713] Take tag into account for artifacts and build status cli commands #326

Merged
merged 4 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/mpyl/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,7 @@ def status(obj: CliContext, all_, projects):
try:
upgrade_check = asyncio.wait_for(warn_if_update(obj.console), timeout=3)
parameters = MpylCliParameters(
local=sys.stdout.isatty(),
all=all_,
projects=projects,
local=sys.stdout.isatty(), all=all_, projects=projects
)
print_status(obj, parameters)
except asyncio.exceptions.TimeoutError:
Expand Down Expand Up @@ -489,7 +487,10 @@ def artifacts():
@click.pass_obj
def pull(obj: CliContext, tag: str, pr: int, path: Path):
run_properties = initiate_run_properties(
config=obj.config, properties=obj.run_properties
config=obj.config,
properties=obj.run_properties,
run_plan={},
all_projects=set(),
)
target_branch = __get_target_branch(run_properties, tag, pr)

Expand Down Expand Up @@ -518,7 +519,10 @@ def pull(obj: CliContext, tag: str, pr: int, path: Path):
@click.pass_obj
def push(obj: CliContext, tag: str, pr: int, path: Path, artifact_type: str):
run_properties = initiate_run_properties(
config=obj.config, properties=obj.run_properties
config=obj.config,
properties=obj.run_properties,
run_plan={},
all_projects=set(),
)
target_branch = __get_target_branch(run_properties, tag, pr)

Expand Down
9 changes: 5 additions & 4 deletions src/mpyl/steps/run_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def initiate_run_properties(
run_plan: Optional[dict[Stage, set[Project]]] = None,
all_projects: Optional[set[Project]] = None,
) -> RunProperties:
tag = cli_parameters.tag or properties["build"]["versioning"].get("tag")
if all_projects is None or run_plan is None:
with Repository(RepoConfig.from_config(config)) as repo:
if all_projects is None:
Expand Down Expand Up @@ -46,8 +47,8 @@ def initiate_run_properties(
repo.changes_in_branch_including_local()
if cli_parameters.local
else (
repo.changes_in_tagged_commit(cli_parameters.tag)
if cli_parameters.tag
repo.changes_in_tagged_commit(tag)
if tag
else repo.changes_in_branch()
)
),
Expand All @@ -63,7 +64,7 @@ def initiate_run_properties(
run_plan=run_plan,
revision=repo.get_sha,
branch=repo.get_branch,
tag=cli_parameters.tag,
tag=tag,
stages=stages,
all_projects=all_projects,
)
Expand All @@ -73,5 +74,5 @@ def initiate_run_properties(
config=config,
run_plan=run_plan,
all_projects=all_projects,
cli_tag=cli_parameters.tag,
cli_tag=tag,
)