application

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

This file owns BackendSelector for the GitHubEvent domain. At present there is only one provider (GitHub), so selection is always a pass-through. The selector exists to preserve the same layering pattern as the build and buildtrigger domains and to make adding future providers (GitLab, Bitbucket) a localised change.

This file owns the Mapper for the GitHubEvent domain — the pure translation layer between the resolved GitHubEvent contract and the domain.GitHubEvent type consumed by the application service and provider.

The Mapper is copy-only: no defaults, no inference, no validation. Repository is split from "owner/name" into Owner and Name as a normalisation step — if the format is invalid, Owner is empty and Name carries the raw string.

Panics on nil input — a nil ResolvedGitHubEvent indicates a resolver bug.

This file owns GitHubEventService — the application service that orchestrates GitHubEvent reconciliation.

The pipeline mirrors the build and buildtrigger domains: map, select, execute, write. The service does not provision Argo resources directly — that belongs to the Provider. It does not make admission decisions — those belong to the provider result. It only sequences the four steps and ensures the CR always reflects the latest outcome.

This file owns StatusWriter for the GitHubEvent domain — the component responsible for persisting provider results back to the GitHubEvent CR.

Two writes happen in a single Status().Update call:

  1. Contract status — JSON-marshalled domain status written to Status.Contract. Authoritative and machine-readable.

  2. Conditions — a single metav1.Condition upserted for kubectl describe alignment and human observability.

StatusWriter is always called regardless of provider error so the CR always reflects the latest outcome.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendSelector

type BackendSelector struct {
	GitHub api.Provider
}

BackendSelector routes a GitHubEvent to the correct Provider. Currently always returns the GitHub provider.

func NewBackendSelector

func NewBackendSelector(github api.Provider) *BackendSelector

NewBackendSelector constructs a BackendSelector with the GitHub provider.

func (*BackendSelector) Default

func (b *BackendSelector) Default() api.Provider

Default returns the GitHub provider — the only registered provider.

func (*BackendSelector) ForEvent

ForEvent returns the provider for the given event. All events are currently GitHub events so selection is unconditional.

type GitHubEventService

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

GitHubEventService orchestrates GitHubEvent reconciliation. Stateless and safe for concurrent use.

func NewGitHubEventService

func NewGitHubEventService(
	mapper *Mapper,
	status *StatusWriter,
	backend *BackendSelector,
) *GitHubEventService

NewGitHubEventService constructs a GitHubEventService with the required collaborators.

func (*GitHubEventService) Reconcile

Reconcile maps the resolved event to a domain model, delegates provisioning to the provider, then writes the result back to the GitHubEvent CR. Status is always written — even when provisioning fails.

type Mapper

type Mapper struct{}

Mapper converts a ResolvedGitHubEvent into a pure domain.GitHubEvent. Stateless and safe for concurrent use.

func NewMapper

func NewMapper() *Mapper

NewMapper constructs a Mapper.

func (Mapper) MapResolvedToDomain

MapResolvedToDomain translates a ResolvedGitHubEvent into a domain.GitHubEvent. Panics if resolved or resolved.Spec is nil — these indicate a resolver bug.

type StatusWriter

type StatusWriter struct {
	Client client.Client
	Log    logr.Logger
}

StatusWriter persists a provider's result onto a GitHubEvent CR's status as contract status and conditions, regardless of provider error.

func NewStatusWriter

func NewStatusWriter(c client.Client, log logr.Logger) *StatusWriter

NewStatusWriter constructs a StatusWriter.

func (*StatusWriter) Write

func (w *StatusWriter) Write(ctx context.Context, gh *eventsv1alpha1.GitHubEvent, conditions ...metav1.Condition) error

Write merges the provided conditions and persists. Nothing else.

Jump to

Keyboard shortcuts

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