MCPcopy Create free account
hub / github.com/cloudbase/garm / InstallRepoWebhook

Method InstallRepoWebhook

runner/repositories.go:432–452  ·  view source on GitHub ↗
(ctx context.Context, repoID string, param params.InstallWebhookParams)

Source from the content-addressed store, hash-verified

430}
431
432func (r *Runner) InstallRepoWebhook(ctx context.Context, repoID string, param params.InstallWebhookParams) (params.HookInfo, error) {
433 if !auth.IsAdmin(ctx) {
434 return params.HookInfo{}, runnerErrors.ErrUnauthorized
435 }
436
437 repo, err := r.store.GetRepositoryByID(ctx, repoID)
438 if err != nil {
439 return params.HookInfo{}, fmt.Errorf("error fetching repo: %w", err)
440 }
441
442 poolManager, err := r.poolManagerCtrl.GetRepoPoolManager(repo)
443 if err != nil {
444 return params.HookInfo{}, fmt.Errorf("error fetching pool manager for repo: %w", err)
445 }
446
447 info, err := poolManager.InstallWebhook(ctx, param)
448 if err != nil {
449 return params.HookInfo{}, fmt.Errorf("error installing webhook: %w", err)
450 }
451 return info, nil
452}
453
454func (r *Runner) UninstallRepoWebhook(ctx context.Context, repoID string) error {
455 if !auth.IsAdmin(ctx) {

Callers

nothing calls this directly

Calls 4

IsAdminFunction · 0.92
GetRepositoryByIDMethod · 0.65
GetRepoPoolManagerMethod · 0.65
InstallWebhookMethod · 0.65

Tested by

no test coverage detected