-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Adding Enricher for Azure Pipelines #1675
Adding Enricher for Azure Pipelines #1675
Conversation
{ | ||
if (environmentVariables.TryGetValue("TF_BUILD", out var value)) | ||
{ | ||
return value?.Equals("true", StringComparison.OrdinalIgnoreCase) ?? false; |
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.
No need to check if it's true
or not here. A simple !string.IsNullOrWhitespace
should suffice.
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.
Updated!
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.
Just for clarity we don't need to use the if statement on the TryGet since in the case of the variable not being present environmentValue will be the default value for a string, so the null the check will return true, thus the method will return false.
|
||
return false; | ||
environmentVariables.TryGetValue("TF_BUILD", out var environmentValue); | ||
return string.IsNullOrWhiteSpace(environmentValue); |
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.
This expression needs to be inverted, otherwise the enricher will always be enabled.
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.
Should be updated with the inversion!
Merged! Thank you for your contribution. Much appreciated! 👍 |
fixes #1666
Changes
Added an enricher with same settings as GitHub Actions, looks for TF_BUILD, used Variables as reference. This will be set to true in build tasks.
Please upvote 👍 this pull request if you are interested in it.