#1633 DistGit from fork branch / PR
Closed: Fixed 3 years ago by praiskup. Opened 3 years ago by churchyard.

Hello. I'd like to add a DistGit package, but from a fork branch / PR. Currently, this is only possible via SCM (where I can set custom git URL), but has the pre-processing enabled, so it is not ideal.

Thanks


but from a fork branch / PR

I did not realize this before. Thanks for the report!

Just to make sure, automatically triggered builds from PRs (via fedora-messaging)
should be working fine.

The problem is if you want to configure a new package that is solely build from
the fork repository. So I tend to think that we should have an additional "clone_url"
optional config option.

Metadata Update from @praiskup:
- Issue tagged with: RFE

3 years ago

The problem is if you want to configure a new package that is solely build from
the fork repository.

Indeed.

For SCM, I do:

  • Source Type: Build from an SCM repository
  • SCM type: git
  • Clone URL: https://src.fedoraproject.org/forks/churchyard/rpms/python-rpm-macros.git
  • Committish: 3.10
  • Build SRPM with: rpkg

This just got more serious for us, because the workaround (using rpkg) does not work for some of our packages, see https://pagure.io/copr/copr/issue/1703

Metadata Update from @frostyx:
- Issue priority set to: High

3 years ago

I investigated the issue and IMHO we should solve this via namespaces. Please tell me what do you think.

First, this is solely a frontend issue. I spent some time searching an issue in the copr-rpmbuild code but then I remembered that we actually define DistGit configurations in our database. Just saying to save some time for whoever else is going to look at this issue.

See these two particular configurations

'clone_package_uri': 'rpms/{pkgname}.git',
'clone_url': 'https://src.fedoraproject.org'

and

'clone_package_uri': 'git/{namespace}/{pkgname}.git',
'clone_url': 'https://copr-dist-git-dev.fedorainfracloud.org'

Apparently, we ignore the submitted namespace value for the Fedora DistGit. AFAIK the rpms/ and forks/churchyard/rpms/ is considered a namespace. Therefore my proposed solution is to

  1. Update our Fedora DistGit configuration to contain {namespace}
  2. Set rpms/ to be the default namespace
  3. Do not print the default namespace into the "Create build from DistGit" form to not make the form confusing but adjust the tooltip to mention how to build from forks.

I would probably prefer to have something like --clone-url, but I have no strong
opinion about this. That way you can build dist-git packages from anywhere,
even e.g. from github fork.... while still using the default fedora lookaside cache
for downloading sources.

First, this is solely a frontend issue.

Well, it depends. The problem imo is "how to map clone url" to "lookaside cache"
url. This is done by the --distgit <ID> option. But it also automatically assigns
the "clone url"....

Perhaps we can re-use the namespace (somehow) but note that we should keep
reacting on events from Pagure ... (someone opens a PR against already forked
repo
, pagure sends a fedora-messaging message - and we should start a build
for packages that are setup to run builds for the fork repo).

The proposed solution with namespace would fix my issue.
But I agree that supporting arbitrary git URLs makes it more useful.

FTR, it is necessary to successfully pair the forked clone_url with the events from
fedora-messaging, so new builds are automatically triggered.

Metadata Update from @praiskup:
- Issue assigned to frostyx

3 years ago

The artificial clone_url support (I still it would be beneficial) will be added in #1685.

Log in to comment on this ticket.

Metadata
Related Pull Requests
  • #1834 Merged 3 years ago