checks

package
v0.0.0-...-76a993e Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Error      int = 20
	Warning        = 15
	Info           = 10
	Permission     = 5
	Ok             = 0
)
View Source
const (
	Organization string = "Organization"
	Security            = "Security"
	Performance         = "Performance"
	Optimization        = "Optimization"
)

Variables

View Source
var SpecialVars = []string{
	"OctopusPrintVariables",
	"OctopusPrintEvaluatedVariables",
}

SpecialVars is a list of known debug or system variables that are not expected to appear in the project itself

Functions

This section is empty.

Types

type OctopusCheck

type OctopusCheck interface {
	// Execute runs the check
	Execute() (OctopusCheckResult, error)
	// Id returns the unique ID of the check, used to cross-reference with documentation
	Id() string
}

OctopusCheck defines the contract for each lint check

type OctopusCheckResult

type OctopusCheckResult interface {
	Description() string
	Code() string
	Link() string
	Severity() int
	Category() string
}

OctopusCheckResult describes the result of an OctopusCheck

type OctopusCheckResultImpl

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

func NewOctopusCheckResultImpl

func NewOctopusCheckResultImpl(description string, code string, link string, severity int, category string) OctopusCheckResultImpl

func (OctopusCheckResultImpl) Category

func (o OctopusCheckResultImpl) Category() string

func (OctopusCheckResultImpl) Code

func (o OctopusCheckResultImpl) Code() string

func (OctopusCheckResultImpl) Description

func (o OctopusCheckResultImpl) Description() string
func (o OctopusCheckResultImpl) Link() string

func (OctopusCheckResultImpl) Severity

func (o OctopusCheckResultImpl) Severity() int

type OctopusClientErrorHandler

type OctopusClientErrorHandler interface {
	// HandleError either handles the error and returns a OctopusCheckResult, or bubbles an error up. This
	// is called when the main request is made in a check, and the inability to process that first request
	// means the check can not continue.
	HandleError(id string, group string, err error) (OctopusCheckResult, error)
	// ShouldContinue is used to determine if a secondary request that failed should be ignored. This is typically called
	// when looping through resources where the failure of some requests do not invalidate the whole check. For example,
	// the inability to get a deployment process for one project does not invalidate the checks against other projects.
	ShouldContinue(err error) bool
}

OctopusClientErrorHandler is a service used to respond to errors from the octopus client.

type OctopusClientPermissiveErrorHandler

type OctopusClientPermissiveErrorHandler struct {
}

OctopusClientPermissiveErrorHandler treats almost every 400 HTTP error as a permissions error and returns a result at the Permission level.

func (OctopusClientPermissiveErrorHandler) HandleError

func (OctopusClientPermissiveErrorHandler) ShouldContinue

func (o OctopusClientPermissiveErrorHandler) ShouldContinue(err error) bool

ShouldContinue is used to determine if an error was a permissions error. Things like 404s are also treated as permission errors (we saw this a lot trying to get deployment processes). Interestingly we also saw a lot of StatusCode's with 0, so this function also reads the error to work out what is going on.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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