0

Context: I have a yum/dnf repo (currently supporting both RHEL7 and RHEL8 so we need to work with both, although it shouldn't make a difference) built inside Artifactory. The team uses a common .repo file and then uses yum/dnf variable files (/etc/yum/vars) to populate authentication details. Generally this works with no issues, but I'm running in to problems making the authentication work correctly with Mock.

It's possible to bind mount /etc/yum/vars inside the mock chroot, and it shows up if you shell in to the chroot... but not until after the yum/dnf install cycle, hence not in time to install srpm build dependencies from the custom repos.

Is there some way to either bind mount earlier in the process, or another way to inject yum variables earlier in to the mock process so they will be available for repo authentication? It's possible to get it working by directly putting the authentication details in to the mock config file in /etc/mock, but we're trying to avoid that so that the mock file (which is distributed inside a developer tools RPM) does not get changed between version updates and hence require reentering auth details every time it's updated.

Alternatively I'm also up for any other way short of hard coding the authentication into the mock and repo files for injecting that data. That's the end goal - get the repo authentication working in mock and dnf/yum while being able to distribute the generic .mock and .repo files in the developer RPM.

1 Answer 1

1

Aha, figured out a way to do it!

You can set user-specific variables for jinja2 template substitution in ~/.config/mock.cfg

Add lines config_opts['key_variable_name'] and config_opts['user_variable_name'] to that user file (assuming user is already in the mock group), then in the .mock or mock template file, have the repo use username/password={{key/user_variable_name}}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .