mirror of
https://gitea.com/gitea/runner.git
synced 2026-11-08 00:00:28 +00:00
enhance(report): add runner.log_report_level for the uploaded runner messages (#1310)
The runner's own messages between steps (not step output) were uploaded to the job log at `log.level`, so raising `log.level` for local debugging also changed what workflow authors see in Gitea, and lowering it hid messages from them. Add `runner.log_report_level` to set that independently. Unset, it still follows `log.level`, so existing setups behave as before. An invalid value is rejected when the config loads. Assisted-by: Codet Assisted-by: Claude Code:claude-opus-5-5 Co-authored-by: silverwind <[email protected]> Co-authored-by: silverwind <[email protected]> Reviewed-on: https://gitea.com/gitea/runner/pulls/1310 Co-authored-by: Lunny Xiao <[email protected]>
This commit is contained in:
1 parent
42858c61df
commit
9c4c66e70f
6 files changed
+28
-2
No files matched your search
@@ -76,6 +76,9 @@ runner:
|
||||
# Flush logs immediately when the buffer reaches this many rows.
|
||||
# This ensures bursty output (e.g., npm install) is delivered promptly.
|
||||
#log_report_batch_size: 100
|
||||
# The lowest severity of the runner's own messages (not step output) that are sent to the
|
||||
# job log between steps: trace, debug, info, warn, error. Default if omitted: follow log.level.
|
||||
#log_report_level: info
|
||||
# The interval for reporting task state (step status, timing) to the Gitea instance.
|
||||
# State is also reported on step transitions (start/stop) and after each log flush.
|
||||
#state_report_interval: 5s
|
||||
|
||||
@@ -76,6 +76,7 @@ type Runner struct {
|
||||
LogReportInterval time.Duration `yaml:"log_report_interval"` // LogReportInterval specifies the base interval for periodic log flush.
|
||||
LogReportMaxLatency time.Duration `yaml:"log_report_max_latency"` // LogReportMaxLatency specifies the max time a log row can wait before being sent.
|
||||
LogReportBatchSize int `yaml:"log_report_batch_size"` // LogReportBatchSize triggers immediate log flush when buffer reaches this size.
|
||||
LogReportLevel string `yaml:"log_report_level"` // LogReportLevel is the lowest level of the runner's own messages sent to the job log between steps. Empty, the default, follows log.level.
|
||||
StateReportInterval time.Duration `yaml:"state_report_interval"` // StateReportInterval specifies the interval for state reporting.
|
||||
ReportCloseTimeout time.Duration `yaml:"report_close_timeout"` // ReportCloseTimeout caps each RPC attempt when flushing the final logs and task state at job completion, on a detached context so a server cancel can't block the acknowledgement.
|
||||
Labels []string `yaml:"labels"` // Labels specify the labels of the runner. Labels are declared on each startup
|
||||
@@ -348,6 +349,11 @@ func LoadDefault(file string) (*Config, error) {
|
||||
if !slices.Contains(ToolCacheModes, cfg.Runner.ToolCacheMode) {
|
||||
return nil, fmt.Errorf("invalid runner.tool_cache_mode %q: must be one of %q", cfg.Runner.ToolCacheMode, ToolCacheModes)
|
||||
}
|
||||
if cfg.Runner.LogReportLevel != "" {
|
||||
if _, err := logging.ParseLevel(cfg.Runner.LogReportLevel); err != nil {
|
||||
return nil, fmt.Errorf("invalid runner.log_report_level: %w", err)
|
||||
}
|
||||
}
|
||||
if err := validateExtraHeaders(cfg.Runner.ExtraHeaders); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -172,6 +172,11 @@ func TestLoadDefault_ToolCacheMode(t *testing.T) {
|
||||
assert.Contains(t, err.Error(), "tool_cache_mode")
|
||||
}
|
||||
|
||||
func TestLoadDefault_RejectsInvalidLogReportLevel(t *testing.T) {
|
||||
_, err := LoadDefault(write(t, "runner:\n log_report_level: loud\n"))
|
||||
require.ErrorContains(t, err, "runner.log_report_level")
|
||||
}
|
||||
|
||||
func TestLoadDefault_LoadsExtraHeaders(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "config.yaml")
|
||||
require.NoError(t, os.WriteFile(path, []byte("runner:\n extra_headers:\n X-Proxy-Token: proxy-token\n"), 0o600))
|
||||
|
||||
Reference in new issue
Block a user