You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2020/05/01 22:16:56 UTC
[cassandra-builds] branch master updated: Generate Jenkins Test
Results Report in plaintext
This is an automated email from the ASF dual-hosted git repository.
mck pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cassandra-builds.git
The following commit(s) were added to refs/heads/master by this push:
new 28cb8fb Generate Jenkins Test Results Report in plaintext
28cb8fb is described below
commit 28cb8fbc19c72488f2baa5decaed8bab8c5d0dd5
Author: mck <mc...@apache.org>
AuthorDate: Thu Apr 30 18:22:19 2020 +0200
Generate Jenkins Test Results Report in plaintext
The cassandra-test-report.sh script delegates to a docker image that has the saxonb-xslt and html2text tools available.
(Using xslt inside of ant, ie with xalan, wasn't practical due to the size of the test xml report)
patch by Mick Semb Wever; reviewed by David Capwell for CASSANDRA-1572
---
build-scripts/cassandra-test-report.sh | 24 +++-------------------
build-scripts/cassandra-test-report.xml | 8 +++++---
.../jenkins/generate_plaintext_test_report.docker | 23 +++++++++++++++++++++
jenkins-dsl/cassandra_pipeline.groovy | 4 ++--
4 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/build-scripts/cassandra-test-report.sh b/build-scripts/cassandra-test-report.sh
old mode 100644
new mode 100755
index b592a7c..d3b6d52
--- a/build-scripts/cassandra-test-report.sh
+++ b/build-scripts/cassandra-test-report.sh
@@ -1,26 +1,8 @@
#!/bin/bash -x
-################################
-#
-# Prep
-#
-################################
-
-# TODO move this script into a docker image so these tools are available
-#sudo apt install -y html2text libsaxonb-java
-
-################################
-#
-# Main
-#
-################################
-
-set +e # disable immediate exit from this point
-
# merge all the unit test xml files into one TESTS-TestSuites.xml file
ant -f ./cassandra-builds/build-scripts/cassandra-test-report.xml
-# xslt transform, convert to plaintext, and truncate (ASF ML limit is 1MB), to the cassandra-test-report.txt file
-
-# uncomment once these tools are available inside a docker container
-#saxonb-xslt -s:TESTS-TestSuites.xml -xsl:./cassandra-builds/build-scripts/cassandra-test-report.xsl | html2text -nobs -style pretty | head -c 900KB > cassandra-test-report.txt
+# perform the xslt and plaintext transformation inside a docker container
+docker build --tag apache_cassandra_ci/generate_plaintext_test_report -f cassandra-builds/docker/jenkins/generate_plaintext_test_report.docker .
+docker run --rm -v `pwd`:/tmp apache_cassandra_ci/generate_plaintext_test_report > cassandra-test-report.txt
diff --git a/build-scripts/cassandra-test-report.xml b/build-scripts/cassandra-test-report.xml
index a22f7db..4989c75 100644
--- a/build-scripts/cassandra-test-report.xml
+++ b/build-scripts/cassandra-test-report.xml
@@ -1,8 +1,10 @@
<project name="generate_test_report" default="generate_test_report" basedir=".">
<target name="generate_test_report">
- <junitreport todir="${basedir}">
- <fileset dir="${basedir}">
- <include name="**/TEST*.xml,**/cqlshlib.xml,**/nosetests.xml"/>
+ <junitreport todir="${user.dir}">
+ <fileset dir="${user.dir}">
+ <include name="**/TEST*.xml"/>
+ <include name="**/cqlshlib.xml"/>
+ <include name="**/nosetests.xml"/>
</fileset>
</junitreport>
</target>
diff --git a/docker/jenkins/generate_plaintext_test_report.docker b/docker/jenkins/generate_plaintext_test_report.docker
new file mode 100644
index 0000000..e30e67a
--- /dev/null
+++ b/docker/jenkins/generate_plaintext_test_report.docker
@@ -0,0 +1,23 @@
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM openjdk:14-jdk-slim
+
+RUN export DEBIAN_FRONTEND=noninteractive && \
+ apt-get update && \
+ apt-get install -y html2text libsaxonb-java
+
+COPY cassandra-builds/build-scripts/cassandra-test-report.xsl .
+VOLUME ["/tmp"]
+
+# xslt transform, convert to plaintext, and truncate (ASF ML limit is 1MB), to the cassandra-test-report.txt file
+CMD ["/bin/sh", "-c", "saxonb-xslt -s:/tmp/TESTS-TestSuites.xml -xsl:cassandra-test-report.xsl | html2text -nobs -style pretty | head -c 900KB"]
diff --git a/jenkins-dsl/cassandra_pipeline.groovy b/jenkins-dsl/cassandra_pipeline.groovy
index 96ac50d..1daad09 100644
--- a/jenkins-dsl/cassandra_pipeline.groovy
+++ b/jenkins-dsl/cassandra_pipeline.groovy
@@ -229,8 +229,8 @@ pipeline {
}
stage('Summary') {
steps {
- shell("git clean -xdff ; git clone -b ${buildsBranch} ${buildsRepo}")
- shell("./cassandra-builds/build-scripts/cassandra-test-report.sh")
+ sh "git clone https://gitbox.apache.org/repos/asf/cassandra-builds.git"
+ sh "./cassandra-builds/build-scripts/cassandra-test-report.sh"
junit 'TESTS-TestSuites.xml'
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org