Skip to content

Commit c22a026

Browse files
petertrrsonartech
authored andcommitted
SONARTEXT-304 Flatten directory structure of Reports
1 parent 8d11593 commit c22a026

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.cirrus/modules/build.star

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ load(
1616
load(
1717
"github.com/SonarSource/cirrus-modules/cloud-native/actions.star@analysis/master",
1818
"default_gradle_on_failure",
19+
"gradle_junit_xml_report_artifacts"
1920
)
2021

22+
2123
# SHARED CANDIDATE?
2224
# Looks like : https://github.com/SonarSource/sonar-iac/blob/153aed5008efac5ff1bbb0014672e653194ee79b/.cirrus/modules/build.star#L48
2325
def build_env():
@@ -59,7 +61,22 @@ def build_task():
5961
"path": "build/reports/profile/profile-*.html"
6062
}
6163
},
62-
"on_failure": default_gradle_on_failure(),
64+
"on_failure": {
65+
"junit_artifacts": gradle_junit_xml_report_artifacts(),
66+
"flatten_report_script": [
67+
# language=bash
68+
"""
69+
find . -type d -path \\*/build/reports/tests | while read -r test_dir; do
70+
project_name=$(basename $(realpath ${test_dir}/../../..))
71+
mkdir -p ${project_name}-test-report
72+
cp -r "${test_dir}"/test/* ${project_name}-test-report
73+
done
74+
"""
75+
],
76+
"flattened_report_artifacts": {
77+
"path": "*-test-report/**"
78+
}
79+
}
6380
}
6481
}
6582

0 commit comments

Comments
 (0)