Skip to content

Commit

Permalink
Universum 0.19.14
Browse files Browse the repository at this point in the history
  • Loading branch information
k-dovgan committed Nov 14, 2022
2 parents 5c207ec + d8660be commit 184a711
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 3 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -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)
--------------------

Expand Down
4 changes: 2 additions & 2 deletions doc/jenkins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <main domain>
<server IP> <resource domain>

And add the following lines to client ``/ets/host`` file::
And add the following lines to client ``/ets/hosts`` file::

<server IP> <main domain>
<server IP> <resource domain>
Expand Down
29 changes: 29 additions & 0 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

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.13"
__version__ = "0.19.14"
8 changes: 8 additions & 0 deletions universum/modules/reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 184a711

Please sign in to comment.