#8478 Retired packages should close rawhide bugzilla as WONTFIX or EOL
Opened 2 years ago by churchyard. Modified a year ago

  • Describe the issue

When a package gets retired, all the bugzilla filed for rawhide should be closed as WONTFIX or EOL.

  • When do you need this?

Any time.

  • When is this no longer needed or useful?

Once we don't retire packages or use bugzilla.

  • If we cannot complete your request, what is the impact?

A lot of open bugzillas for retired components. I think this used to happen automatically before, but maybe it was done by a human.


Metadata Update from @mohanboddu:
- Issue tagged with: automation

2 years ago

I have a prototype script that closes all bugzillas for retired components.

However, when trying to get list of all rawhide bugzillas, bugzilla API crashes with Proxy error.

For 31 it seems to work (apparently, less 31 than rawhide Fedora bugzillas). Will do more testing and post something soon.

import configparser
import bugzilla
import pathlib
import sys
import logging
import subprocess
from click import progressbar


assert sys.version_info[0] > 2, 'Needs Python 3'


# XXX Update this after branching!
RAWHIDE = '32'


LOGGER = logging.getLogger()
LOGGER.setLevel(logging.DEBUG)
fh = logging.FileHandler('bugzilla.log')
fh.setLevel(logging.DEBUG)
LOGGER.addHandler(fh)


# Get credentials from config
config_path = pathlib.Path('./close_retired_bugzillas.cfg')
if not config_path.exists():
    config_path = pathlib.Path('/etc/close_retired_bugzillas.cfg')
if not config_path.exists():
    raise RuntimeError('Create a config file as ./close_retired_bugzillas.cfg '
                       'or /etc/close_retired_bugzillas.cfg')

config = configparser.ConfigParser()
config.read(config_path)

URL = config['bugzilla'].get('url', 'https://bugzilla.redhat.com')
USERNAME = config['bugzilla']['username']
PASSWORD = config['bugzilla'].get('password', '')
FEDORA = (config['bugzilla'].get('fedora', '').upper().replace('F', '')
          or RAWHIDE)


TEMPLATE = f"""Automation has figured out the package is retired in Fedora {FEDORA}.

If you like it to be unretired, please open a ticket at https://pagure.io/releng/new_issue?template=package_unretirement
"""  # noqa


if USERNAME == '-interactive-':
    bzapi = bugzilla.Bugzilla(URL)
    if not bzapi.logged_in:
        print(f'Log in to Bugzilla ta {URL}')
        bzapi.interactive_login()
else:
    bzapi = bugzilla.Bugzilla(URL, user=USERNAME, password=PASSWORD)


def open_bugz(version=FEDORA):
    if version == RAWHIDE:
        version = 'rawhide'
    query = bzapi.build_query(product='Fedora', version=version)
    query['status'] = [
        'NEW',
        'ASSIGNED',
        'POST',
        'MODIFIED',
        'ON_QA',
        'VERIFIED',
        'RELEASE_PENDING',
    ]
    return bzapi.query(query)


def is_retired(component, *, version=FEDORA):
    if component == 'distribution' or ' ' in component:
        return False
    if version == 'rawhide':
        version = RAWHIDE
    tag = f'f{version}'
    cmd = ('koji', 'list-pkgs', '--show-blocked',
           '--tag', tag, '--package', component)
    p = subprocess.run(cmd, stdout=subprocess.PIPE, text=True)
    return '[BLOCKED]' in p.stdout


def close_bugzillas(bug_ids, comment=TEMPLATE):
    update = bzapi.build_update(comment=comment,
                                status='CLOSED', resolution='WONTFIX')
    try:
        bzapi.update_bugs(bug_ids, update)
    except Exception:
        LOGGER.exception()


print('Gathering bugz, this can take several minutes...')
bugz = open_bugz()
components = set(bug.component for bug in bugz)
print(f'There are {len(bugz)} unclosed bugz for {len(components)} components')

print('Checking which components are retired...')
retired = set()
with progressbar(components, item_show_func=lambda c: c or 'Finished!') as cb:
    for component in cb:
        if is_retired(component):
            retired.add(component)


bug_ids = [b.id for b in bugz if b.component in retired]
print(f'There are {len(retired)} retired components, '
      f'closing their {len(bug_ids)} bugzillas.')

close_bugzillas(bug_ids)

It could use some concurrency of is_retired calls (now it takes ~1 hour), but otherwise appears to work.

I cannot longer close Bugzillas as EOL, so I went with WONTFIX.

This is unfortunately already causing confusion: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/4554GEM6XE3ZBAE53SU26GV2HLTU7S4O/

So... why do we need this? The bugs should get EOLed as fedora EOL's releases.

If someone unretires a package, it won't be easy for them to see what things were outstanding when it was retired.

Is there some advantage to doing this?

So... why do we need this? The bugs should get EOLed as fedora EOL's releases.

Some bugzillas are forever rawhide and never EOLed.

Wouldn't they get moved to branched at branching time? unless they have FutureFeature or whatever... in which case, wouldn't they still be of use to the package in case it's ever unretired?

From our releng meeting today, we decided to implement this as part of toddlers but when someone unretires we will send them a list of bugs that got closed due to retirement and let them handle it however they want to.

But we need help as this is something that we can live with, if someone from community would like to pick it up for us, that would be great.

Login to comment on this ticket.

Metadata