Skip to content

Fix environment variable processing. (#406) - #407

Merged
Giulia Stocco (gfs) merged 8 commits into
microsoft:mainfrom
radolin:radolin/main
May 10, 2023
Merged

Giulia Stocco (gfs) merged 8 commits into
microsoft:mainfrom
radolin:radolin/main

Conversation

@radolin

@radolin Radoslav Kolev (radolin) commented Mar 9, 2023 •

Copy link
Copy Markdown
Contributor

Search for static and non public members as well when overriding values. Here's how the member is defined in GitHubHealthAlgorithm.cs:
private static string? ENV_GITHUB_ACCESS_TOKEN = null;

Searching for public members only misses it and it's never set from the environment variable.
I don't know if this is the right way to fix this, but at least it get's me one step further and I can actually run the oss-health tool for an npm project.

Search for static and non public members as well when overriding values.
@gfs

Copy link
Copy Markdown
Contributor

Hi Radoslav Kolev (@radolin),

Thanks for the report and proposed fix. I'll have to think about this a bit. It might be better just to make the GitHub token field public and non-static - I don't think there's a particular reason for it to be private - or static - but overriding private vars in other circumstances might not be something we want.

@gfs

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@gfs

Copy link
Copy Markdown
Contributor

This report revealed a number of environment variables with the incorrect settings (private or static). I went through and instead of modifying environment helper, changed all properties we intend to be overridden by Environment Helper to be Public instance variables.

@gfs

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@radolin

Copy link
Copy Markdown
Contributor Author

After your changes I was back to always getting the "Missing GitHub access token. Please define GITHUB_ACCESS_TOKEN." error. I've added 2 commits making ENV_GITHUB_ACCESS_TOKEN a property and changed EnvironmentHelper to look for properties instead of fields. Now it can process the GITHUB_ACCESS_TOKEN environment variable again.

@radolin

Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 407 in repo microsoft/OSSGadget

@jpinz

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@gfs

Copy link
Copy Markdown
Contributor

Thanks Radoslav Kolev (@radolin) for catching the needed change to grab properties.

@gfs

Copy link
Copy Markdown
Contributor

Radoslav Kolev (@radolin) one more thing, can you reply to the Contributor agreement bot? I can't accept the contribution otherwise.

Julian (@jpinz) any comments/concerns here?

@radolin

Copy link
Copy Markdown
Contributor Author

Radoslav Kolev (@radolin) one more thing, can you reply to the Contributor agreement bot? I can't accept the contribution otherwise.

Will, do, just need to get the blessing from legal for a new CLA. Might take a couple of days.

@jpinz Julian (jpinz) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Assuming it works and everything, LGTM

@gfs

Copy link
Copy Markdown
Contributor

Radoslav Kolev (@radolin) any update from your legal team?

@radolin

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="SUSE"

@radolin

Copy link
Copy Markdown
Contributor Author

All checks seem green now, sorry for the delay.

@gfs
Giulia Stocco (gfs) merged commit 654963b into microsoft:main May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants