Project

General

Profile

Actions

action #178771

open

coordination #154768: [saga][epic][ux] State-of-art user experience for openQA

coordination #154771: [epic] Improved test developer user experience

[beginner][easy] Support for custom bugrefs (e.g. with configurable sections)

Added by tinita about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Feature requests
Target version:
Start date:
2025-03-12
Due date:
% Done:

0%

Estimated time:

Description

Motivation

The code for bugrefs can be improved.

The urls are currently hardcoded.
https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/Utils.pm#L41-L73

There is code that handles some exceptions for certain bugtrackers:
https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/Utils.pm#L459-L460

    my $issuetext = $+{marker} eq 'pio' ? 'issue' : 'issues';
    return $BUGREFS{$+{marker}} . ($+{repo} ? "$+{repo}/$issuetext/" : '') . $+{id};

There is a regex that tries to make it work for all bugtrackers but this is hard to understand by now:
https://github.com/os-autoinst/openQA/blob/master/lib/OpenQA/Utils.pm#L477

    $regex = qr{(?<!["\(\[])(?<url_root>$regex)((?<repo>.*?)/(-/)?(issues?|pull)/)?(?<id>([A-Z]+-)?\d+)(?![\w])};

We have extra code for matching recognized_referers that needs to be improved to only match links to issues: #176826

We should not invent a second list or mapping, if we are basically talking about the same urls.
The configured bugtrackers are usually the same urls that you would want for referer matching.

A configuration section would probably be a bit more verbose, but easier to understand and maintain, and we don't need to add all possible bugtrackers just because other openQA instances are using them.

This would block or replace #176826

Benefit for users: They can add additional bugtrackers themselves and don't have to patch the source.
If it's a known kind, e.g. gitea, gitlab, redmine, jira it's very easy to do.
If it's a new kind that would require to update our horrible regex it is probably also easier to use the new format.

Benefit for us: cleaner code. I wouldn't be proud of the current code. And also we are users.


Related issues 1 (1 open0 closed)

Copied from openQA Project (public) - action #176826: Automatic label link is "broken" when job link is followed from the issue creation preview size:SBlockedokurz2025-02-09

Actions
Actions #1

Updated by tinita about 1 month ago

  • Copied from action #176826: Automatic label link is "broken" when job link is followed from the issue creation preview size:S added
Actions #2

Updated by tinita about 1 month ago ยท Edited

Here is an example what I would be thinking of, after exchanging thoughts and suggestions with @jbaier_cz.
There would be some defaults in order to avoid having to configure the same kind of thing for every new bugtracker. e.g. gitea instances and github are using the same url schema for issues.

# common section
[bugtrackertype github] # github and gitea
bugref = (?<userrepo>\w+/\w+)#(?<id>\d+)    # for matching gh#user/repo#123 in order to put it into a url
bugurl = $BASE$USERREPO/issues/$ID          # replaced by the matched captures from above
urlmatch = $BASE\w+/\w+/(issues|pulls)/\d+  # for referer checking

[bugtrackertype simple] # just digits after the base url
bugref = (?<id>\d+)
bugurl = $BASE$ID
urlmatch = $BASE\d+

[bugtracker poo]
# poo#123
type = simple
base = https://progress.opensuse.org/issues/

[bugtracker gh]
# gh#user/repo#123
type = github
base = https://github.com/

[bugtracker soo]
# soo#user/repo/123
type = github
base = https://src.opensuse.org/

[bugtracker boo]
# boo#123
type = simple
base = https://bugzilla.opensuse.org/show_bug.cgi?id=

[bugtracker jsc]
# jsc#ABC-123
type = simple
base = https://jira.suse.com/browse/
# simple, but overwriting because the id can have more than digits
bugref = (?<id>[A-Z]+-\d+)
urlmatch = $BASE[A-Z]+-\d+

edit: still missing: turning a url into a bugref

Actions #3

Updated by tinita about 1 month ago

  • Description updated (diff)
Actions #4

Updated by tinita about 1 month ago

  • Description updated (diff)
Actions #5

Updated by okurz about 1 month ago

Can you elaborate what the benefit for users is?

Actions #6

Updated by okurz about 1 month ago

  • Target version set to future
Actions #7

Updated by tinita about 1 month ago

  • Description updated (diff)

Added benefits to the description

Actions #8

Updated by okurz about 1 month ago

  • Subject changed from Add configuration section for bugrefs to Support for custom bugrefs (e.g. with configurable sections)
Actions #9

Updated by okurz about 1 month ago

  • Subject changed from Support for custom bugrefs (e.g. with configurable sections) to [beginner][easy] Support for custom bugrefs (e.g. with configurable sections)
Actions

Also available in: Atom PDF