Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ variables:
GRADLE_VERSION: "8.14.4" # must match gradle-wrapper.properties
MAVEN_REPOSITORY_PROXY: "https://depot-read-api-java.us1.ddbuild.io/magicmirror/magicmirror/@current/"
GRADLE_PLUGIN_PROXY: "https://depot-read-api-java.us1.ddbuild.io/magicmirror/magicmirror/@current/"
BUILDER_IMAGE_VERSION_PREFIX: "v26.02-" # use either an empty string (e.g. "") for latest images or a version followed by a hyphen (e.g. "v25.05-")
BUILDER_IMAGE_VERSION_PREFIX: "v26.03-" # use either an empty string (e.g. "") for latest images or a version followed by a hyphen (e.g. "v25.05-")
REPO_NOTIFICATION_CHANNEL: "#apm-java-escalations"
DEFAULT_TEST_JVMS: /^(8|11|17|21|25|tip)$/ # the latest "tip" version is 26
PROFILE_TESTS:
Expand Down
50 changes: 50 additions & 0 deletions .gitlab/add_final_status.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- Identity transform: copy everything as-is by default -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<!-- For testcase elements missing dd_tags[test.final_status] inside their properties block -->
<xsl:template match="testcase[not(properties/property[@name='dd_tags[test.final_status]'])]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:variable name="status">
<xsl:choose>
<xsl:when test="failure or error">fail</xsl:when>
<xsl:when test="skipped">skip</xsl:when>
<xsl:otherwise>pass</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="properties">
<!-- Inject into existing properties block, preserving child order -->
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="self::properties">
<properties>
<xsl:apply-templates select="@*|node()"/>
<property name="dd_tags[test.final_status]" value="{$status}"/>
</properties>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<!-- No properties block: create one before other children -->
<properties>
<property name="dd_tags[test.final_status]" value="{$status}"/>
</properties>
<xsl:apply-templates select="node()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:copy>
</xsl:template>

</xsl:stylesheet>
14 changes: 14 additions & 0 deletions .gitlab/upload_ciapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,20 @@ coverage_upload() {
datadog-ci coverage upload --ignored-paths=./test-published-dependencies .
}

add_final_status_tags() {
echo "Add dd_tags[test.final_status] property to each testcase before upload"
local xsl_file
xsl_file="$(dirname "$0")/add_final_status.xsl"
find ./results -name '*.xml' | while read -r xml_file; do
local tmp_file
tmp_file="$(mktemp)"
xsltproc --output "$tmp_file" "$xsl_file" "$xml_file"
mv "$tmp_file" "$xml_file"
done
}

add_final_status_tags

# Upload test results to production environment like all other CI jobs
junit_upload "$DATADOG_API_KEY_PROD"
junit_upload_status=$?
Expand Down