-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Gitea Snap update issue #16209 #17157
Conversation
Codecov Report
@@ Coverage Diff @@
## main #17157 +/- ##
==========================================
- Coverage 45.31% 45.30% -0.02%
==========================================
Files 773 774 +1
Lines 86873 87056 +183
==========================================
+ Hits 39366 39440 +74
- Misses 41151 41230 +79
- Partials 6356 6386 +30
Continue to review full report at Codecov.
|
modules/setting/setting.go
Outdated
return strings.ReplaceAll(appPath, "\\", "/"), err | ||
appPath = strings.ReplaceAll(appPath, "\\", "/") | ||
|
||
// Fix issue 16209 |
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.
Can you write more comments here? It will be easier for other people to understand what the issue is and how it 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.
I added comments about the problem, and how it 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.
Thank you, it's clear for me. I think we should be more careful here:
- We should check whether the
current
path really exists and is valid. If not, an ERROR log should be reported, and fallback to use old AppPath. - We should output an INFO level log to tell users that we are in SNAP and have changed the AppPath for this purpose. Or users may be confused by this behavior (it will be very hard to debug)
Here is the solution I was talking about in the issue ticket: replace
then put the following in the snapcraft yaml above the make build command
(note: I'm not 100% sure the above filepath is correct, please ensure it is correct) |
@techknowlogick It's not a good idea to hard code the path in source code when building, what if sys admin changed the snap path ... Can we find someway to pass the AppPath by environment variables provided by snap system? I have no experience with snap, but I think there should be some way: https://snapcraft.io/docs/environment-variables , https://snapcraft.io/docs/parts-environment-variables . |
@wxiaoguang yeah, we could do similarly to the |
@techknowlogick I like this approach, as it would be cleaner and simpler than my hack. However we still have to get the right path, which it does not look like snap is providing. But we could derive it from the other snap variables by adding something like this to the snap environment: Should I try this approach instead? |
@OleHusgaard oh yea! That's a great approach, thanks :) |
The problem should have been fixed by |
Fixes #16209 for new repositories created. The problem is that hooks in new repositories created when running in snap include the snap revision in the path. As the snap is refreshed the hooks eventually break.
This pull request does not fix repositories already created. Here a good workaround has been suggested by JensTheCoder.
Please be aware that I am a newbie to both gitea, snap and golang.