autobuild

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSignature is returned when the webhook signature does not match the payload.
	ErrInvalidSignature = errors.New("invalid webhook signature")
	// ErrSecretNotConfigured is returned when the webhook secret cannot be retrieved from Kubernetes.
	ErrSecretNotConfigured = errors.New("webhook secret not configured")
)

Functions

This section is empty.

Types

type ProcessWebhookParams

type ProcessWebhookParams struct {
	ProviderType    git.ProviderType
	SignatureHeader string
	Signature       string
	SecretKey       string
	Payload         []byte
}

ProcessWebhookParams holds all parameters needed to process a webhook event.

type Service

type Service interface {
	// ProcessWebhook validates and processes an incoming webhook event from a git provider.
	ProcessWebhook(ctx context.Context, params *ProcessWebhookParams) (*WebhookResult, error)
}

Service defines the autobuild operations.

func NewService

func NewService(k8sClient client.Client, processor WebhookProcessor, logger *slog.Logger) Service

NewService creates a new autobuild service.

type WebhookProcessor

type WebhookProcessor interface {
	ProcessWebhook(ctx context.Context, provider git.Provider, payload []byte) ([]string, error)
}

WebhookProcessor handles the core webhook processing: finding affected components and triggering builds. webhookProcessor (in this package) satisfies this interface.

func NewWebhookProcessor added in v1.0.0

func NewWebhookProcessor(k8sClient client.Client, workflowTrigger WorkflowRunTrigger, logger *slog.Logger) WebhookProcessor

NewWebhookProcessor creates a new webhookProcessor that implements WebhookProcessor.

type WebhookResult

type WebhookResult struct {
	AffectedComponents []string
}

WebhookResult holds the result of a processed webhook event.

type WorkflowRunTrigger added in v1.0.0

type WorkflowRunTrigger interface {
	TriggerWorkflow(ctx context.Context, namespaceName, projectName, componentName, commit string) (*models.WorkflowRunTriggerResponse, error)
}

WorkflowRunTrigger is implemented by a workflow run service to trigger a workflow run for a component without user-level authorization (webhook requests are authenticated via HMAC signature validation instead).

Jump to

Keyboard shortcuts

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