webhook

package
v0.0.0-...-eba290e Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultGitHubURL = "https://github.com"
	KeyFileName      = "key"
)

Variables

View Source
var (
	// ErrNoPEMBlock gets triggered when there is no PEM block in the provided file
	ErrNoPEMBlock = errors.New("failed to decode the data as PEM block (are you sure this is a pem file?)")
	// ErrFailedPEMParsing gets returned when PKCS1, PKCS8 or PKIX key parsing fails
	ErrFailedPEMParsing = errors.New("failed parsing the PEM block: unsupported PEM type")
	// ErrUnknownKeyType gets returned when we can't recognize the key type
	ErrUnknownKeyType = errors.New("unknown key type")
)
View Source
var ErrNotImplemented = errors.New("this functionality is not implemented yet")

Functions

This section is empty.

Types

type EnvConfig

type EnvConfig struct {
	// Port indicates what port the app is served on.
	Port int `envconfig:"PORT" required:"true" default:"8080"`

	// DevMode is enabled only for initial PoC/testing of the app.  This flow
	// will be removed and must not be used for production deployments.
	DevMode bool `envconfig:"DEV_MODE" default:"false"`

	// KMSKey records the KMS identifier for the signing key to use for
	// interactions with the GitHub instance. When DevMode is true, this is
	// parsed as a path to a private key file on disk.
	KMSKey string `envconfig:"KMS_KEY" required:"true"`

	// GitHubURL indicates the URL of the GitHub instance the app is deployed
	// for.
	GitHubURL string `envconfig:"GITHUB_URL" default:"https://github.com"`

	// AppID indicates the app's ID provided by the GitHub instance the app is
	// deployed on.
	AppID int64 `envconfig:"GITHUB_APP_ID" required:"true"`

	// WebhookSecret contains the secret configured with the GitHub instance for
	// communications from the server.
	WebhookSecret string `envconfig:"GITHUB_WEBHOOK_SECRET" required:"true"`

	// AppEmailID is the email ID used for commits created by the app.
	AppEmailID string `envconfig:"APP_EMAIL_ID" required:"true"`

	// CloudProvider identifies the cloud provider used for the KMS and secrets
	// manager.
	CloudProvider string `envconfig:"CLOUD_PROVIDER" default:"gcp"`

	// AppSigningKey indicates the secret used as the signing private key for
	// the app's signatures.
	AppSigningKey string `envconfig:"APP_SIGNING_KEY" required:"true"`

	// AppSigningPubKey indicates the secret used as the public key for the
	// app's signatures.
	AppSigningPubKey string `envconfig:"APP_SIGNING_PUBKEY" required:"true"`

	// AppSigningMethod indicates the method used to sign metadata and commits
	// by the app.
	AppSigningMethod string `envconfig:"APP_SIGNING_METHOD" default:"ssh"`

	// CommentOnAffectedPRs indicates whether the app should post a comment
	// on PRs where prior approvals do not hold when the base branch is
	// affected by a push or a merge.
	CommentOnAffectedPRs bool `envconfig:"COMMENT_ON_AFFECTED_PRS" default:"false"`

	// UseGitHubAPI indicates whether to use the GitHub API for certain actions
	// like determining the target tree for a merge.
	UseGitHubAPI bool `envconfig:"USE_GITHUB_API" default:"false"`
}

type GittufApp

type GittufApp struct {
	Transport     *ghinstallation.AppsTransport
	WebhookSecret [][]byte
	Params        *EnvConfig
	// contains filtered or unexported fields
}

func (*GittufApp) ServeHTTP

func (g *GittufApp) 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