Skip to content
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

Merged

Conversation

BlazeFace
Copy link
Contributor

fixes #1666

  • I have read the Contribution Guidelines
  • I have commented on the issue above and discussed the intended changes
  • A maintainer has signed off on the changes and the issue was assigned to me
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors
  • The documentation was modified to reflect the changes OR no documentation changes are required.

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.

{
if (environmentVariables.TryGetValue("TF_BUILD", out var value))
{
return value?.Equals("true", StringComparison.OrdinalIgnoreCase) ?? false;
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

Copy link
Contributor Author

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.

@github-actions github-actions bot added the ⭐ top pull request Top pull request. label Nov 4, 2024
@github-actions github-actions bot mentioned this pull request Nov 4, 2024

return false;
environmentVariables.TryGetValue("TF_BUILD", out var environmentValue);
return string.IsNullOrWhiteSpace(environmentValue);
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@patriksvensson patriksvensson merged commit a87277e into spectreconsole:main Nov 4, 2024
3 checks passed
@patriksvensson
Copy link
Contributor

Merged! Thank you for your contribution. Much appreciated! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ top pull request Top pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markup Not Working in Azure Pipelines
2 participants