blob: 2e8ced53486fc45729ca8b57d3e1ebb64b350f26 [file] [log] [blame]
Clint Adamsa4136522016-03-10 20:24:34 -05001#! /usr/bin/env python
2
3# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
4#
5# Licensed under the Apache License, Version 2.0 (the "License"); you may
6# not use this file except in compliance with the License. You may obtain
7# a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14# License for the specific language governing permissions and limitations
15# under the License.
16
17# This script is intended to be run as part of a periodic proposal bot
18# job in OpenStack infrastructure.
19#
20# In order to function correctly, the environment in which the
21# script runs must have
caoyuan349ba752019-04-23 19:40:06 +080022# * network access to the review.opendev.org Gerrit API
Clint Adamsa4136522016-03-10 20:24:34 -050023# working directory
caoyuan349ba752019-04-23 19:40:06 +080024# * network access to https://opendev.org/openstack
Clint Adamsa4136522016-03-10 20:24:34 -050025
26import json
27import re
Masayuki Igawaac8ae642019-05-23 11:39:02 +020028import sys
Masayuki Igawa134d9f72017-02-10 18:05:26 +090029
Masayuki Igawa411f4bb2019-08-08 16:15:11 +090030import urllib3
31from urllib3.util import retry
Masayuki Igawa73c33452017-06-19 12:08:58 +090032
Masayuki Igawaac8ae642019-05-23 11:39:02 +020033# List of projects having tempest plugin stale or unmaintained for a long time
34# (6 months or more)
Martin Kopecdc844232020-12-24 15:57:53 +000035# TODO(masayukig): Some of these can be removed from NON_ACTIVE_LIST in the
36# future when the patches are merged.
37NON_ACTIVE_LIST = [
Anand Bhatf3627202021-06-16 20:39:31 +053038 'x/gce-api', # It looks gce-api doesn't support python3 yet
39 # https://bugs.launchpad.net/gce-api/+bug/1931094
Masayuki Igawa14d66b62020-04-13 09:32:11 +090040 'x/glare', # To avoid sanity-job failure
Anand Bhatf3627202021-06-16 20:39:31 +053041 'x/group-based-policy',
42 # https://bugs.launchpad.net/group-based-policy/+bug/1931091
43 'x/intel-nfv-ci-tests', # To avoid sanity-job failure
Masayuki Igawa6617b832019-06-20 14:48:37 +090044 'openstack/networking-generic-switch',
Anand Bhatf3627202021-06-16 20:39:31 +053045 # This is not a real tempest plugin,
Masayuki Igawa6617b832019-06-20 14:48:37 +090046 # https://review.opendev.org/#/c/634846/
Anand Bhatf3627202021-06-16 20:39:31 +053047 'x/networking-plumgrid', # No longer contains tempest tests
Masayuki Igawa6617b832019-06-20 14:48:37 +090048 'x/networking-spp', # https://review.opendev.org/#/c/635098/
Anand Bhatf3627202021-06-16 20:39:31 +053049 # networking-spp is missing neutron-tempest-plugin as a dep plus
50 # test-requirements.txt is nested in a openstack dir and sanity script
51 # doesn't count with such scenario yet
Masayuki Igawa6617b832019-06-20 14:48:37 +090052 'openstack/neutron-dynamic-routing',
Anand Bhatf3627202021-06-16 20:39:31 +053053 # As tests have been migrated to neutron-tempest-plugin:
Masayuki Igawa6617b832019-06-20 14:48:37 +090054 # https://review.opendev.org/#/c/637718/
Anand Bhatf3627202021-06-16 20:39:31 +053055 'openstack/neutron-vpnaas',
56 # As tests have been migrated to neutron-tempest-plugin:
57 # https://review.opendev.org/c/openstack/neutron-vpnaas/+/695834
58 'x/valet', # valet is unmaintained now
59 # https://review.opendev.org/c/x/valet/+/638339
60 'x/kingbird', # kingbird is unmaintained now
61 # https://bugs.launchpad.net/kingbird/+bug/1869722
62 'x/mogan',
Martin Kopec743d4952020-12-17 20:02:56 +000063 # mogan is unmaintained now, remove from the list when this is merged:
64 # https://review.opendev.org/c/x/mogan/+/767718
Ghanshyam Mann61d6c112021-08-27 09:17:11 -050065 'x/vmware-nsx-tempest-plugin'
66 # Failing since 2021-08-27
Ghanshyam Manna25e9ba2021-09-08 22:35:19 -050067 # https://zuul.opendev.org/t/openstack/build
68 # /45f6c8d3c62d4387a70b7b471ec687c8
69 # Below plugins failing for error in psycopg2 __init__
70 # ImportError: libpq.so.5: cannot open shared object
71 # file: No such file or directory
72 # https://zuul.opendev.org/t/openstack/build
73 # /b61a48196dfa476d83645aea4853e544/log/job-output.txt#271722
74 # Failing since 2021-09-08
75 'x/networking-l2gw-tempest-plugin'
76 'x/novajoin-tempest-plugin'
77 'x/ranger-tempest-plugin'
Ghanshyam Manna25e9ba2021-09-08 22:35:19 -050078 'x/trio2o'
Ghanshyam Manna1045152023-08-06 12:19:58 -070079 # No changes are merging in this
80 # https://review.opendev.org/q/project:x%252Fnetworking-fortinet
81 'x/networking-fortinet'
Masayuki Igawaac8ae642019-05-23 11:39:02 +020082]
Clint Adamsa4136522016-03-10 20:24:34 -050083
caoyuan349ba752019-04-23 19:40:06 +080084url = 'https://review.opendev.org/projects/'
Clint Adamsa4136522016-03-10 20:24:34 -050085
86# This is what a project looks like
87'''
88 "openstack-attic/akanda": {
89 "id": "openstack-attic%2Fakanda",
90 "state": "READ_ONLY"
91 },
92'''
93
Masayuki Igawa411f4bb2019-08-08 16:15:11 +090094http = urllib3.PoolManager(cert_reqs='CERT_REQUIRED')
95retries = retry.Retry(status_forcelist=[500], backoff_factor=1.0)
Clint Adamsa4136522016-03-10 20:24:34 -050096
Masayuki Igawa411f4bb2019-08-08 16:15:11 +090097
Clint Adamsa4136522016-03-10 20:24:34 -050098def has_tempest_plugin(proj):
Chandan Kumar1b1e6df2017-06-11 17:07:50 +053099 try:
Masayuki Igawa411f4bb2019-08-08 16:15:11 +0900100 r = http.request('GET', "https://opendev.org/%s/raw/branch/"
101 "master/setup.cfg" % proj, retries=retries)
102 if r.status == 404:
Chandan Kumar1b1e6df2017-06-11 17:07:50 +0530103 return False
Masayuki Igawa411f4bb2019-08-08 16:15:11 +0900104 except urllib3.exceptions.MaxRetryError as err:
Masayuki Igawa2957b402019-06-24 15:22:13 +0900105 # We should not ignore non 404 errors.
106 raise err
Stephen Finucane7f4a6212018-07-06 13:58:21 +0100107 p = re.compile(r'^tempest\.test_plugins', re.M)
Masayuki Igawa411f4bb2019-08-08 16:15:11 +0900108 if p.findall(r.data.decode('utf-8')):
Clint Adamsa4136522016-03-10 20:24:34 -0500109 return True
110 else:
111 False
112
Stephen Finucane7f4a6212018-07-06 13:58:21 +0100113
Martin Kopecdc844232020-12-24 15:57:53 +0000114if len(sys.argv) > 1 and sys.argv[1] == 'nonactivelist':
115 for non_active_plugin in NON_ACTIVE_LIST:
116 print(non_active_plugin)
117 # We just need NON_ACTIVE_LIST when we use this `nonactivelist` option.
Masayuki Igawaac8ae642019-05-23 11:39:02 +0200118 # So, this exits here.
119 sys.exit()
120
Masayuki Igawa411f4bb2019-08-08 16:15:11 +0900121r = http.request('GET', url, retries=retries)
Clint Adamsa4136522016-03-10 20:24:34 -0500122# Gerrit prepends 4 garbage octets to the JSON, in order to counter
123# cross-site scripting attacks. Therefore we must discard it so the
124# json library won't choke.
Masayuki Igawa411f4bb2019-08-08 16:15:11 +0900125content = r.data.decode('utf-8')[4:]
Masayuki Igawae36fe672019-05-23 13:43:46 +0200126projects = sorted(json.loads(content))
Clint Adamsa4136522016-03-10 20:24:34 -0500127
Masayuki Igawae36fe672019-05-23 13:43:46 +0200128# Retrieve projects having no deployment tool repo (such as deb,
129# puppet, ansible, etc.), infra repos, ui or spec namespace as those
ghanshyam95b68be2018-02-01 02:17:08 +0000130# namespaces do not contains tempest plugins.
131projects_list = [i for i in projects if not (
Masayuki Igawae36fe672019-05-23 13:43:46 +0200132 i.startswith('openstack-dev/') or
133 i.startswith('openstack-infra/') or
134 i.startswith('openstack/ansible-') or
135 i.startswith('openstack/charm-') or
136 i.startswith('openstack/cookbook-openstack-') or
137 i.startswith('openstack/devstack-') or
138 i.startswith('openstack/fuel-') or
ghanshyam95b68be2018-02-01 02:17:08 +0000139 i.startswith('openstack/deb-') or
140 i.startswith('openstack/puppet-') or
Masayuki Igawae36fe672019-05-23 13:43:46 +0200141 i.startswith('openstack/openstack-ansible-') or
142 i.startswith('x/deb-') or
143 i.startswith('x/fuel-') or
144 i.startswith('x/python-') or
145 i.startswith('zuul/') or
ghanshyam95b68be2018-02-01 02:17:08 +0000146 i.endswith('-ui') or
147 i.endswith('-specs'))]
Chandan Kumar3c81b412017-06-13 15:48:20 +0530148
149found_plugins = list(filter(has_tempest_plugin, projects_list))
Clint Adamsa4136522016-03-10 20:24:34 -0500150
Masayuki Igawae36fe672019-05-23 13:43:46 +0200151# We have tempest plugins not only in 'openstack/' namespace but also the
152# other name spaces such as 'airship/', 'x/', etc.
153# So, we print all of them here.
Clint Adamsa4136522016-03-10 20:24:34 -0500154for project in found_plugins:
Masayuki Igawae36fe672019-05-23 13:43:46 +0200155 print(project)