Skip to content

[FEATURE] Add support for exclusive_repos #26

Open
@synackd

Description

@synackd

Is your feature request related to a problem? Please describe.
Yes. When specifying different base repos (e.g. custom BaseOS and Appstream Rocky repos), the stock repos (e.g. rocky.repo, rocky-addons.repo, rocky-devel.repo, and rocky-extras.repo) are still present in /etc/yum.repos.d/.

As an example, when trying to add Rocky 9.5 repos:

repos:
  - alias: 'Rocky_9.5_BaseOS'
    url: 'https://dl.rockylinux.org/vault/rocky/9.5/BaseOS/x86_64/os/'
    gpg: 'https://dl.rockylinux.org/pub/rocky/RPM-GPG-KEY-Rocky-9'
  - alias: 'Rocky_9.5_AppStream'
    url: 'https://dl.rockylinux.org/vault/rocky/9.5/AppStream/x86_64/os/'
    gpg: 'https://dl.rockylinux.org/pub/rocky/RPM-GPG-KEY-Rocky-9'

These repos get added alongside the existing stock repos and a package version not in the repos specified (kernel-5.14.0-570.21.1.el9_6.x86_64 for Rocky 9.6) is installed, which is not the desired behavior:

$ podman run --tls-verify=false --rm -it <image_fqcn> bash
[root@8cbdd613b58a ~]# ls /etc/yum.repos.d
dl.rockylinux.org_vault_rocky_9.5_AppStream_x86_64_os_.repo  dl.rockylinux.org_vault_rocky_9.5_BaseOS_x86_64_os_.repo  rocky-addons.repo  rocky-devel.repo  rocky-extras.repo  rocky.repo
[root@8cbdd613b58a ~]# rpm -q kernel
warning: Found bdb_ro Packages database while attempting sqlite backend: using bdb_ro backend.
kernel-5.14.0-570.21.1.el9_6.x86_64

The repos in /etc/yum.repos.d/rocky*.repo use $releasever, which pulls the latest Rocky 9 packages, which is undesired in this case.

Describe the solution you'd like
It would be useful to have an option, e.g. exclusive_repos, that clears all of the existing repos before setting the ones specified in the image-builder config. That way, exclusive_repos could be used for custom base repos in a root image config and repos could be used to add on to these in children image layers.

Describe alternatives you've considered
Having a remove_repos option to remove repos (similar to remove_packages), but this seems a bit more cumbersome than exclusive_repos.

Additional context
Testing using Rocky 9.5-based image configs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions