2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 # Create a python script to parse a Jenkins build for sub-project status
16 # SPDX-License-Identifier: EPL-1.0
17 ##############################################################################
18 # Copyright (c) 2017 The Linux Foundation and others.
20 # All rights reserved. This program and the accompanying materials
21 # are made available under the terms of the Eclipse Public License v1.0
22 # which accompanies this distribution, and is available at
23 # http://www.eclipse.org/legal/epl-v10.html
24 ##############################################################################
26 __author__ = 'Thanh Ha'
31 from bs4 import BeautifulSoup
35 build_url = sys.argv[1]
36 urlparse = requests.utils.urlparse(build_url)
37 jenkins_url = "{}://{}".format(urlparse.scheme, urlparse.netloc)
39 page = requests.get(build_url)
40 soup = BeautifulSoup(page.text, 'html.parser')
41 links = soup.findAll("a", { "class" : "model-link" })
43 _file = open('csit_failed_tests.txt', 'w+')
46 if link.img and (link.img['alt'] == 'Unstable' or
47 link.img['alt'] == 'Failed' or
48 link.img['alt'] == 'Aborted'):
51 project = url.split('/')[3].split('-')[0]
52 _file.write("{}\\t{}{}\\n".format(project, jenkins_url, url))
57 virtualenv --quiet "/tmp/v/jenkins"
58 # shellcheck source=/tmp/v/jenkins/bin/activate disable=SC1091
59 source "/tmp/v/jenkins/bin/activate"
60 pip install --quiet --upgrade "pip<10.0.0" setuptools
61 pip install --quiet --upgrade tox beautifulsoup4 requests
63 echo python "$script" "$BUILD_URL"
64 python "$script" "$BUILD_URL"
66 mkdir -p "$WORKSPACE/archives"
67 mv csit_failed_tests.txt "$WORKSPACE/archives"