From 51bcb08e1157e3c195772992efe3fc3591116458 Mon Sep 17 00:00:00 2001 From: Kateryna Dovgan <46348880+k-dovgan@users.noreply.github.com> Date: Fri, 21 Oct 2022 17:50:49 +0300 Subject: [PATCH 1/4] update(docs): increase version --- universum/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/universum/__init__.py b/universum/__init__.py index 701c4ef5..fe70ce34 100644 --- a/universum/__init__.py +++ b/universum/__init__.py @@ -1,2 +1,2 @@ __title__ = "Universum" -__version__ = "0.19.13" +__version__ = "0.19.14" From ac9e047153eef4add3231515cd71c5e42ba153a5 Mon Sep 17 00:00:00 2001 From: Kateryna Dovgan <46348880+k-dovgan@users.noreply.github.com> Date: Fri, 21 Oct 2022 18:09:04 +0300 Subject: [PATCH 2/4] fix(doc): typo --- doc/jenkins.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/jenkins.rst b/doc/jenkins.rst index f22caa5f..d2784e4d 100644 --- a/doc/jenkins.rst +++ b/doc/jenkins.rst @@ -94,12 +94,12 @@ Here are the symptoms of domain names not resolving correctly: 1. Jenkins warnings when trying to save the updated settings 2. Client inability to access said pages (timeout error) -To set up domain name resolving, add following lines to server ``/ets/host`` file:: +To set up domain name resolving, add following lines to server ``/ets/hosts`` file:: 127.0.0.1
-And add the following lines to client ``/ets/host`` file:: +And add the following lines to client ``/ets/hosts`` file::
From bd39a2dcadcb581e9c37776414cc2afffc1cb0a2 Mon Sep 17 00:00:00 2001 From: Kateryna Dovgan <46348880+k-dovgan@users.noreply.github.com> Date: Sun, 13 Nov 2022 22:17:39 +0200 Subject: [PATCH 3/4] feat(report): return non-zero exit code if any step fails --- tests/test_integration.py | 29 +++++++++++++++++++++++++++++ universum/modules/reporter.py | 8 ++++++++ 2 files changed, 37 insertions(+) diff --git a/tests/test_integration.py b/tests/test_integration.py index dcb9529a..6b93202a 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -351,3 +351,32 @@ def test_abort(local_sources: LocalSources, tmpdir: py.path.local, terminate_typ time.sleep(5) process.send_signal(terminate_type) assert process.wait(5) == 3 + + +def test_exit_code(local_sources: LocalSources, tmpdir: py.path.local): + config = """ +from universum.configuration_support import Configuration + +configs = Configuration([dict(name="Unsuccessful step", command=["exit", "1"])]) +""" + config_file = tmpdir.join("configs.py") + config_file.write(config) + + with subprocess.Popen([python(), "-m", "universum", + "-o", "console", "-st", "local", "-vt", "none", + "-pr", str(tmpdir.join("project_root")), + "-ad", str(tmpdir.join("artifacts")), + "-fsd", str(local_sources.root_directory), + "-cfg", str(config_file)]) as process: + + assert process.wait() == 0 + + tmpdir.join("artifacts").remove(rec=True) + with subprocess.Popen([python(), "-m", "universum", "--fail-unsuccessful", + "-o", "console", "-st", "local", "-vt", "none", + "-pr", str(tmpdir.join("project_root")), + "-ad", str(tmpdir.join("artifacts")), + "-fsd", str(local_sources.root_directory), + "-cfg", str(config_file)]) as process: + assert process.wait() == 1 + diff --git a/universum/modules/reporter.py b/universum/modules/reporter.py index 0b8814ff..5c150563 100644 --- a/universum/modules/reporter.py +++ b/universum/modules/reporter.py @@ -6,6 +6,7 @@ from . import automation_server from .output import HasOutput from .structure_handler import HasStructure, Block +from ..lib.ci_exception import SilentAbortException from ..lib.gravity import Dependency from ..lib.utils import make_block @@ -53,6 +54,8 @@ def define_arguments(argument_parser): help="Include only the short list of failed steps to reporting comments") parser.add_argument("--report-no-vote", "-rnv", action="store_true", dest="no_vote", help="Do not vote up/down review depending on result") + parser.add_argument("--fail-unsuccessful", "-rfu", action="store_true", dest="fail_unsuccessful", + help="Return non-zero exit code if any step failed") def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -119,6 +122,8 @@ def report_build_result(self): if not self.observers: self.out.log("Nowhere to report. Skipping...") + if self.settings.fail_unsuccessful and not is_successful: + raise SilentAbortException(1) return if is_successful: @@ -149,6 +154,9 @@ def report_build_result(self): for observer in self.observers: observer.code_report_to_review(self.code_report_comments) + if self.settings.fail_unsuccessful and not is_successful: + raise SilentAbortException(1) + def _report_steps_recursively(self, block: Block, text: str, indent: str) -> Tuple[str, bool]: has_children: bool = bool(block.children) block_title: str = block.number + ' ' + block.name From d8660beb277a2055bda1bbc22e14e77ee2df13b0 Mon Sep 17 00:00:00 2001 From: Kateryna Dovgan <46348880+k-dovgan@users.noreply.github.com> Date: Mon, 14 Nov 2022 15:05:53 +0200 Subject: [PATCH 4/4] update(docs): update changelog to Universum 0.19.14 --- CHANGELOG.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 062f0a7e..0ea21a2d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,15 @@ Change log ========== +0.19.14 (2022-11-14) +-------------------- + +New features +~~~~~~~~~~~~ + +* **main:** add option to return non-zero code if any step fails + + 0.19.13 (2022-10-10) --------------------