Skip to content

Commit

Permalink
Merge branch 'v1/dev' into v1/stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Meggle committed Mar 26, 2024
2 parents 2bfd5a9 + ae79749 commit d221cdc
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ git config --global --add safe.directory $WORKSPACE
# get the current tag (Release) or commit hash (Artifact)
#export RMK_VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
# dirty hack - won't spent more time into this...
export RMK_VERSION="1.4.3"
export RMK_VERSION="1.4.3.1"

echo "▹ Removing old packages..."
rm -f $OMD_ROOT/var/check_mk/packages/*
Expand Down Expand Up @@ -64,7 +64,7 @@ if [ -n "${GITHUB_WORKSPACE-}" ]; then
echo "::set-output name=pkgfile::$NEWFILENAME"
# echo "::set-output name=pkgname::${NAME}"
# dirty hack - won't spent more time into this...
VERSION="1.4.3"
VERSION="1.4.3.1"
# echo "::set-output name=pkgversion::$RMK_VERSION"
# echo "::set-output name=cmkmversion::$MVERSION"
echo "::set-output name=artifactname::$NEWFILENAME"
Expand Down
109 changes: 109 additions & 0 deletions .vscode/v2/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "devc V2.x bakery localhost",
"type": "python",
"request": "launch",
"program": "/omd/sites/cmk/bin/cmk",
"args": [
"-A",
"-v",
"-f",
"localhost"
],
"console": "integratedTerminal",
"python": "/omd/sites/cmk/bin/python3",
// allow to inspect also foreign code
"justMyCode": false
},
{
"name": "devc V2.x bakery win10simdows",
"type": "python",
"request": "launch",
"program": "/omd/sites/cmk/bin/cmk",
"args": [
"-A",
"-v",
"-f",
"win10simdows"
],
"console": "integratedTerminal",
"python": "/omd/sites/cmk/bin/python3",
// allow to inspect also foreign code
"justMyCode": false
},
{
"name": "devc V2.x Inventory localhost",
"type": "python",
"request": "launch",
"program": "/omd/sites/cmk/bin/cmk",
"args": [
"-v",
"-II",
"--debug",
"localhost"
],
"console": "integratedTerminal",
"python": "/omd/sites/cmk/bin/python3",
// allow to inspect also foreign code
"justMyCode": false
},
{
"name": "devc V2.x Inventory localfoo",
"type": "python",
"request": "launch",
"program": "/omd/sites/cmk/bin/cmk",
"args": [
"-v",
"-II",
"--debug",
"localfoo"
],
"console": "integratedTerminal",
"python": "/omd/sites/cmk/bin/python3",
// allow to inspect also foreign code
"justMyCode": false
},
{
"name": "devc V2.x check localhost",
"type": "python",
"request": "launch",
"program": "/omd/sites/cmk/bin/cmk",
"args": [
"-v",
"-n",
"-p",
"localhost"
],
"console": "integratedTerminal",
"python": "/omd/sites/cmk/bin/python3",
// allow to inspect also foreign code
"justMyCode": false
},
{
"name": "devc V2.x check localfoo",
"type": "python",
"request": "launch",
"program": "/omd/sites/cmk/bin/cmk",
"args": [
"-v",
"-n",
"-p",
"localfoo"
],
"console": "integratedTerminal",
"python": "/omd/sites/cmk/bin/python3",
// allow to inspect also foreign code
"justMyCode": false
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
},
]
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.4.3.1 - 2024-03-26

### Fixed

* Relative library/resource imports did not work properly in past versions, because the Robot Framework suite wasn't executed in the suite base directory.
* Disabling suite execution by placing a `DISABLED` file did not work when a .robot file was executed instead of a directory.
* Fixed a bug in pathdir function.
* Incremental re-execution strategy did not merge results when suite finally ended OK.

## 1.4.3 - 2024-03-11

Expand Down
58 changes: 30 additions & 28 deletions agents_plugins/robotmk.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

local_tz = datetime.utcnow().astimezone().tzinfo

ROBOTMK_VERSION = '1.4.3'
ROBOTMK_VERSION = '1.4.3.1'


class RMKConfig:
Expand Down Expand Up @@ -530,27 +530,23 @@ def execute(self):
rc = self.env_strategy.run()
self._runner.loginfo(f" < RC: {rc}")

if max_exec == 1 or (max_exec > 1 and rc == 0):
# get out of here if
# - re-execution is not enabled OR
# - first attempt was successful
break
else:
# re-execution possible, check if we should
if rc == 0:
# retry was OK, get out here
self.reexecution_strategy.finalize_results()
break
if max_exec == 1:
break # no re-execution strategy needed

if rc == 0:
# retry was OK, get out here
self.reexecution_strategy.finalize_results()
break
else:
# retry was not OK, try again
if attempt < max_exec:
self.reexecution_strategy.reparametrize_robot()
else:
if attempt < max_exec:
# Chance for next try: set reexecution params according to strategy
self.reexecution_strategy.reparametrize_robot()
else:
# ...GAME OVER! => MERGE
self._runner.loginfo(
" Even the last attempt was unsuccessful!"
)
self.reexecution_strategy.finalize_results()
# ...GAME OVER! => MERGE
self._runner.loginfo(
" Even the last attempt was unsuccessful!"
)
self.reexecution_strategy.finalize_results()

self.set_statevars(
[
Expand Down Expand Up @@ -602,15 +598,15 @@ def get_suite_or_global(self, name, default=None):
@property
def is_disabled_by_flagfile(self):
# if disabled flag file exists, return True
return self.path.joinpath("DISABLED").exists()
return self.pathdir.joinpath("DISABLED").exists()

@property
def get_disabled_reason(self):
# If disabled flag file exists, return the content.
# Otherwise return default message.
if self.is_disabled_by_flagfile:
try:
with open(self.path.joinpath("DISABLED"), "r") as f:
with open(self.pathdir.joinpath("DISABLED"), "r") as f:
reason = f.read()
if len(reason) > 0:
return "Reason: " + reason
Expand All @@ -630,7 +626,7 @@ def path(self):
def pathdir(self):
"""The absolute path of the Robot test directory,
built from the robotdir and the DIRECTORY of the path given in WATO"""
if self.path.is_dir:
if self.path.is_dir():
return self.path
else:
return self.path.parent
Expand Down Expand Up @@ -890,7 +886,14 @@ def run(self):
cli_args = self.prepare_rf_args()
cli_args.append(str(self._suite.path))
self._suite.logger.debug(f"Robot arguments: {' '.join(cli_args)}")
# Change to the suite root directory so that relative imports work
curdir = os.getcwd()
suite_rootdir = Path(self._suite.global_dict['robotdir']) / Path(self._suite.suite_dict["path"]).parts[0]
self._suite.logger.debug(f"Chdir to: {suite_rootdir}")
os.chdir(suite_rootdir)
rc = robot.run_cli(cli_args, exit=False)
self._suite.logger.debug(f"Chdir to: {curdir}")
os.chdir(curdir)
return rc


Expand Down Expand Up @@ -1217,16 +1220,15 @@ def update_runner_statevars(self):
]
)
runtime_robotmk = runtime_total - runtime_suites

self.set_statevars(
[
runtimes = [
("runtime_total", runtime_total),
("runtime_suites", runtime_suites),
("runtime_robotmk", runtime_robotmk),
# ('suites', suites),
("selective_run", self.selective_run),
]
)
self.loginfo("runtimes: " + str(runtimes))
self.set_statevars(runtimes)
if self.execution_mode == "agent_serial":
self.set_statevars(
[
Expand Down
2 changes: 1 addition & 1 deletion bakery/robotmk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
# This file is part of the Robotmk project (https://www.robotmk.org)

ROBOTMK_VERSION = '1.4.3'
ROBOTMK_VERSION = '1.4.3.1'

from typing import Iterable, TypedDict, List
from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion checks/robotmk.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from cmk.base.plugins.agent_based.agent_based_api.v1 import *
from cmk.utils.exceptions import MKGeneralException

ROBOTMK_VERSION = '1.4.3'
ROBOTMK_VERSION = '1.4.3.1'
DEFAULT_SVC_PREFIX = 'Robot Framework E2E $SUITEID$SPACE-$SPACE'
HTML_LOG_DIR = "%s/%s" % (os.environ['OMD_ROOT'], 'var/robotmk')

Expand Down

0 comments on commit d221cdc

Please sign in to comment.