singularityhub / sregistry-cli

Singularity Global Client for container management
https://singularityhub.github.io/sregistry-cli/
Mozilla Public License 2.0
14 stars 18 forks source link

Use environment variables to configure registry client? #235

Closed tschoonj closed 4 years ago

tschoonj commented 4 years ago

Is your feature request related to a problem? Please describe.

Now that it looks that I will be ditching S3 in favor of our locally hosted sregistry soon, I am looking into how the images will get pushed from Circle-CI to the sregistry.

From the docs I understand it will have to be something like:

API_TOKEN= "{ "registry": { "token": "my-long-token", "username": "my-username", "base": "https://my-registry.eu" } }"
echo $API_TOKEN > $HOME/.sregistry

with the API_TOKEN actually defined in the CircleCI project :arrow_right: Build Settings :arrow_right: Environment Variables. This will work (assuming I escaped the quotes in the JSON string if necessary) but is not very pretty.

When trying pushing to my sregistry from my workstation, I didn't like having to overwrite my local .sregistry file, as it meant losing all my S3 related stuff that was already in there (not a disaster, but still...).

Describe the solution you'd like

To align behavior of the registry client with its S3 counterpart (and other clients as well I think), I would like to propose using environment variables to set this all up, instead of having to rely on a JSON string:

export SREGISTRY_REGISTRY_TOKEN="my-long-token"
export SREGISTRY_REGISTRY_USERNAME="my-username"
export SREGISTRY_REGISTRY_BASE="https://my-registry.eu" 

Of course this would have to implemented in such a way that backwards compatibility with the old JSON variable names is maintained, but I don't think this would be a hard thing to do.

Obviously, I wouldn't mind implementing all of this myself :wink:

Describe alternatives you've considered

Nothing really.

vsoch commented 4 years ago

Yeah this is a great idea! I’m embarrassed that it’s not implemented ;) if you have bandwidth go for it, I’d be happy to review :)

tschoonj commented 4 years ago

Ok getting to work now

vsoch commented 4 years ago

Don't forget the CHANGELOG and bumping the version string!! :P

vsoch commented 4 years ago

Closed with #236

tschoonj commented 4 years ago

Fixed in #236