-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix Actions being enabled accidentally #24802
Conversation
I'm surprised there was no such line before #24536, so |
Uh ... yes:
(Not sure if it's the right way) gitea/modules/setting/actions.go Lines 12 to 19 in c53ad05
|
I see. I think this config system is in for an rewrite anyways, I don't like that there are two places to define a default, and the casing difference is also confusing and unnecessary. I'd like us to use https://github.com/kelseyhightower/envconfig and map back the env vars to the config struct, but it will be a massive rewrite. |
I think @silverwind is right. Maybe we should use the variable instead of the |
See #24804 for some ideas regarding config system. |
Done: 845f86e |
Regression of go-gitea#24536. If the user doesn't explicitly disable Actions, it will be enabled. 1. Gitea will call `loadRepositoryFrom` before `loadActionsFrom`. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/setting.go#L234-L237 2. In `loadRepositoryFrom`, `rootCfg.Section("actions").Key("ENABLED").MustBool(true)` will set `actions.ENABLED` with `true`. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/repository.go#L313-L315 3. In `loadActionsFrom`, `rootCfg.Section("actions")` will get a section with Actions enabled. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/actions.go#L23-L26 Although the cause of the problem was using `true` by copy-paste mistake, it also surprised me that **`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` doesn't only read, but also write.**
Backport #24802 by @wolfogre Regression of #24536. If the user doesn't explicitly disable Actions, it will be enabled. 1. Gitea will call `loadRepositoryFrom` before `loadActionsFrom`. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/setting.go#L234-L237 2. In `loadRepositoryFrom`, `rootCfg.Section("actions").Key("ENABLED").MustBool(true)` will set `actions.ENABLED` with `true`. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/repository.go#L313-L315 3. In `loadActionsFrom`, `rootCfg.Section("actions")` will get a section with Actions enabled. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/actions.go#L23-L26 Although the cause of the problem was using `true` by copy-paste mistake, it also surprised me that **`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` doesn't only read, but also write.** Co-authored-by: Jason Song <i@wolfogre.com>
* main: (90 commits) Refactor rename user and rename organization (go-gitea#24052) Use `CommentList` instead of `[]*Comment` (go-gitea#24828) Fix topics deleted via API not being deleted in org page (go-gitea#24825) Return `404` in the API if the requested webhooks were not found (go-gitea#24823) Decouple the different contexts from each other (go-gitea#24786) [skip ci] Updated translations via Crowdin Add RTL rendering support to Markdown (go-gitea#24816) [skip ci] Updated translations via Crowdin Update JS dependencies (go-gitea#24815) Fix duplicate tooltip hiding (go-gitea#24814) Mute repo names in dashboard repo list (go-gitea#24811) Rework label colors (go-gitea#24790) Fix max width and margin of comment box on conversation page (go-gitea#24809) Allow all URL schemes in Markdown links by default (go-gitea#24805) Some refactors for issues stats (go-gitea#24793) Implement actions artifacts (go-gitea#22738) Fix Actions being enabled accidentally (go-gitea#24802) Change `add_on` in `keys_ssh.tmpl` (go-gitea#24803) replace `drone exec` to `act_runner exec` in test README.md (go-gitea#24791) Fix OAuth loading state (go-gitea#24788) ...
Backport go-gitea#24802 by @wolfogre Regression of go-gitea#24536. If the user doesn't explicitly disable Actions, it will be enabled. 1. Gitea will call `loadRepositoryFrom` before `loadActionsFrom`. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/setting.go#L234-L237 2. In `loadRepositoryFrom`, `rootCfg.Section("actions").Key("ENABLED").MustBool(true)` will set `actions.ENABLED` with `true`. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/repository.go#L313-L315 3. In `loadActionsFrom`, `rootCfg.Section("actions")` will get a section with Actions enabled. https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/actions.go#L23-L26 Although the cause of the problem was using `true` by copy-paste mistake, it also surprised me that **`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` doesn't only read, but also write.** Co-authored-by: Jason Song <i@wolfogre.com> (cherry picked from commit b369ed5)
Regression of #24536. If the user doesn't explicitly disable Actions, it will be enabled.
loadRepositoryFrom
beforeloadActionsFrom
.gitea/modules/setting/setting.go
Lines 234 to 237 in 25d4f95
loadRepositoryFrom
,rootCfg.Section("actions").Key("ENABLED").MustBool(true)
will setactions.ENABLED
withtrue
.gitea/modules/setting/repository.go
Lines 313 to 315 in 25d4f95
loadActionsFrom
,rootCfg.Section("actions")
will get a section with Actions enabled.gitea/modules/setting/actions.go
Lines 23 to 26 in 25d4f95
Although the cause of the problem was using
true
by copy-paste mistake, it also surprised me thatrootCfg.Section("actions").Key("ENABLED").MustBool(true)
doesn't only read, but also write.