Skip to content

many: allow copr:// URLs in --(force|extra-repo)#2461

Open
supakeen wants to merge 5 commits into
osbuild:mainfrom
supakeen:extra-copr
Open

many: allow copr:// URLs in --(force|extra-repo)#2461
supakeen wants to merge 5 commits into
osbuild:mainfrom
supakeen:extra-copr

Conversation

@supakeen

@supakeen supakeen commented Jun 24, 2026

Copy link
Copy Markdown
Member

A long time ago we had discussed making it easier to pass certain types of repositories into image-builder. A super common use case is to want to build with a package from a COPR repository.

This PR implements just that. When --(force|extra)-repo copr://@osbuild/osbuild is passed the COPR API is used to look up the corresponding chroot (based on the distro/arch combination) and a repoconfig is generated from it and used.

The implementation here is slow to the point of it being barely usable when a COPR URL is passed. This is because we look up COPR things for the distro*arch combination for all distros when newRegistryImpl is called. This could be addressed a few different ways and I'd like input.

  1. Just accept it for now, merge the PR, address later now that we have a reason to do so (this has my preference).
  2. Provide a cache to parseRepoURLs (I tested this; it's way faster).
  3. Move the resolving of COPR URLs later into the process (somewhere in reporegistry?) after we know the actual arch/distro we're targetting.
  4. Don't have extraRepos be a part of that step at all, in that case things are only slow if force-repos is passed.

Which one has preference? The comment that is there seems to hint at the latter but it also feels kinda funky to deal with anything else but RepoConf.

All of this boils down to us needing the reporegistry to determine what we can build.

supakeen added 5 commits July 16, 2026 08:36
Let's be consistent and rename override to force in manifestgen and all
callers of it.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Allow for the appending of repositories on a reporegistry. Also offer a
useful ListArches function to get all the available arches for a
distribution.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
We had a comment talking about moving this to the reporegistry. I've
implemented it in a slightly different way in the previous commit but
let's make use of it.

The behavior is covered by tests already.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Include the distribution and architecture in calls to `parseRepoURLs`
and pass them along. This means that `parseRepoURLs` gets called a bunch
more but that's OK they currently contain single strings.

This is necessary because in the future we want to support (for example)
COPR lookups where we'll be using the COPR API to get the correct
information to create a `RepoConfig`. For this we need access to the
additional information to find the correct repository for a given image
type.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Allow passing of `copr://@owner/project` URLs to `--(force|extra)-repo`.

We look up the COPR chroot necessary through the distro/arch that we
pass along. We rename some distro names as they use different chroot
names from our internal names (`centos`) and for RHEL we go from
specific-to-RHEL to EPEL.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
@supakeen
supakeen marked this pull request as ready for review July 16, 2026 06:36
@supakeen
supakeen requested a review from a team as a code owner July 16, 2026 06:36
@supakeen

Copy link
Copy Markdown
Member Author

Going to undraft this, we can accept the slowness but I'd be interested in the discussion around it.

@supakeen
supakeen requested a review from achilleas-k July 16, 2026 06:37
Comment thread cmd/image-builder/copr.go
}

func fetchCoprProject(owner, project string) (*coprProject, error) {
apiURL := fmt.Sprintf("%s/api_3/project?ownername=%s&projectname=%s",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the API documented? Should be included in a comment somewhere in this file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do!

@brlane-rht

Copy link
Copy Markdown
Contributor

I'm a bit on the fence. Mostly because it's adding complexity. But running really slow I think is a show-stopper, at the least I think it needs to only be run once it has all the needed info.

But also, what does this really gain? Looking up copr repos is pretty easy already, the use probably already knows which arch/distro they want and can pull the baseurl from copr and pass it to --extra-repo.

@supakeen

supakeen commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

I'm a bit on the fence. Mostly because it's adding complexity. But running really slow I think is a show-stopper, at the least I think it needs to only be run once it has all the needed info.

But also, what does this really gain? Looking up copr repos is pretty easy already, the use probably already knows which arch/distro they want and can pull the baseurl from copr and pass it to --extra-repo.

Looking up COPR repo's isn't that easy; to give you a workflow: I want to build c10s and all Fedora's for aarch64 and x86_64 with some additional packages from several COPR repositories to test a new systemd/uboot/whatever.

If you try to go through those steps in your head of what you need to do:

  1. Look up the COPR repo's on COPR.
  2. Click on their repo files.
  3. Copy/paste the URLs out of that repofile.

Then for each arch/distro combination fill in the values yourself. You spend a lot of time on it.

When doing a single COPR for a single distro/arch sure that's straightforward enough; but there's also no real reason not to make it easier to do that. Same as I want to make it easier to say 'build an image with this Bodhi update enabled' which is super useful during test/freeze periods in Fedora.


If it wasn't so slow, I think a user-friendly feature like this would probably be not controversial, same goes for the Bodhi-variant :)

I agree that with the current implementation it's not worth it because it slows down the way we do repositories so badly. But now that this PR is open, it does show a problem in how we do our repository registry and what effect it has so we'll have to discuss that first 🙁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants