github

package
v0.0.0-...-53d3859 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleGithubClient

type GoogleGithubClient struct {
	Repositories GoogleGithubRepoService
	*ggithub.Client
}

GoogleGithubClient is a client that has the ability to replace the actual git client.

func NewGoogleGithubClient

func NewGoogleGithubClient(httpClient *http.Client, repoMock GoogleGithubRepoService) GoogleGithubClient

NewGoogleGithubClient creates a wrapper around the GitHub client.

type GoogleGithubRepoService

type GoogleGithubRepoService interface {
	CreateHook(ctx context.Context, owner, repo string, hook *ggithub.Hook) (*ggithub.Hook, *ggithub.Response, error)
}

GoogleGithubRepoService is an interface defining the Wrapper Interface needed to test the GitHub client.

type Platform

type Platform struct {
	Logger logr.Logger
	// contains filtered or unexported fields
}

Platform is a GitHub based platform implementation.

func NewGithubPlatformProvider

func NewGithubPlatformProvider(log logr.Logger) *Platform

NewGithubPlatformProvider creates a new hook platform provider for GitHub.

func (*Platform) CheckoutCode

func (g *Platform) CheckoutCode(ctx context.Context, event *v1alpha1.KrokEvent, repository *v1alpha1.KrokRepository, location string) (string, error)

CheckoutCode will get the code given an event which needs the codebase. It will create a ZIP file from the source code which is offered by a server running a file-server with given URLs for each artifact.

func (*Platform) CreateHook

func (g *Platform) CreateHook(ctx context.Context, repo *v1alpha1.KrokRepository, platformToken, secret string) error

CreateHook can create a hook for the GitHub platform.

func (*Platform) GetEventID

func (g *Platform) GetEventID(ctx context.Context, r *http.Request) (string, error)

GetEventID Based on the platform, retrieve the ID of the event.

func (*Platform) GetEventType

func (g *Platform) GetEventType(ctx context.Context, r *http.Request) (string, error)

GetEventType Based on the platform, retrieve the Type of the event.

func (*Platform) GetRefIfPresent

func (g *Platform) GetRefIfPresent(ctx context.Context, event *v1alpha1.KrokEvent) (string, string, error)

GetRefIfPresent returns a Ref if the payload contains one.

func (*Platform) ValidateRequest

func (g *Platform) ValidateRequest(ctx context.Context, req *http.Request, secret string) (bool, error)

ValidateRequest will take a hook and verify it being a valid hook request according to GitHub's rules.

Jump to

Keyboard shortcuts

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