INTO-CPS-Association / DTaaS

:factory: :left_right_arrow: :busts_in_silhouette: Digital Twin as a Service
https://into-cps-association.github.io/DTaaS/
Other
116 stars 57 forks source link

[BUG] ANSI control characters in digital twin execution logs #971

Open prasadtalasila opened 1 month ago

prasadtalasila commented 1 month ago

Describe the bug

The Digital Twins Preview page has Log button to show execution logs of a digital twin. This log has ANSI control characters that need be removed. A sample log is here.

create_mass-spring-damper

Running with gitlab-runner 17.3.1 (66269445)
  on dtaas _ovdZwuzX, system ID: s_0a5b507aa2c7
section_start:1728713779:prepare_executor
Preparing the "docker" executor
Using Docker executor with image ubuntu:20.04 ...
Pulling docker image ubuntu:20.04 ...
Using docker image sha256:9522b5ff29b80fb026c27040cc14b743d714a57f3ca4cff1c76c9e59ca244163 for ubuntu:20.04 with digest ubuntu@sha256:6d8d9799fe6ab3221965efac00b4c34a2bcc102c086a58dff9e19a08b913c7ef ...
section_end:1728713782:prepare_executor
section_start:1728713782:prepare_script
Preparing environment
Running on runner-ovdzwuzx-project-8-concurrent-0 via dtaas...
section_end:1728713782:prepare_script

To Reproduce

Steps to reproduce the behavior:

  1. Make sure that a valid gitlab repository exists. For example, if your username is "freya", then a gitlab project must be avalable at REACT_APP_AUTH_AUTHORITY/dtaas/freya
  2. Make sure that a live Gitlab runner is available for this gitlab project.
  3. Log into the react website and go to Digital Twins Preview Page
  4. Click on start button of any digital twin and wait for it to complete the execution
  5. See the logs by clicking on log button

Expected behavior

The ANSI control characters should be removed from the logs and a sample log could be

create_mass-spring-damper

Running with gitlab-runner 17.3.1 (66269445)
  on dtaas _ovdZwuzX, system ID: s_0a5b507aa2c7

prepare_executor
Preparing the "docker" executor
Using Docker executor with image ubuntu:20.04 ...
Pulling docker image ubuntu:20.04 ...
Using docker image sha256:9522b5ff29b80fb026c27040cc14b743d714a57f3ca4cff1c76c9e59ca244163 for ubuntu:20.04 with digest ubuntu@sha256:6d8d9799fe6ab3221965efac00b4c34a2bcc102c086a58dff9e19a08b913c7ef ...
section_end:1728713782:prepare_executor
section_start:1728713782:prepare_script
Preparing environment
Running on runner-ovdzwuzx-project-8-concurrent-0 via dtaas...
section_end:1728713782:prepare_script

Application Environment

The behavior can be seen on all OS, all browsers and code on caa92c2fba commit

Additional context

strip-ansi npm library solves the problem but it throws up a Jest SyntaxError. Please see issue #902

prasadtalasila commented 1 week ago

This problem gets solved using strip-ansi but tests fail if this package is used. Please see issue #902