Repository navigation
refactor: migrate webhooks to scmclients - #1734
jenkins-x-bot merged 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the shared SCM client migration.
No open issues 🎉
What changed in this PR
Migrates webhooks to shared scmclients initialization, continuing the client consolidation from #1729 and removing per-request client setup.
Changes:
- Initialize webhook clients once at startup, honour
--bot-name, and support token rotation in file browsers. - Inject the periodic agent’s SCM client directly and remove obsolete client and authentication helpers.
- Update tests to use shared clients and clean up their resources.
| File | Description |
|---|---|
test/e2e/helpers.go |
Remove redundant authentication setup. |
pkg/webhook/webhook.go |
Initialize and reuse shared clients at startup. |
pkg/webhook/webhook_test.go |
Adopt shared clients and add cleanup. |
pkg/webhook/events.go |
Remove bespoke file-browser initialization. |
pkg/webhook/create_agent_integration_test.go |
Use shared clients with registered cleanup. |
pkg/util/scmclient.go |
Remove obsolete SCM client and token helpers. |
pkg/util/scmclient_test.go |
Remove tests for deleted token helpers. |
pkg/plugins/trigger/periodic.go |
Remove fallback SCM client creation. |
Review effort: Balanced
|
/cc @msvticket |
msvticket
left a comment
There was a problem hiding this comment.
Looks good.
I note that scmclient.go is exported to lighthouse-client: https://github.com/jenkins-x/lighthouse-client/blob/main/pkg/util/scmclient.go
So in principle this is a breaking change of lighthouse-client. But I don't see that anything is using those methods outside of lighthouse, so it's fine.
There are stuff in pkg/util that should be public, but I think neither scmclient nor scmclients should be. Maybe that is something you can address when you continue your work on lighthouse.
https://github.com/jenkins-x/lighthouse-client/blob/main/recreate.sh#L20
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: msvticket The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Failed to merge this PR at Tue, 17 Nov 2026 12:11:25 UTC due to:
|
Changelog
webhooksbuilds its clients once at startup withscmclients.Newrather than rebuilding the go-scm client, resetting git credentials and replacing the sharedClientAgenton every request.util.GetSCMClientfallback is removed.util.GetSCMClient,util.AddAuthToSCMClientandutil.GetSCMToken, which no longer have callers.--bot-nameflag is now honoured (it was ignored previously).Context
Follow-up to #1729, migrating the last process onto
scmclients. Behaviour changes:GIT_TOKEN_PATH. Previously they kept the token from the first request.