checks

package
v0.0.0-...-b042e4a Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: EPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

* Copyright contributors to the Galasa project * * SPDX-License-Identifier: EPL-2.0

Index

Constants

View Source
const (
	COMMAND_FLAG_GITHUB_AUTH_KEY_FILE = "--githubAuthKeyFile"
	COMMAND_FLAG_DEBUG                = "--debug"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRun

type CheckRun struct {
	Name       string         `json:"name"`
	HeadSha    *string        `json:"head_sha,omitempty"`
	Status     string         `json:"status"`
	Conclusion *string        `json:"conclusion,omitempty"`
	Url        *string        `json:"url,omitempty"`
	Output     CheckRunOutput `json:"output"`
}

type CheckRunAnnotation

type CheckRunAnnotation struct {
	Path      string `json:"path"`
	StartLine int    `json:"start_line"`
	EndLine   int    `json:"end_line"`
	Level     string `json:"annotation_level"`
	Message   string `json:"message"`
}

type CheckRunOutput

type CheckRunOutput struct {
	Title       string                `json:"title"`
	Summary     string                `json:"summary"`
	Annotations *[]CheckRunAnnotation `json:"annotations,omitempty"`
}

type Checker

type Checker interface {
	CheckFilesChanged(token string, url string) ([]checkTypes.CheckError, error)

	CheckFile(token string, file *File) *checkTypes.CheckError
}

func NewChecker

func NewChecker(client GitHubClient) (Checker, error)

type CheckerImpl

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

func (*CheckerImpl) CheckFile

func (this *CheckerImpl) CheckFile(token string, file *File) *checkTypes.CheckError

func (*CheckerImpl) CheckFilesChanged

func (this *CheckerImpl) CheckFilesChanged(token string, url string) ([]checkTypes.CheckError, error)

type CommandLineArgParser

type CommandLineArgParser interface {
	Parse() (*FieldValuesParsed, error)
}

func NewCommandLineArgParserImpl

func NewCommandLineArgParserImpl(args []string, console Console) (CommandLineArgParser, error)

type CommandLineArgParserImpl

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

func (*CommandLineArgParserImpl) Parse

type Console

type Console interface {
	Write(string)
}

func NewConsole

func NewConsole() (Console, error)

type ConsoleImpl

type ConsoleImpl struct {
}

func (*ConsoleImpl) Write

func (*ConsoleImpl) Write(message string)

type ConsoleMock

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

func NewConsoleMock

func NewConsoleMock() *ConsoleMock

func (*ConsoleMock) Write

func (this *ConsoleMock) Write(message string)

type EventHandler

type EventHandler interface {
	HandleEvent(w http.ResponseWriter, r *http.Request)
}

func NewEventHandlerImpl

func NewEventHandlerImpl(gitHubClient GitHubClient, checker Checker, tokenSupplier TokenSupplier) (EventHandler, error)

type EventHandlerImpl

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

func (*EventHandlerImpl) HandleEvent

func (this *EventHandlerImpl) HandleEvent(w http.ResponseWriter, r *http.Request)

type FieldValuesParsed

type FieldValuesParsed struct {
	GithubAuthKeyFilePath string
	IsDebugEnabled        bool
}

type File

type File struct {
	Sha         string `json:"sha"`
	Filename    string `json:"filename"`
	Status      string `json:"status"`
	ContentsURL string `json:"contents_url"`
}

type Files

type Files struct {
	Files *[]File `json:"files"`
}

type GitHubClient

type GitHubClient interface {
	UpdateCheckRun(tokenSupplier TokenSupplier, webhook *Webhook, checkRunURL string, checkErrors []checkTypes.CheckError, fatalError string) error
	GetFilesChanged(token string, baseUrl string) ([]File, error)
	GetFileContentFromGithub(token string, file *File) (string, error)
	CreateCheckRun(tokenSupplier TokenSupplier, webhook *Webhook, headSha string) (string, error)
	GetNewToken(accessUrl string, githubAuthToken string) (tokenResponse InstallationToken, err error)
	LogHttpPayload(jsonBytes []byte)
}

func NewGitHubClient

func NewGitHubClient(isHttpTrafficLogged bool) GitHubClient

type GitHubClientImpl

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

func (*GitHubClientImpl) CreateCheckRun

func (this *GitHubClientImpl) CreateCheckRun(tokenSupplier TokenSupplier, webhook *Webhook, headSha string) (string, error)

Create a 'check run' on github.

func (*GitHubClientImpl) GetFileContentFromGithub

func (this *GitHubClientImpl) GetFileContentFromGithub(token string, file *File) (string, error)

func (*GitHubClientImpl) GetFilesChanged

func (this *GitHubClientImpl) GetFilesChanged(token string, baseUrl string) ([]File, error)

func (*GitHubClientImpl) GetNewToken

func (this *GitHubClientImpl) GetNewToken(accessUrl string, githubAuthToken string) (tokenResponse InstallationToken, err error)

func (*GitHubClientImpl) LogHttpPayload

func (this *GitHubClientImpl) LogHttpPayload(jsonBytes []byte)

func (*GitHubClientImpl) UpdateCheckRun

func (this *GitHubClientImpl) UpdateCheckRun(
	tokenSupplier TokenSupplier,
	webhook *Webhook,
	checkRunURL string,
	checkErrors []checkTypes.CheckError,
	fatalError string,
) error

Update the status of a previously-created 'check run' which exists at the end of a URL in github.

type InstallationToken

type InstallationToken struct {
	Token     string `json:"token"`
	ExpiresAt string `json:"expires_at"`
}

type StringIterator

type StringIterator interface {
	// Gets the next string from the input slice. If we run out of input, we return ""
	Next() (string, bool)
}

func NewStringIterator

func NewStringIterator(args []string) (StringIterator, error)

type StringIteratorImpl

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

func (*StringIteratorImpl) Next

func (this *StringIteratorImpl) Next() (string, bool)

type TokenSupplier

type TokenSupplier interface {
	GetToken(installation int) (string, error)
}

func NewTokenSupplier

func NewTokenSupplier(gitHubClient GitHubClient, keyFilePath string) (TokenSupplier, error)

func NewTokenSupplierMock

func NewTokenSupplierMock() (TokenSupplier, error)

type TokenSupplierImpl

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

func (*TokenSupplierImpl) GetToken

func (this *TokenSupplierImpl) GetToken(installation int) (string, error)

type TokenSupplierMock

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

func (*TokenSupplierMock) GetToken

func (this *TokenSupplierMock) GetToken(installation int) (string, error)

type Webhook

type Webhook struct {
	Action       string              `json:"action"`
	CheckSuite   *WebhookCheckSuite  `json:"check_suite,omitempty"`
	CheckRun     *WebhookCheckRun    `json:"check_run,omitempty"`
	Installation WebhookInstallation `json:"installation"`
	Repository   WebhookRepository   `json:"repository"`
	PullRequest  *WebhookPullRequest `json:"pull_request,omitempty"`
}

type WebhookCheckRun

type WebhookCheckRun struct {
	Id         int               `json:"id"`
	HeadSha    string            `json:"head_sha"`
	Url        string            `json:"url"`
	CheckSuite WebhookCheckSuite `json:"check_suite"`
}

type WebhookCheckSuite

type WebhookCheckSuite struct {
	Id           int                   `json:"id"`
	HeadSha      string                `json:"head_sha"`
	PullRequests *[]WebhookPullRequest `json:"pull_requests"`
	Before       *string               `json:"before,omitempty"`
	After        *string               `json:"after,omitempty"`
}

type WebhookInstallation

type WebhookInstallation struct {
	Id     int    `json:"id"`
	NodeId string `json:"node_id"`
}

type WebhookPullRequest

type WebhookPullRequest struct {
	Number int                    `json:"number"`
	Url    string                 `json:"url"`
	Head   WebhookPullRequestHead `json:"head"`
	Base   WebhookPullRequestHead `json:"base"`
}

type WebhookPullRequestHead

type WebhookPullRequestHead struct {
	Sha  string            `json:"sha"`
	Repo WebhookRepository `json:"repo"`
}

type WebhookRepository

type WebhookRepository struct {
	Id            int    `json:"id"`
	RepositoryURL string `json:"url"`
	CompareURL    string `json:"compare_url"`
	CommitsURL    string `json:"commits_url"`
}

Jump to

Keyboard shortcuts

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