refactor: separate Config from on-disk format #1377
No reviewers
Labels
No labels
FreeBSD
Kind/Breaking
Kind/Bug
Kind/Chore
Kind/DependencyUpdate
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Windows
linux-powerpc64le
linux-riscv64
linux-s390x
run-end-to-end-tests
run-forgejo-tests
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo/runner!1377
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "aahlenst/runner:config-refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Separate
Configfrom the on-disk format. That has multiple advantages:Configis easier to change. Fields retained for backwards compatibility do no longer have to be carried around.file:///path/to/secretinto the actual secret value (not implemented yet) can be performed while constructingConfigand cached. No separate fields are necessary.*booldo no longer have to be carried around.New(), which replacesLoadDefault(), offers functional options.New()produces the default configuration without requiring gymnastics with empty file names. To overlay the default configuration with a (partial) configuration from a YAML configuration file, useNew(FromFile("/path/to/config.yaml")).The refactoring is designed to have minimal impact on existing code and tests. It is supposed to be fully backwards-compatible. The only user-facing change is the emission of warnings if invalid configuration values are encountered. Previously, those were silently ignored.
Notes/Questions:
Host,Containeretc. weird becauseHostis not a host, but configuration for the host. I'd preferHostSettingsorHostConfigurationor something like that (to be changed in a separate PR). However, ifHostshould stay long-term, then it would probably make sense to renameserializedHostSettingstoserializedHost.cascading-pr updated at actions/setup-forgejo#887
@aahlenst wrote in #1377 (comment):
The name is a little awkward, I agree. There's so little in there...
workdir_parent... I'd argue it probably belongs more in therunnersection, eliminating the naming problem? But in a separate refactoring PR.These warnings don't induce a lot of fear in me like a user is going to be trying to configure one thing, and getting something drastically different with dangerous outcomes. I think they're fine as warnings.
Indeed; not my favourite part of Go. The interpretations you've made make sense to me, but there are a lot of affected settings where they're unconditionally read from the deserialized data. I think it is correct at this time, at least.
@aahlenst Minor issue,
report_retrysection reports warnings if absent from the config file:@mfenniak wrote in #1377 (comment):
It's not only
Host, but all of them.config.Containerisn't a container either. What about renaming the types toHostSettings,ContainerSettings?Happy to fix if we encounter problems. It should get better with Go 1.26 once we upgrade.
PR to silence the unnecessary warnings is up: #1381