Add step to grab csit test status and archive it 54/62454/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 30 Aug 2017 14:44:31 +0000 (10:44 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Wed, 30 Aug 2017 15:06:18 +0000 (11:06 -0400)
This makes it easier for us to copy paste the info into the tracking
spreadsheet.

Change-Id: I5dba17df7e7359a6f3626ff57e4f93bae22d9b43
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
jjb/generate-csit-status-report.sh [new file with mode: 0644]
jjb/integration/integration-test-jobs.yaml
jjb/releng-macros.yaml

diff --git a/jjb/generate-csit-status-report.sh b/jjb/generate-csit-status-report.sh
new file mode 100644 (file)
index 0000000..dc87537
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2017 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+# Create a python script to parse a Jenkins build for sub-project status
+
+script=$(mktemp)
+
+cat > $script <<EOF
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2017 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+__author__ = 'Thanh Ha'
+
+
+import sys
+
+from bs4 import BeautifulSoup
+import requests
+
+
+build_url = sys.argv[1]
+urlparse = requests.utils.urlparse(build_url)
+jenkins_url = "{}://{}".format(urlparse.scheme, urlparse.netloc)
+
+page = requests.get(build_url)
+soup = BeautifulSoup(page.text, 'html.parser')
+links = soup.findAll("a", { "class" : "model-link" })
+
+_file = open('csit_failed_tests.txt', 'w+')
+
+for link in links:
+    if link.img and (link.img['alt'] == 'Unstable' or
+                     link.img['alt'] == 'Failed' or
+                     link.img['alt'] == 'Aborted'):
+
+        url = link['href']
+        project = url.split('/')[3].split('-')[0]
+        _file.write("{}\t{}{}\n".format(project, jenkins_url, url))
+
+_file.close()
+EOF
+
+virtualenv --quiet "/tmp/v/jenkins"
+# shellcheck source=/tmp/v/jenkins/bin/activate disable=SC1091
+source "/tmp/v/jenkins/bin/activate"
+pip install --quiet --upgrade pip
+pip install --quiet --upgrade tox beautifulsoup4 requests
+
+echo python "$script" "$BUILD_URL"
+python "$script" "$BUILD_URL"
+
+mkdir -p "$WORKSPACE/archives"
+mv csit_failed_tests.txt "$WORKSPACE/archives"
index 47831a176a0841e21a3e466c33036f9e104ffc4e..c81cb25cfb3ac3a2803896e51d712eed60aeb6ba 100644 (file)
               KARAF_VERSION=$KARAF_VERSION
 
     publishers:
+      - opendaylight-infra-generate-csit-status-report
       - email-notification:
           email-recipients: '{email-recipients}'
           email-prefix: '[integration]'
+      - lf-infra-publish
 
 # Template: integration-sanity-test-{stream}
 # Goal: Verify a distribution through sanity test
index 3a9f5436c626550c2299b2d66a7912fa949b07ca..eb5743d8b3989584d3cbea13287d5941144d8cc5 100644 (file)
               {mvn-opts}
           java-opts:
             - '-Xmx1024m -XX:MaxPermSize=256m -Dmaven.compile.fork=true'
+
+- publisher:
+    name: opendaylight-infra-generate-csit-status-report
+    publishers:
+      - postbuildscript:
+          builders:
+            - shell: !include-raw-escape:
+                - generate-csit-status-report.sh
+          script-only-if-succeeded: false
+          script-only-if-failed: false
+          mark-unstable-if-failed: false