Page MenuHomePhabricator

[envvars-cli] Enable use of `toolforge envvar` managed data on bastions
Open, MediumPublicFeature

Description

As a tool maintainer
I want to reuse envvar data managed with toolforge envvar in cli applications on Toolforge bastions
So I can maintain a single source of truth for data that is useful not only in container runtimes but also with custom Kubernetes objects and other bastion originated processes.

One concrete use case I have today is creating a Kubernetes Service object for a Toolforge Jobs framework managed pod via kubectl apply. It is possible to expand envvars in a YAML template using the envsubst command provided by the gettext-base Debian apt package by doing something like envsubst < config.yaml | kubectl apply -f -. The trick is getting the envvars out of toolforge envvars and into the shell on a bastion.

One possible solution could be a toolforge envvars export command that produces output that can be executed in the current environment by a posix shell. That might end up looking something like:

$ toolforge envvars export
IRC_PASSWORD="somereallycoolpassworddata"
TOOL_REPLICA_PASSWORD="adifferentcoolpassword"
TOOL_REPLICA_USER="s51894"
TOOL_TOOLSDB_PASSWORD="yetanotherfancypassword"
TOOL_TOOLSDB_USER="s51894"
ZNC_NICK="wikibugs_test"
ZNC_USER="wikibugs"
ZNC_LOCAL_PORT="6667"
$ set -a # automatically export all variables
$ . <(toolforge envvars export)
$ set +a
$ echo $ZNC_LOCAL_PORT
6667

Event Timeline

dcaro renamed this task from [envvars] Enable use of `toolforge envvar` managed data on bastions to [envvars-cli] Enable use of `toolforge envvar` managed data on bastions.Mar 5 2024, 5:18 PM
dcaro triaged this task as Medium priority.Mar 12 2024, 1:50 PM
dcaro moved this task from Backlog to Ready to be worked on on the Toolforge board.