common

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GHHeaderEvent    = "X-GitHub-Event"
	GHHeaderDelivery = "X-GitHub-Delivery"
)

Variables

Functions

func GracefulShutdown

func GracefulShutdown(server *http.Server, logger *zap.SugaredLogger, stopCh <-chan struct{}, done chan<- bool)

GracefulShutdown gracefully shutdown server

func SecretFrom

func SecretFrom(ctx context.Context, secretCli clientcorev1.SecretInterface, sel *corev1.SecretKeySelector) (string, error)

SecretFrom gets the value of the Secret key referenced by sel from the Kubernetes cluster.

func SubjectAndExtensionsFromGitHubEvent added in v0.22.0

func SubjectAndExtensionsFromGitHubEvent(gitHubEvent gh.Event, payload interface{}, logger *zap.SugaredLogger) (string, map[string]interface{})

SubjectAndExtensionsFromGitHubEvent computes the CE subject from GitHub event

Types

type Handler

type Handler struct {
	Logger  *zap.SugaredLogger
	Client  cloudevents.Client
	Hook    *gh.Webhook
	Source  string
	SinkURI string
}

func NewHandler

func NewHandler(ceClient cloudevents.Client, sinkURI, source, secretToken string, logger *zap.SugaredLogger) *Handler

New creates an adapter to convert incoming GitHub webhook events from a single source to CloudEvents and then sends them to the specified Sink

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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