File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <xsl : stylesheet version =" 1.0" xmlns : xsl =" http://www.w3.org/1999/XSL/Transform" >
3+
4+ <!-- Identity transform: copy everything as-is by default -->
5+ <xsl : template match =" @*|node()" >
6+ <xsl : copy >
7+ <xsl : apply-templates select =" @*|node()" />
8+ </xsl : copy >
9+ </xsl : template >
10+
11+ <!-- For testcase elements missing dd_tags[test.final_status] inside their properties block -->
12+ <xsl : template match =" testcase[not(properties/property[@name='dd_tags[test.final_status]'])]" >
13+ <xsl : copy >
14+ <xsl : apply-templates select =" @*" />
15+ <xsl : variable name =" status" >
16+ <xsl : choose >
17+ <xsl : when test =" failure or error" >fail</xsl : when >
18+ <xsl : when test =" skipped" >skip</xsl : when >
19+ <xsl : otherwise >pass</xsl : otherwise >
20+ </xsl : choose >
21+ </xsl : variable >
22+ <xsl : choose >
23+ <xsl : when test =" properties" >
24+ <!-- Inject into existing properties block, preserving child order -->
25+ <xsl : for-each select =" node()" >
26+ <xsl : choose >
27+ <xsl : when test =" self::properties" >
28+ <properties >
29+ <xsl : apply-templates select =" @*|node()" />
30+ <property name =" dd_tags[test.final_status]" value =" {$status}" />
31+ </properties >
32+ </xsl : when >
33+ <xsl : otherwise >
34+ <xsl : apply-templates select =" ." />
35+ </xsl : otherwise >
36+ </xsl : choose >
37+ </xsl : for-each >
38+ </xsl : when >
39+ <xsl : otherwise >
40+ <!-- No properties block: create one before other children -->
41+ <properties >
42+ <property name =" dd_tags[test.final_status]" value =" {$status}" />
43+ </properties >
44+ <xsl : apply-templates select =" node()" />
45+ </xsl : otherwise >
46+ </xsl : choose >
47+ </xsl : copy >
48+ </xsl : template >
49+
50+ </xsl : stylesheet >
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ elif command -v apt-get &> /dev/null; then
6363
6464 echo " Installing packages individually..."
6565 # Install packages one by one, continue if some fail
66- for pkg in curl jq unzip nodejs npm; do
66+ for pkg in curl jq unzip nodejs npm xsltproc ; do
6767 if ! command -v $pkg & > /dev/null; then
6868 echo " Installing $pkg ..."
6969 $use_sudo apt-get install -y $pkg || echo " Warning: Failed to install $pkg , continuing..."
@@ -186,6 +186,14 @@ echo "${junit_files}"
186186
187187mapfile -t files_array <<< " ${junit_files}"
188188
189+ echo " Add final_status property"
190+ for xml_file in " ${files_array[@]} " ; do
191+ echo " Fixing $xml_file "
192+ tmp_file=" $( mktemp) "
193+ xsltproc --output " $tmp_file " " .gitlab/add_final_status.xsl" " $xml_file "
194+ mv " $tmp_file " " $xml_file "
195+ done
196+
189197# Normalize absolute paths to relative paths in JUnit XML files
190198echo " Normalizing file paths in JUnit XML files..."
191199for file in " ${files_array[@]} " ; do
You can’t perform that action at this time.
0 commit comments