-
Notifications
You must be signed in to change notification settings - Fork 237
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
Fixing golangci-lint cache permission issue #565
Fixing golangci-lint cache permission issue #565
Conversation
/hold |
Could you clarify what this env var is and why it fixes the problem in commit message. |
Will do. As per [2] $XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used. The idea is to set it to a location where the go program (in this case golangci-lint) have write access. [1] golang/go#26280 |
/test unit |
As go disables the cache if go code does got expected user previlages to run. $XDG_CACHE_HOME will change the cache location from $HOME/.cache Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
a7c5256
to
798db4e
Compare
/hold cancel |
/test unit |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dgoodwin, LalatenduMohanty The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -208,5 +213,4 @@ clean: | |||
# TODO: reenable once the CI permission denied on /.cache is fixed. |
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.
Remove this line.
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.
Oops. I forgot to submit my review changes. :)
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.
Worked when XDG_CACHE_HOME = './' to bring the cache home to code path |
It seems like an issue when go code running in container as non-root user, and the user does not exist in the container. Go by default disables the cache. It seems we will need to set GOCACHE explicitly when running a build as a nonexistent user (in our case it is root I think) [1] . Not sure what user ID we are expected to use in the CI system.
As per [2] $XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.
The idea is to set it to a location where the go program (in this case golangci-lint) have write access.
[1] golang/go#26280
[2] https://specifications.freedesktop.org/basedir-spec/0.6/ar01s03.html
Signed-off-by: Lalatendu Mohanty lmohanty@redhat.com