webhook

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DockerHubWebhook

type DockerHubWebhook struct {
	// contains filtered or unexported fields
}

DockerHubWebhook handles Docker Hub webhook events

func NewDockerHubWebhook

func NewDockerHubWebhook(secret string) *DockerHubWebhook

NewDockerHubWebhook creates a new Docker Hub webhook handler

func (*DockerHubWebhook) GetRegistryType

func (d *DockerHubWebhook) GetRegistryType() string

GetRegistryType returns the registry type this handler supports

func (*DockerHubWebhook) Parse

func (d *DockerHubWebhook) Parse(r *http.Request) (*WebhookEvent, error)

Parse processes the Docker Hub webhook payload and returns a WebhookEvent

func (*DockerHubWebhook) Validate

func (d *DockerHubWebhook) Validate(r *http.Request) error

Validate validates the Docker Hub webhook payload

type GHCRWebhook

type GHCRWebhook struct {
	// contains filtered or unexported fields
}

GHCRWebhook handles GitHub Container Registry webhook events

func NewGHCRWebhook

func NewGHCRWebhook(secret string) *GHCRWebhook

NewGHCRWebhook creates a new GHCR webhook handler

func (*GHCRWebhook) GetRegistryType

func (g *GHCRWebhook) GetRegistryType() string

GetRegistryType returns the registry type this handler supports

func (*GHCRWebhook) Parse

func (g *GHCRWebhook) Parse(r *http.Request) (*WebhookEvent, error)

Parse processes the GHCR webhook payload and returns a WebhookEvent

func (*GHCRWebhook) Validate

func (g *GHCRWebhook) Validate(r *http.Request) error

Validate validates the GHCR webhook payload

type HarborWebhook

type HarborWebhook struct {
	// contains filtered or unexported fields
}

HarborWebhook handles Harbor Registry webhook events

func NewHarborWebhook

func NewHarborWebhook(secret string) *HarborWebhook

NewHarborWebhook creates a new Harbor webhook handler

func (*HarborWebhook) GetRegistryType

func (h *HarborWebhook) GetRegistryType() string

GetRegistryType returns the registry type this handler supports

func (*HarborWebhook) Parse

func (h *HarborWebhook) Parse(r *http.Request) (*WebhookEvent, error)

Parse processes the Harbor webhook payload and returns a WebhookEvent

func (*HarborWebhook) Validate

func (h *HarborWebhook) Validate(r *http.Request) error

Validate validates the Harbor webhook payload

type QuayWebhook

type QuayWebhook struct {
	// contains filtered or unexported fields
}

func NewQuayWebhook

func NewQuayWebhook(secret string) *QuayWebhook

func (*QuayWebhook) GetRegistryType

func (q *QuayWebhook) GetRegistryType() string

GetRegistryType returns the type this handler supports

func (*QuayWebhook) Parse

func (q *QuayWebhook) Parse(r *http.Request) (*WebhookEvent, error)

Parse process the Quay webhook and returns a Webhook event from the event

func (*QuayWebhook) Validate

func (q *QuayWebhook) Validate(r *http.Request) error

Validates checks the Quay webhook payload to see if its valid

type RegistryWebhook

type RegistryWebhook interface {
	// Parse processes the webhook payload and returns a WebhookEvent
	Parse(r *http.Request) (*WebhookEvent, error)
	// Validate validates the webhook payload
	Validate(r *http.Request) error
	// GetRegistryType returns the type of registry this handler supports
	GetRegistryType() string
}

RegistryWebhook interface defines methods for handling registry webhooks

type WebhookEvent

type WebhookEvent struct {
	// RegistryURL is the URL of the registry that sent the webhook
	RegistryURL string `json:"registryUrl,omitempty"`
	// Repository is the repository name
	Repository string `json:"repository,omitempty"`
	// Tag is the image tag
	Tag string `json:"tag,omitempty"`
	// Digest is the content digest of the image
	Digest string `json:"digest,omitempty"`
}

WebhookEvent represents a generic webhook payload

type WebhookHandler

type WebhookHandler struct {
	// contains filtered or unexported fields
}

WebhookHandler manages webhook handlers for different registry types

func NewWebhookHandler

func NewWebhookHandler() *WebhookHandler

NewWebhookHandler creates a new webhook handler

func (*WebhookHandler) ProcessWebhook

func (h *WebhookHandler) ProcessWebhook(r *http.Request) (*WebhookEvent, error)

ProcessWebhook processes an incoming webhook request and returns a WebhookEvent

func (*WebhookHandler) RegisterHandler

func (h *WebhookHandler) RegisterHandler(handler RegistryWebhook)

RegisterHandler registers a webhook handler for a specific registry type

type WebhookServer

type WebhookServer struct {
	// Port is the port number to listen on
	Port int
	// Handler is the webhook handler
	Handler *WebhookHandler
	// UpdaterConfig holds configuration for image updating
	UpdaterConfig *argocd.UpdateConfiguration
	// KubeClient is the Kubernetes client
	KubeClient *kube.ImageUpdaterKubernetesClient
	// ArgoClient is the ArgoCD client
	ArgoClient argocd.ArgoCD
	// Server is the HTTP server
	Server *http.Server

	// rate limiter to limit requests in an interval
	RateLimiter ratelimit.Limiter
	// contains filtered or unexported fields
}

WebhookServer manages webhook endpoints and triggers update checks

func NewWebhookServer

func NewWebhookServer(port int, handler *WebhookHandler, kubeClient *kube.ImageUpdaterKubernetesClient, argoClient argocd.ArgoCD) *WebhookServer

NewWebhookServer creates a new webhook server

func (*WebhookServer) Start

func (s *WebhookServer) Start() error

Start starts the webhook server

func (*WebhookServer) Stop

func (s *WebhookServer) Stop() error

Stop stops the webhook server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL