Skip to content

Commit

Permalink
Universum 0.19.18
Browse files Browse the repository at this point in the history
  • Loading branch information
k-dovgan committed Nov 10, 2023
2 parents 8274de3 + 6784c35 commit 3c76ec9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Change log
==========

0.19.18 (2023-11-10)
--------------------

Bug fixes
~~~~~~~~~

* **artifacts:** build initialization failure for conditional/branch step with no artifacts
* **out:** incorrect block closing for TC, causing unexpected embedment


0.19.17 (2023-09-06)
--------------------

Expand Down
13 changes: 13 additions & 0 deletions tests/test_conditional_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,16 @@ def test_add_conditional_to_step(test_env: ConditionalStepsTestEnv, capsys: pyte
test_env._check_conditional_step_artifacts_present(steps_info)
test_env._check_executed_step_artifacts_present(steps_info)
# pylint: enable = protected-access


def test_no_artifacts(test_env: ConditionalStepsTestEnv) -> None:
config_lines: List[str] = [
"from universum.configuration_support import Configuration, Step",
"true_branch_config = Configuration([Step(name='True branch step')])",
"conditional_step = Configuration([Step(name='Conditional step', if_succeeded=true_branch_config)])",
"configs = conditional_step"
]

config: str = "\n".join(config_lines)
test_env.configs_file.write_text(config, "utf-8")
test_env.run()
2 changes: 1 addition & 1 deletion universum/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "Universum"
__version__ = "0.19.17"
__version__ = "0.19.18"
22 changes: 16 additions & 6 deletions universum/modules/artifact_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ def set_and_clean_artifacts(self, project_configs: Configuration, ignore_existin
artifact_list: List[ArtifactInfo] = []
for configuration in project_configs.all():
if configuration.artifacts:
artifact_list.append(self.get_config_artifact(configuration))
self.append_config_artifact_if_present(artifact_list, configuration)
if configuration.report_artifacts:
artifact_list.append(self.get_config_artifact(configuration, is_report_artifact=True))
self.append_config_artifact_if_present(artifact_list, configuration, is_report_artifact=True)
if configuration.is_conditional:
artifact_list.extend(self.get_conditional_step_branches_artifacts(configuration))

Expand All @@ -180,16 +180,26 @@ def get_conditional_step_branches_artifacts(self, conditional_step: Step) -> Lis
if conditional_step.if_failed:
steps_to_process.extend(list(conditional_step.if_failed.all()))

artifacts: List[Optional[ArtifactInfo]] = []
artifacts: List[ArtifactInfo] = []
for step in steps_to_process:
artifacts.append(self.get_config_artifact(step))
artifacts.append(self.get_config_artifact(step, is_report_artifact=True))
self.append_config_artifact_if_present(artifacts, step)
self.append_config_artifact_if_present(artifacts, step, is_report_artifact=True)

defined_artifacts: List[ArtifactInfo] = [artifact for artifact in artifacts if artifact]
return defined_artifacts

def get_config_artifact(self, step: Step, is_report_artifact: bool = False) -> ArtifactInfo:
def append_config_artifact_if_present(self,
artifacts: List[ArtifactInfo],
step: Step,
is_report_artifact: bool = False) -> None:
artifact: Optional[ArtifactInfo] = self.get_config_artifact(step, is_report_artifact)
if artifact:
artifacts.append(artifact)

def get_config_artifact(self, step: Step, is_report_artifact: bool = False) -> Optional[ArtifactInfo]:
artifact: str = step.report_artifacts if is_report_artifact else step.artifacts
if not artifact:
return None
path: str = utils.parse_path(artifact, self.settings.project_root)
return dict(path=path, clean=step.artifact_prebuild_clean)

Expand Down
2 changes: 1 addition & 1 deletion universum/modules/output/teamcity_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def open_block(self, num_str: str, name: str) -> None:
print(f"##teamcity[blockOpened name='{num_str} {escape(name)}']")

def close_block(self, num_str: str, name: str, status: str) -> None:
print(f"##teamcity[block\\Closed name='{num_str} {escape(name)}']")
print(f"##teamcity[blockClosed name='{num_str} {escape(name)}']")

def log_skipped(self, message: str) -> None:
lines = message.split("\n")
Expand Down

0 comments on commit 3c76ec9

Please sign in to comment.