opentf-toolkit-nightly 0.63.0.dev1393__py3-none-any.whl → 0.63.0.dev1404__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opentf/scripts/startup.py +15 -14
- opentf/toolkit/channels.py +28 -15
- {opentf_toolkit_nightly-0.63.0.dev1393.dist-info → opentf_toolkit_nightly-0.63.0.dev1404.dist-info}/METADATA +1 -1
- {opentf_toolkit_nightly-0.63.0.dev1393.dist-info → opentf_toolkit_nightly-0.63.0.dev1404.dist-info}/RECORD +7 -7
- {opentf_toolkit_nightly-0.63.0.dev1393.dist-info → opentf_toolkit_nightly-0.63.0.dev1404.dist-info}/WHEEL +1 -1
- {opentf_toolkit_nightly-0.63.0.dev1393.dist-info → opentf_toolkit_nightly-0.63.0.dev1404.dist-info}/licenses/LICENSE +0 -0
- {opentf_toolkit_nightly-0.63.0.dev1393.dist-info → opentf_toolkit_nightly-0.63.0.dev1404.dist-info}/top_level.txt +0 -0
opentf/scripts/startup.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
"""Startup script for allinone images."""
|
|
16
16
|
|
|
17
|
-
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
17
|
+
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
|
18
18
|
|
|
19
19
|
from datetime import datetime
|
|
20
20
|
from importlib.metadata import version
|
|
@@ -64,6 +64,7 @@ ENVIRONMENT_VARIABLES = {
|
|
|
64
64
|
'OPENTF_BASE_URL': None,
|
|
65
65
|
'OPENTF_CONTEXT': 'allinone',
|
|
66
66
|
'OPENTF_DEBUG': 'INFO',
|
|
67
|
+
'OPENTF_DISABLED_PLUGINS': None,
|
|
67
68
|
'OPENTF_EVENTBUS_WARMUPDELAY': 2,
|
|
68
69
|
'OPENTF_EVENTBUS_WARMUPURL': 'http://127.0.0.1:38368/subscriptions',
|
|
69
70
|
'OPENTF_EVENTBUSCONFIG': 'conf/eventbus.yaml',
|
|
@@ -220,7 +221,7 @@ SERVICES = set()
|
|
|
220
221
|
|
|
221
222
|
|
|
222
223
|
def parse_and_start(
|
|
223
|
-
paths: List[str], item: str, disabled: Optional[
|
|
224
|
+
paths: List[str], item: str, disabled: Optional[Set[str]] = None
|
|
224
225
|
) -> List[Any]:
|
|
225
226
|
"""Lookup item manifests and start them if not disabled."""
|
|
226
227
|
result = []
|
|
@@ -301,7 +302,7 @@ def maybe_start_otelcol():
|
|
|
301
302
|
else ''
|
|
302
303
|
)
|
|
303
304
|
cmd = '"/usr/local/bin/otelcol --config=file:/app/otelcol-config.yaml $OTELCOL_EXTRA_OPTIONS"'
|
|
304
|
-
logging.info(
|
|
305
|
+
logging.info('Starting OpenTelemetry Collector%s...', options_msg)
|
|
305
306
|
pid = subprocess.Popen(f'sh -c {cmd}', shell=True)
|
|
306
307
|
logging.debug('(pid is %d.)', pid.pid)
|
|
307
308
|
return [pid]
|
|
@@ -389,17 +390,17 @@ def start_services(conf: Dict[str, Any]) -> List[Any]:
|
|
|
389
390
|
|
|
390
391
|
def start_plugins(conf: Dict[str, Any]) -> List[Any]:
|
|
391
392
|
"""Lookup plugins and start them."""
|
|
392
|
-
|
|
393
|
-
disabled = [plugin.lower() for plugin in disabled]
|
|
394
|
-
else:
|
|
395
|
-
disabled = []
|
|
393
|
+
disabled = set(conf.get('disabled', {}))
|
|
396
394
|
if (v := _get_env('OPENTF_ALLURE_ENABLED')) is None or (
|
|
397
395
|
v.lower() not in ('true', 'yes', 'on', '1')
|
|
398
396
|
):
|
|
399
|
-
disabled.
|
|
400
|
-
disabled.
|
|
397
|
+
disabled.add('allure.collector')
|
|
398
|
+
disabled.add('result.aggregator')
|
|
399
|
+
if v := _get_env('OPENTF_DISABLED_PLUGINS'):
|
|
400
|
+
disabled |= set(v.split(','))
|
|
401
401
|
if aggregated := conf.get('aggregated'):
|
|
402
|
-
disabled
|
|
402
|
+
disabled |= set(aggregated)
|
|
403
|
+
disabled = {plugin.strip().lower() for plugin in disabled if plugin.strip()}
|
|
403
404
|
plugins = []
|
|
404
405
|
for entry in conf['plugins']:
|
|
405
406
|
plugins += parse_and_start(_expand(entry), PLUGIN_DESCRIPTOR, disabled)
|
|
@@ -523,10 +524,10 @@ def _ensure_abac_if_defined(name, value):
|
|
|
523
524
|
if value:
|
|
524
525
|
if not OPENTF_AUTHORIZATION_MODE:
|
|
525
526
|
logging.error(
|
|
526
|
-
'
|
|
527
|
-
' OPENTF_AUTHORIZATION_MODE must include "ABAC" to use
|
|
528
|
-
|
|
529
|
-
|
|
527
|
+
'%s is defined but OPENTF_AUTHORIZATION_MODE is undefined.'
|
|
528
|
+
' OPENTF_AUTHORIZATION_MODE must include "ABAC" to use %s.',
|
|
529
|
+
name,
|
|
530
|
+
name,
|
|
530
531
|
)
|
|
531
532
|
sys.exit(1)
|
|
532
533
|
if 'ABAC' not in OPENTF_AUTHORIZATION_MODE.split(','):
|
opentf/toolkit/channels.py
CHANGED
|
@@ -210,26 +210,31 @@ def _add_default_variables(
|
|
|
210
210
|
script.append(VARIABLE_MAKER[runner_os]('CI', 'true'))
|
|
211
211
|
|
|
212
212
|
|
|
213
|
-
def
|
|
213
|
+
def get_opentf_variables_path(metadata: Dict[str, Any]) -> str:
|
|
214
214
|
return VARIABLES_TEMPLATE[metadata['channel_os']].format(
|
|
215
215
|
job_id=metadata['job_id'], root=metadata['channel_temp']
|
|
216
216
|
)
|
|
217
217
|
|
|
218
218
|
|
|
219
|
-
def
|
|
219
|
+
def _read_opentf_variables(lines: List[str]) -> Dict[str, str]:
|
|
220
220
|
variables = {}
|
|
221
|
+
for line in lines:
|
|
222
|
+
if '=' not in line:
|
|
223
|
+
continue
|
|
224
|
+
line = line.strip()
|
|
225
|
+
if set_export := OPENTF_VARIABLES_REGEX.match(line):
|
|
226
|
+
line = set_export.group(2)
|
|
227
|
+
if line.startswith('"'):
|
|
228
|
+
line = line[1:-1]
|
|
229
|
+
key, _, value = line.partition('=')
|
|
230
|
+
if OPENTF_VARIABLES_NAME_REGEX.match(key):
|
|
231
|
+
variables[key] = value
|
|
232
|
+
return variables
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _get_opentf_variables(path: str) -> Dict[str, str]:
|
|
221
236
|
with open(path, 'r') as f:
|
|
222
|
-
|
|
223
|
-
if '=' not in line:
|
|
224
|
-
continue
|
|
225
|
-
line = line.strip()
|
|
226
|
-
if set_export := OPENTF_VARIABLES_REGEX.match(line):
|
|
227
|
-
line = set_export.group(2)
|
|
228
|
-
if line.startswith('"'):
|
|
229
|
-
line = line[1:-1]
|
|
230
|
-
key, _, value = line.partition('=')
|
|
231
|
-
if OPENTF_VARIABLES_NAME_REGEX.match(key):
|
|
232
|
-
variables[key] = value
|
|
237
|
+
variables = _read_opentf_variables(f.readlines())
|
|
233
238
|
try:
|
|
234
239
|
os.remove(path)
|
|
235
240
|
except FileNotFoundError:
|
|
@@ -428,6 +433,7 @@ def process_output(
|
|
|
428
433
|
jobstate: JobState,
|
|
429
434
|
_get: Callable[[str, str], None],
|
|
430
435
|
_put: Callable[[str, str], None],
|
|
436
|
+
variables: Optional[List[str]] = None,
|
|
431
437
|
) -> Dict[str, Any]:
|
|
432
438
|
"""Process output, filling structures.
|
|
433
439
|
|
|
@@ -566,8 +572,14 @@ def process_output(
|
|
|
566
572
|
if metadata.get('artifacts'):
|
|
567
573
|
del metadata['artifacts']
|
|
568
574
|
|
|
575
|
+
opentf_variables = None
|
|
569
576
|
if metadata['step_sequence_id'] != CHANNEL_RELEASE:
|
|
570
|
-
|
|
577
|
+
if variables:
|
|
578
|
+
opentf_variables = _read_opentf_variables(variables)
|
|
579
|
+
else:
|
|
580
|
+
_attach(
|
|
581
|
+
get_opentf_variables_path(metadata), f'type={OPENTF_VARIABLES_TYPE}'
|
|
582
|
+
)
|
|
571
583
|
|
|
572
584
|
result = make_event(EXECUTIONRESULT, metadata=metadata, status=resp)
|
|
573
585
|
if outputs:
|
|
@@ -579,7 +591,8 @@ def process_output(
|
|
|
579
591
|
result['metadata']['attachments'] = attachments_metadata
|
|
580
592
|
if has_artifacts:
|
|
581
593
|
result['metadata']['upload'] = resp
|
|
582
|
-
|
|
594
|
+
if opentf_variables:
|
|
595
|
+
result['variables'] = opentf_variables
|
|
583
596
|
return result
|
|
584
597
|
|
|
585
598
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opentf-toolkit-nightly
|
|
3
|
-
Version: 0.63.0.
|
|
3
|
+
Version: 0.63.0.dev1404
|
|
4
4
|
Summary: OpenTestFactory Orchestrator Toolkit
|
|
5
5
|
Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
|
|
6
6
|
Author: Martin Lafaix
|
|
@@ -56,13 +56,13 @@ opentf/schemas/opentestfactory.org/v1beta1/ServiceConfig.json,sha256=m5ZgWAKbutu
|
|
|
56
56
|
opentf/schemas/opentestfactory.org/v1beta1/Workflow.json,sha256=QZ8mM9PhzsI9gTmwmKTWYNoRn--rtcM3L0PzgnPBfMU,15424
|
|
57
57
|
opentf/schemas/opentestfactory.org/v1beta2/ServiceConfig.json,sha256=rEvK2YWL5lG94_qYgR_GnLWNsaQhaQ-2kuZdWJr5NnY,3517
|
|
58
58
|
opentf/scripts/launch_java_service.sh,sha256=S0jAaCuv2sZy0Gf2NGBuPX-eD531rcM-b0fNyhmzSjw,2423
|
|
59
|
-
opentf/scripts/startup.py,sha256=
|
|
59
|
+
opentf/scripts/startup.py,sha256=DLanDaXutUTYcG2PwoJ34QH-5G0TwfLUY_xy1VkVOqA,23202
|
|
60
60
|
opentf/toolkit/__init__.py,sha256=YnH66dmePAIU7dq_xWFYTIEUrsL9qV9f82LRDiBzbzs,22057
|
|
61
|
-
opentf/toolkit/channels.py,sha256=
|
|
61
|
+
opentf/toolkit/channels.py,sha256=7uHpQUCWCzSxcQifeUL9SB9fvsq6_9cZt_8IdBgw8FQ,26272
|
|
62
62
|
opentf/toolkit/core.py,sha256=jMBDIYZ8Qn3BvsysfKoG0iTtjOnZsggetpH3eXygCsI,9636
|
|
63
63
|
opentf/toolkit/models.py,sha256=PNfXVQbeyOwDfaNrLjcfhYm6duMSlNWBtZsWZcs53ag,6583
|
|
64
|
-
opentf_toolkit_nightly-0.63.0.
|
|
65
|
-
opentf_toolkit_nightly-0.63.0.
|
|
66
|
-
opentf_toolkit_nightly-0.63.0.
|
|
67
|
-
opentf_toolkit_nightly-0.63.0.
|
|
68
|
-
opentf_toolkit_nightly-0.63.0.
|
|
64
|
+
opentf_toolkit_nightly-0.63.0.dev1404.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
65
|
+
opentf_toolkit_nightly-0.63.0.dev1404.dist-info/METADATA,sha256=e5Yk6R0U0-fHJQtr-EBn1kD1EqdiUVBpSnCvYBoTiLA,2215
|
|
66
|
+
opentf_toolkit_nightly-0.63.0.dev1404.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
67
|
+
opentf_toolkit_nightly-0.63.0.dev1404.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
|
|
68
|
+
opentf_toolkit_nightly-0.63.0.dev1404.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|