validator

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2018 License: Apache-2.0 Imports: 22 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations added in v0.0.3

type Annotations []*github.CheckRunAnnotation

Annotations is an array of pointers to CheckRunAnnotations

func (Annotations) Len added in v0.0.3

func (a Annotations) Len() int

func (Annotations) Less added in v0.0.3

func (a Annotations) Less(i, j int) bool

func (Annotations) Swap added in v0.0.3

func (a Annotations) Swap(i, j int)

type Candidate

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

Candidate reprensets a file to be validated

func NewCandidate added in v0.0.3

func NewCandidate(context *Context, file *github.CommitFile, schemas []*KubeValidatorConfigSchema) *Candidate

NewCandidate initializes a validation Candidate

func (*Candidate) LoadBytes added in v0.0.3

func (c *Candidate) LoadBytes() *github.CheckRunAnnotation

LoadBytes hydrates bytes from GitHub and returns a CheckRunAnnotation if an error is encountered

func (*Candidate) MarkdownListItem

func (c *Candidate) MarkdownListItem() string

MarkdownListItem returns a string that represents the Candidate designed for use in a Markdown List

func (*Candidate) Validate added in v0.0.3

func (c *Candidate) Validate() Annotations

Validate bytes with kubeval and return an array of CheckRunAnnotation

type Candidates added in v0.0.3

type Candidates []*Candidate

Candidates is an array of pointers to Candidates

func (*Candidates) LoadBytes added in v0.0.3

func (c *Candidates) LoadBytes() Annotations

LoadBytes loads all of the files from GitHub

func (*Candidates) Validate added in v0.0.3

func (c *Candidates) Validate() Annotations

Validate runs kubeval on all candidates

type Context

type Context struct {
	Event     interface{}
	Github    *github.Client
	Ctx       *context.Context
	AppID     *int
	AppGitHub *github.Client
}

Context contains an event payload an a configured client

func (*Context) LogInstallationCount added in v0.0.3

func (c *Context) LogInstallationCount() error

LogInstallationCount logs the number of installations to help keep track of eligibility for inclusion in the GitHub Marketplace. https://developer.github.com/apps/marketplace/creating-and-submitting-your-app-for-approval/requirements-for-listing-an-app-on-github-marketplace/

func (*Context) Process

func (c *Context) Process() bool

Process handles webhook events kinda like Probot does

func (*Context) ProcessCheckRunEvent added in v0.0.3

func (c *Context) ProcessCheckRunEvent(e *github.CheckRunEvent) bool

ProcessCheckRunEvent re-requests CheckSuites when a conatined CheckRun is rerequested

func (*Context) ProcessCheckSuite

func (c *Context) ProcessCheckSuite(e *github.CheckSuiteEvent)

ProcessCheckSuite validates the Kubernetes YAML that has changed on checks associated with PRs.

func (*Context) ProcessPrEvent added in v0.0.3

func (c *Context) ProcessPrEvent(e *github.PullRequestEvent) bool

ProcessPrEvent re-requests check suites on PRs when they're opened or re-opened

type GenericEvent

type GenericEvent struct {
	// Repo         *github.Repository   `json:"repository,omitempty"`
	// Org          *github.Organization `json:"organization,omitempty"`
	// Sender       *github.User         `json:"sender,omitempty"`
	Installation *github.Installation `json:"installation,omitempty"`
}

GenericEvent contains just enough inforamation about webhook to handle authentication

type KubeValidatorConfig

type KubeValidatorConfig struct {
	APIVersion string                   `yaml:"apiversion"`
	Kind       string                   `yaml:"kind"`
	Spec       *KubeValidatorConfigSpec `yaml:"spec"`
}

KubeValidatorConfig maps globs of Kubernetes config to schemas which validate them.

func (*KubeValidatorConfig) Valid

func (config *KubeValidatorConfig) Valid() bool

Valid returns a boolean indicatating whether or not the config is well formed TODO replace me with an actual schema

type KubeValidatorConfigManifest

type KubeValidatorConfigManifest struct {
	Glob    string                       `yaml:"glob"`
	Schemas []*KubeValidatorConfigSchema `yaml:"schemas,omitempty"`
}

KubeValidatorConfigManifest contains a glob and a list of schema

type KubeValidatorConfigSchema

type KubeValidatorConfigSchema struct {
	Name       string `yaml:"name,omitempty"`
	SchemaFork string `yaml:"schemaFork,omitempty"`

	Version     string `yaml:"version,omitempty"`
	ConfigType  string `yaml:"type,omitempty"`
	LineNumbers bool   `yaml:"lineNumbers,omitempty"`
}

KubeValidatorConfigSchema contains options for kubeval

func (*KubeValidatorConfigSchema) SchemaLocation

func (schema *KubeValidatorConfigSchema) SchemaLocation() string

SchemaLocation composes SchemaFork with a base url

type KubeValidatorConfigSpec

type KubeValidatorConfigSpec struct {
	Manifests []*KubeValidatorConfigManifest `yaml:"manifests"`
}

KubeValidatorConfigSpec contains a list of manifests

type Server

type Server struct {
	Port            int
	WebhookSecret   string
	PrivateKeyFile  string
	AppID           int
	GitHubAppClient *github.Client
	// contains filtered or unexported fields
}

Server contains the logic to process webhooks, kinda like probot

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts a http server on the configured port

Jump to

Keyboard shortcuts

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