opentf-toolkit-nightly 0.58.0.dev1175__py3-none-any.whl → 0.58.0.dev1180__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.
@@ -180,13 +180,17 @@ def _add_default_variables(
180
180
 
181
181
 
182
182
  def _make_attachment_url(
183
- metadata: Dict[str, Any], remote: str, separator: str, workflow_result: bool = False
184
- ) -> Tuple[str, Dict[str, Any]]:
183
+ metadata: Dict[str, Any],
184
+ remote: str,
185
+ separator: str,
186
+ workflow_result: bool = False,
187
+ name: Optional[str] = None,
188
+ ) -> Tuple[str, str]:
185
189
  uuid = make_uuid()
186
190
  prefix = metadata['workflow_id'] if workflow_result else metadata['job_id']
187
191
  suffix = 'WR' if workflow_result else metadata['step_sequence_id']
188
- url = f'/tmp/{prefix}-{uuid}_{suffix}_{remote.split(separator)[-1]}'
189
- return url, {'uuid': uuid}
192
+ url = f'/tmp/{prefix}-{uuid}_{suffix}_{name or remote.split(separator)[-1]}'
193
+ return url, uuid
190
194
 
191
195
 
192
196
  ## masks helpers
@@ -295,13 +299,11 @@ def process_output(
295
299
  May raise exceptions.
296
300
  """
297
301
 
298
- def _attach(remote: str, args: str):
302
+ def _attach(remote: str, args: str, is_artefact: bool = False):
299
303
  if is_windows:
300
304
  remote = ntpath.normpath(remote)
301
305
  try:
302
- attachment_url, details = _make_attachment_url(
303
- metadata, remote, separator, upload
304
- )
306
+ details = {}
305
307
  if args:
306
308
  for parameter in args.strip().split(','):
307
309
  if '=' not in parameter:
@@ -311,6 +313,10 @@ def process_output(
311
313
  return 2
312
314
  key, _, value = parameter.strip().partition('=')
313
315
  details[key] = value
316
+ attachment_url, uuid = _make_attachment_url(
317
+ metadata, remote, separator, is_artefact, name=details.get('name')
318
+ )
319
+ details['uuid'] = uuid
314
320
  _get(remote, attachment_url)
315
321
  attachments_metadata[attachment_url] = details
316
322
  attachments.append(attachment_url)
@@ -347,7 +353,7 @@ def process_output(
347
353
  attachments: List[str] = []
348
354
  attachments_metadata = {}
349
355
 
350
- upload = False
356
+ has_artefacts = False
351
357
  for line in stdout:
352
358
  # Parsing stdout for workflow commands
353
359
  if jobstate.stop_command:
@@ -358,8 +364,8 @@ def process_output(
358
364
  if wcmd := ATTACH_COMMAND.match(line):
359
365
  resp = _attach(wcmd.group(2), wcmd.group(1))
360
366
  elif wcmd := UPLOAD_COMMAND.match(line):
361
- upload = True
362
- resp = _attach(wcmd.group(2), wcmd.group(1))
367
+ has_artefacts = True
368
+ resp = _attach(wcmd.group(2), wcmd.group(1), is_artefact=True)
363
369
  elif wcmd := PUT_FILE_COMMAND.match(line):
364
370
  resp = _putfile(wcmd.group(2), wcmd.group(1))
365
371
  elif wcmd := SETOUTPUT_COMMAND.match(line):
@@ -383,7 +389,7 @@ def process_output(
383
389
  if attachments:
384
390
  result['attachments'] = attachments
385
391
  result['metadata']['attachments'] = attachments_metadata
386
- if upload:
392
+ if has_artefacts:
387
393
  result['metadata']['upload'] = resp
388
394
  return result
389
395
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentf-toolkit-nightly
3
- Version: 0.58.0.dev1175
3
+ Version: 0.58.0.dev1180
4
4
  Summary: OpenTestFactory Orchestrator Toolkit
5
5
  Home-page: https://gitlab.com/henixdevelopment/open-source/opentestfactory/python-toolkit
6
6
  Author: Martin Lafaix
@@ -55,10 +55,10 @@ opentf/schemas/opentestfactory.org/v1beta2/ServiceConfig.json,sha256=rEvK2YWL5lG
55
55
  opentf/scripts/launch_java_service.sh,sha256=S0jAaCuv2sZy0Gf2NGBuPX-eD531rcM-b0fNyhmzSjw,2423
56
56
  opentf/scripts/startup.py,sha256=sggwEpMx7PTaSgYzs-2uCF5YZzpsncMyTlfF_G60CrE,21518
57
57
  opentf/toolkit/__init__.py,sha256=mYeJPZ92ulbTBItqEsZgF4nnuRh6G19QPY3Jxc92ifc,23028
58
- opentf/toolkit/channels.py,sha256=bAUo0FRNljkjgTkWqSJljsNeMSX21LLLZP-TS4cw1oo,18996
58
+ opentf/toolkit/channels.py,sha256=DUP3tBSp7sjq49SwglobG92MO2zX0vdiHGYx0ms30yA,19182
59
59
  opentf/toolkit/core.py,sha256=6nud1vqcfjs9swZu_Z-rbvdbejtrlSjOd8eZXIF0ChE,9795
60
- opentf_toolkit_nightly-0.58.0.dev1175.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
61
- opentf_toolkit_nightly-0.58.0.dev1175.dist-info/METADATA,sha256=vQyE_Xbm3TYlJUJzcKQTAkpBt2TEgA5sLrNYayfzS_s,1940
62
- opentf_toolkit_nightly-0.58.0.dev1175.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
63
- opentf_toolkit_nightly-0.58.0.dev1175.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
64
- opentf_toolkit_nightly-0.58.0.dev1175.dist-info/RECORD,,
60
+ opentf_toolkit_nightly-0.58.0.dev1180.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
61
+ opentf_toolkit_nightly-0.58.0.dev1180.dist-info/METADATA,sha256=wDWRLuO2YWTW-f40gYSVaGSBBKNw2nssncPMs1wtReo,1940
62
+ opentf_toolkit_nightly-0.58.0.dev1180.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
63
+ opentf_toolkit_nightly-0.58.0.dev1180.dist-info/top_level.txt,sha256=_gPuE6GTT6UNXy1DjtmQSfCcZb_qYA2vWmjg7a30AGk,7
64
+ opentf_toolkit_nightly-0.58.0.dev1180.dist-info/RECORD,,