-
Notifications
You must be signed in to change notification settings - Fork 891
Skip readonly variables in process handler #4174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Skip readonly variables in process handler #4174
Conversation
|
||
if (_readonlyEnvVariables.Contains(key, StringComparer.OrdinalIgnoreCase)) | ||
{ | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: log an error (or at least a warning) when attempting to set a 'read-only variable'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure we want to throw error or warning here, because customer or task owner didn't really control what variables will be. Here we get all the environment variables and process them from case to case
string value = line.Substring(index + 1); | ||
|
||
if (_readonlyEnvVariables.Contains(key, StringComparer.OrdinalIgnoreCase)) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider: use feature flag for this change + collect metrics to determine impact and effectiveness
@@ -126,6 +129,8 @@ public async Task RunAsync() | |||
{ | |||
// Format the command so the environment variables can be captured. | |||
cmdExeArgs = $"/c \"{command} {arguments} && echo {OutputDelimiter} && set \""; | |||
|
|||
_readonlyEnvVariables = Constants.Variables.ReadOnlyVariables.ConvertAll(var => VarUtil.ConvertToEnvVariableFormat(var)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One point missed here - we shoud also collect runtime env variables.
we may get full list of readonly variables from the AZP_READONLY_ENV_VARIABLES
implemented here: #4175
Skip read-only variables in process handler to fit design concept:
https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/readonly-variables.md