Make CI job trace update intervals configurable

What does this MR do and why?

Makes CI job trace update intervals configurable at the instance level.

GitLab already tells GitLab Runner when to upload trace updates with the X-GitLab-Trace-Update-Interval header. The default values remain 60 seconds when a job log is not being watched and 3 seconds when it is being watched. This MR exposes those values through Application Settings, the Admin area, and the Settings API.

This lets self-managed administrators reduce the initial live log delay for short jobs without patching constants locally.

References

Closes #565373 (closed)

Screenshots or screen recordings

Not included. This adds two numeric fields to an existing Admin area settings form, and local GDK was not running.

How to set up and validate locally

  1. Go to Admin area > Settings > CI/CD > Job logs.
  2. Set Job log update interval to 10.
  3. Set Watched job log update interval to 3.
  4. Start a CI job with a runner.
  5. Confirm PATCH /api/v4/jobs/:id/trace responses include X-GitLab-Trace-Update-Interval: 10 before the job log is opened.
  6. Open the job log.
  7. Confirm subsequent trace PATCH responses include X-GitLab-Trace-Update-Interval: 3.

MR acceptance checklist

  • The existing default intervals stay unchanged.
  • The settings are documented for the Admin area and Settings API.
  • Tests cover defaults, validation, and runner trace response headers.

Local verification

  • git diff --check
  • mise exec -- ruby -e 'require "haml"; Haml::Engine.new(File.read("app/views/admin/application_settings/_job_logs_form.html.haml")); puts "haml parse ok"'
  • mise exec -- ruby -e 'require "yaml"; YAML.load_file("doc/api/openapi/openapi_v3.yaml"); puts "openapi yaml ok"'
  • mise exec -- ruby -e 'require "json"; JSON.parse(File.read("app/validators/json_schemas/application_setting_ci_cd_settings.json")); puts "json schema ok"'
  • mise exec -- ruby tooling/bin/gettext_extractor locale/gitlab.pot
  • mise exec -- bundle exec rspec spec/lib/gitlab/ci/trace_spec.rb spec/requests/api/ci/runner/jobs_trace_spec.rb spec/models/application_setting_spec.rb spec/requests/api/settings_spec.rb spec/views/admin/application_settings/ci_cd.html.haml_spec.rb (blocked: local bundle is missing gems)

Related to #565373 (closed)

Merge request reports

Loading
Loading