Jenkins: The Link Between Stacktrace and GitLab

We use Jenkins and GitLab in our company. We use py.test to generate XML output for Jenkins, which receives the rendered jUnit Jenkins plugin.

The stack of exception stacks is pure ascii so far. It would be great if we somehow connected Jenkins and displayed hyperlinks to our gitlab server instead of the html pre-block.

In our case, it would be enough for us to filter out each line of test output and use a regular expression on it ....

Jenkins jUnit Plugin output example:

File "/home/modwork_ems_d66/src/foo/foo/utils/testutils.py", line 975, in wrapped return fn(*args, **kwargs) File "/home/modwork_ems_d66/src/foo/foo/tests/FooTest.py", line 641, in test_empty_models_if_unused models)) 

I want a hyperlink to the server hosting the git "foo" repository. In our case, it will be " https://source/repos/foo/files/master/foo/foo/tests/FooTest.py "

How to do it? I know how to use regular expressions. The question is how to associate a regex with jenkins.

Here is a screenshot to visualize it enter image description here

I want this link to TestReport for one test. URL of these pages:

 https://jenkins/job/ci_foo_bar/lastCompletedBuild/testReport/src.myapp.myapp.tests.test_tree/TestCase/test_something/ 
+8
python gitlab jenkins
source share
1 answer

If you can get an exception output after the testing process, you can implement a parser that prepares a simple html report for you as a build step.

And the easiest way to implement just a regular expression with sed, for example

 sed -e 's@"/home/modwork_ems_d66/src\(.*\?\)"@<a href="https://source/repos/foo/files/master\1">\1</a>@' exceptions.txt 

which works with the exception file.

+3
source share

All Articles