Skip to content

refactor: config restructure, ProviderRegistry, hot-reload completion, #127#147

Merged
coopernetes merged 2 commits into
mainfrom
config-restructure-and-hot-reload
Apr 13, 2026
Merged

refactor: config restructure, ProviderRegistry, hot-reload completion, #127#147
coopernetes merged 2 commits into
mainfrom
config-restructure-and-hot-reload

Conversation

@coopernetes
Copy link
Copy Markdown
Member

@coopernetes coopernetes commented Apr 13, 2026

Summary

  • Config restructure: lifts diff-scan: and secret-scan: out of commit: to top-level stanzas — they operate on the aggregate push, not individual commits, so nesting them under commit: was semantically wrong
  • Complete hot-reload: all reloadable sections now work (commit, diff-scan, secret-scan, rules, permissions, attestations); admin panel gains a section dropdown; LiveConfigLoader validates provider references before applying any reload so a bad override file can't partially mutate live config
  • Attestation questions promoted to global: moved out of providers.<name>.attestation-questions to a top-level attestations: list. Matches upstream finos/git-proxy's attestationConfig.questions shape (feature parity). Per-provider variants were an inadvertent scope expansion — they can come back as a future enhancement if users ask. Also fixes a latent bug where attestation changes in an externalized config were silently ignored because controllers read from the startup GitProxyConfig bean rather than ConfigHolder; reads now go through the live holder and reload cleanly
  • ProviderRegistry (Provider config: separate friendly name from type/host ID #127): consolidates ProviderConfigurationSource + ProviderRepository into a single ProviderRegistry interface; friendly provider names (github, gitlab) now accepted everywhere config references a provider — permissions:, rules:, users.scm-identities: — with backwards compat for the old type/host form
  • Startup validation: JettyConfigurationBuilder.validateProviderReferences() called before any DB or port setup; unknown provider references crash early with a clear message listing configured providers
  • Externalized config docs: documents the /app/conf/ classpath prepend pattern, GITPROXY_CONFIG_PROFILES, multi-profile layering, and the Gestalt list-replace caveat
  • Git source auth: GITPROXY_RELOAD_GIT_AUTH_USERNAME / GITPROXY_RELOAD_GIT_AUTH_PASSWORD — no config fields, just set the env vars for private repos. Clone is now shallow (depth=1) and uses a fresh temp dir per reload — no pull-on-force-push failures, no stale local state
  • secret-scan rename: aligns YAML key with diff-scan and internal class names (SecretScanConfig)

Breaking config changes

All changes are backwards-compatible for the type/host provider ID form. The only hard breaks:

Old key New key
commit.diff diff-scan: (top-level)
commit.secret-scanning secret-scan: (top-level)
providers.<name>.attestation-questions attestations: (top-level, global)

Existing git-proxy-local.yml and docker configs in this repo are updated.

Test plan

  • ./gradlew build passes (unit tests + jacoco threshold)
  • GitProxyConfigLoaderTestloadWithOverride cases verify all renamed keys parse correctly, including top-level attestations: partial overrides
  • JettyConfigurationBuilderTest — provider name resolution, validateProviderReferences
  • ConfigHotReloadE2ETest (Gitea, @Tag("e2e")) — one test per reloadable section
  • Smoke test: start dashboard, open Admin panel, verify section dropdown; trigger each section reload; confirm attestation questions appear in the reviewer approval form and changes via reload take effect without restart

@coopernetes coopernetes force-pushed the config-restructure-and-hot-reload branch 3 times, most recently from 634c4e5 to abb3513 Compare April 13, 2026 06:26
Restructures the YAML configuration layout, adds hot-reload support for
all config sections, and enables externalized config from git or file
sources with optional auth. Also fixes several bugs uncovered during
e2e testing of the new hot-reload path.

Config restructure:
- Lift diff-scan and secret-scanning to top-level config sections
- Consolidate to ProviderRegistry; resolve provider names in config
- Rename secret-scanning → secret-scan for consistency with diff-scan
- Validate provider cross-references at startup and before hot-reload
- Update config files to use friendly provider names

Hot-reload:
- Complete hot-reload support across all per-section config sources
- Fresh clone on each git config reload to handle force-push

Externalized config:
- Add loadWithOverride integration tests and document externalized config pattern
- Add git auth for reload source via GITPROXY_RELOAD_GIT_AUTH_* env vars
- Note Gestalt list-replace caveat in multi-profile section docs

UI fixes:
- PushDetail: match providers by id (not name) so attestation questions resolve
- Repos page: show hostname only (e.g. github.com) via provider.id lookup

Bug fixes:
- EnrichPushCommitsFilter.constructRemoteUrl: use full provider URI
  (scheme + host + port) instead of hardcoding https:// — fixes clone
  failures against non-GitHub providers in e2e tests
- LocalRepositoryCache: always call refreshIfStale on cache hits, not
  only when credentials are supplied
- CheckHiddenCommitsFilter: mark commitFrom as uninteresting boundary
  in RevWalk so stale local clone refs don't cause false positives

E2e test isolation:
- Each test in ProxyModeE2ETest and ConfigHotReloadE2ETest now creates
  its own Gitea repo in @beforeeach, eliminating all shared state and
  ordering dependencies between tests
- ConfigHotReloadE2ETest also gets a fresh HotReloadJettyFixture per
  test so config state never leaks between methods
- Remove @Order/@TestMethodOrder from both classes
@coopernetes coopernetes force-pushed the config-restructure-and-hot-reload branch from 626465e to 31e1653 Compare April 13, 2026 10:58
@coopernetes coopernetes merged commit ac4e85d into main Apr 13, 2026
12 checks passed
@coopernetes coopernetes deleted the config-restructure-and-hot-reload branch April 13, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant