GothenburgBitFactory / bugwarrior

Pull github, bitbucket, and trac issues into taskwarrior
http://pypi.python.org/pypi/bugwarrior
GNU General Public License v3.0
732 stars 209 forks source link

Support retrieving an untagged list of repositories in Pagure #1034

Open alexsaezm opened 4 months ago

alexsaezm commented 4 months ago

So far, the only way I found to retrieve several repositories from a Pagure instance is by having different sections, for example:

[rpms/golang]
service = pagure
pagure.repo = rpms/golang
pagure.base_url = https://src.fedoraproject.org
pagure.description_template = {{pagureid}}: {{paguretitle}}
pagure.project_template = Fedora

[rpms/delve]
service = pagure
pagure.repo = rpms/delve
pagure.base_url = https://src.fedoraproject.org
pagure.description_template = {{pagureid}}: {{paguretitle}}
pagure.project_template = Fedora

[rpms/golang-x-oauth2]
service = pagure
pagure.repo = rpms/golang-x-oauth2
pagure.base_url = https://src.fedoraproject.org
pagure.description_template = {{pagureid}}: {{paguretitle}}
pagure.project_template = Fedora

The pagure.include_repos behaves differently compared to gitlab.include_repos. In Pagure, it is only available if you use the pagure.tag option, but in GitLab it's the list of repositories to include.

pagure.repo only accepts one item, and having to include several sections in the targets field is a little hard, as we cannot use regexp nor wildcards (as far as I know).

Oddly, if you use the tag function, and the repository doesn't have the issues activated (like it happens on Fedora's instance), bugwarrior fails:

ERROR:bugwarrior.collect:Worker for [Fedora] failed: Failed to talk to 'https://src.fedoraproject.org/api/0/golang/issues' {'error': 'Project not found', 'error_code': 'ENOPROJECT'}
Traceback (most recent call last):
  File "/home/alex/Code/src/github.com/GothenburgBitFactory/bugwarrior/bugwarrior/collect.py", line 36, in _aggregate_issues
    for issue in service.issues():
  File "/home/alex/Code/src/github.com/GothenburgBitFactory/bugwarrior/bugwarrior/services/pagure.py", line 185, in issues
    issues.extend(self.get_issues(repo, ('issues', 'issues')))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alex/Code/src/github.com/GothenburgBitFactory/bugwarrior/bugwarrior/services/pagure.py", line 132, in get_issues
    raise OSError('Failed to talk to %r %r' % (url, error))
OSError: Failed to talk to 'https://src.fedoraproject.org/api/0/golang/issues' {'error': 'Project not found', 'error_code': 'ENOPROJECT'}

Is there a way to create something like this?:

[Fedora]
service = pagure
pagure.include_repos = rpms/golang, rpms/delve, rpms/golang-x-oauth2
pagure.base_url = https://src.fedoraproject.org
pagure.description_template = {{pagureid}}: {{paguretitle}}
pagure.project_template = Fedora
ryneeverett commented 4 months ago

If I understand correctly, the end goal is probably:

I suspect the reason for this limitation in the first place is limitations in pagure's http api, but there's no reason we couldn't hide that under a more consistent configuration abstraction.

Oddly, if you use the tag function, and the repository doesn't have the issues activated (like it happens on Fedora's instance), bugwarrior fails:

This seems like a bug. Please open a separate issue.