Format validation for the --env flag values
kcq opened this issue · comments
The "build" and "profile" command have a flag to pass environment variables and the flag values are passed as-is to the downstream container runtime API calls. There's no format validation for the provided values. The values are expected to have the standard environmental variable declaration format (example: ENV_VAR_NAME=ENV_VAR_VALUE)
It'll be good to validate the --env
flag values to make sure they follow the expected format. If they don't follow the expected format we need to exclude the malformed values from the list of the env vars used later on in the command processing printing to the screen (using the 'execution context' in the command) that the malformed environment variable is discarded/ignored (we should not fail the command execution just because one of the env var values is malformed).
@kcq , thanks I'm looking into it. When outputting the notice that a key=variable
is to be excluded, do you want to use (from executioncontext cli printf) "Error" or "Prompt" or "Info"?
EDIT: i figured it out, dont worry about this part. for my future reference it should be build --env key1=val1 --env key2=val2
also, when putting in multiple env variables, do you use ,
as a delimiter? like so ./slim build --target myimage:1.0.0 --env key1=val1,key2=val2
?!
as a follow up, what's the best way to build one area to test my changes, right now what I do to build is to run make
from the root and it takes a long time to build everything. say I want to build only the build
and commands
packages, what's the most efficient way to do that?
@kcq , will create a PR for you to review, it's a WIP as there are some that might need some clarification.
the enhancement is done... closing the ticket