masterfiles icon indicating copy to clipboard operation
masterfiles copied to clipboard

CFE-4450: Allow passing environment variables to package managers

Open amousset opened this issue 1 year ago • 4 comments

Allow passing options to the package managers modules through env:NAME=VERSION options.

Taking the easiest path. If it is considered acceptable I'll add a test case and documentation.

amousset avatar Nov 22 '24 10:11 amousset

Do you have some explicit examples of the use case for each of the package managers as well?

nickanderson avatar Nov 22 '24 15:11 nickanderson

For APT, for example controling needrestart's behavior.

But the main use case is for non-standard packages that allow customizing the configuration through env vars used in the postinst script. GitLab is one of them (https://docs.gitlab.com/omnibus/installation/index.html#set-up-the-initial-account):

sudo GITLAB_ROOT_EMAIL="<[email protected]>" GITLAB_ROOT_PASSWORD="<strongpassword>" EXTERNAL_URL="http://gitlab.example.com" apt install gitlab-ee

amousset avatar Dec 09 '24 12:12 amousset

From my side I think it makes sense, I will invite @olehermanse @craigcomstock to bike shed a bit.

nickanderson avatar Dec 10 '24 20:12 nickanderson

I created some basic documentation in https://github.com/cfengine/documentation/pull/3374. I also took a look at the tests but it seems there are no tests covering the options attribute, and that there is no testing mechanism for "real module/fake package manager" that would be convenient here (there is "fake module/no PM" and "real module/real PM"). I'll try to take a closer look.

amousset avatar Dec 19 '24 17:12 amousset