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

DEVPROD-12824 Reset ~/.git-credentials between tasks #8482

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

malikchaya2
Copy link
Member

DEVPROD-12824

Description

This cleans up the default git-credential-store credential helper path.

Testing

Added to existing tests

Documentation

Added

@malikchaya2 malikchaya2 requested a review from a team November 19, 2024 19:15
Copy link
Contributor

@Kimchelly Kimchelly left a comment

Choose a reason for hiding this comment

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

LGTM mod small suggestion.


logger.Infof("Clearing git credentials.")
globalGitCredentialsPath := filepath.Join(a.opts.HomeDirectory, ".git-credentials")
if _, err := os.Stat(globalGitCredentialsPath); os.IsNotExist(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: you can use os.RemoveAll instead of os.Remove to have it ignore errors when the file doesn't exist. That avoids having to specifically stat the file. (same with the logic above)

Copy link
Member Author

Choose a reason for hiding this comment

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

I think Remove() plus the error check is safer here because we expect it to be a fileName and not have any children

@malikchaya2 malikchaya2 merged commit 58fc889 into evergreen-ci:main Nov 25, 2024
10 checks passed
@malikchaya2 malikchaya2 deleted the DEVPROD-12824 branch November 25, 2024 19:41
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.

2 participants