-
Notifications
You must be signed in to change notification settings - Fork 2
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
New feature: System diagnostics functions #98
Open
rmbielby
wants to merge
20
commits into
main
Choose a base branch
from
feature/sys-diagnostics
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ironment variable to the test script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brief overview of changes
I've added a master
diagnostics_test()
function to sit as a master diagnostics function to run any diagnostic scripts we add. So far it encompasses the following two functions that I've also added as part of this PR:check_proxy_settings()
- this looks for (and removes ifclean=TRUE
) any rogue proxy settings in the Git configurationcheck_github_pat()
- this looks for (and removes ifclean=TRUE
) the system variable GITHUB_PAT, which prevents analysts from installing packages from GitHubcheck_renv_download_method()
- checks if the renv_download_method has been set in the .Renviron file and flags if either a) it's not set, or b) it's set to something other than "curl". If run withclean=TRUE
, then it removes any none-curl setting and adds a line to .Renviron setting the method to curl.Why are these changes being made?
Analysts sometimes hit issues with settings on their laptop (usually that they've set themselves after following outdated guidance) and find it difficult to diagnose and fix these issues themselves. We need a way for them to do this in an automated way.
Detailed description of changes
All the extra code is self contained in the diagnostic_test.R script:
diagnostic_test()
check_proxy_settings()
check_github_pat()
check_renv_download_method()
The functions have some consistent params:
I've also added an override parameter for each function, that mainly just helps with testing, but could conceivably be used by us to deal with unusual cases, e.g. you can set the config keys to search for and remove in
clean_proxy_settings()
if there's a key other than http.proxy and https.proxy that's causing problems.I've added tests for the individual check_* functions. Except for
check_github_pat()
as I couldn't find a way to identify the contents ofSys.getenv("GITHUB_PAT")
when running on GitHub Actions. It seems to return something that looks like a string "***", but doesn't act like one (i.e. I can't do logic on it andstr_replace_all("*", "")
doesn't reduce it to a blank string). Main thought is that it's acting as some sort of secret / encrypted variable, but couldn't find anything remotely equivalent from searching online. The test that I had worked fine locally, but just won't work equivalently on GitHub Actions.Additional information for reviewers
Issue ticket number/s and link
#63