linters

package
v0.0.0-...-9e45a68 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingField    = newError("required field missing")
	NewErrMissingField = func(field string) Error { return ErrMissingField.WithValue(field) }

	ErrInvalidField    = newError("invalid field")
	NewErrInvalidField = func(field string, reason string) Error { return ErrInvalidField.WithValue(field).WithValue(reason) }

	ErrFileNotFound      = newError("file not found")
	ErrFileCannotRead    = newError("file cannot be read")
	ErrFileNotAFile      = newError("not a file")
	ErrFileEmpty         = newError("file is empty")
	ErrFileNotExecutable = newError("file is not executable")
	ErrFileInvalid       = newError("file is invalid")

	ErrCFMissingRoutes         = newError("cf application must have at least one route")
	ErrCFMissingName           = newError("cf application missing 'name'")
	ErrCFRoutesAndNoRoute      = newError("cf application cannot have both 'routes' and 'no-route'")
	ErrCFNoRouteHealthcheck    = newError("cf application with 'no-route: true' requires 'health-check-type: process'")
	ErrCFRouteScheme           = newError("cf application route must not start with http(s)://")
	ErrCFRouteMissing          = newError("cf application routes must contain sso_route")
	ErrCFMultipleApps          = newError("cf manifest must have exactly 1 application")
	ErrCFBuildpackUnversioned  = newError("buildpack specified without version so the latest will be used on each deploy")
	ErrCFBuildpackMissing      = newError("buildpack missing. Cloud Foundry will try to detect which system buildpack to use. Please see <https://docs.cloudfoundry.org/devguide/deploy-apps/manifest-attributes.html#buildpack>")
	ErrCFBuildpackDeprecated   = newError("'buildpack' is deprecated in favour of 'buildpacks'. Please see <http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#deprecated>")
	ErrCFArtifactAndDocker     = newError("cannot combine 'deploy_artifact' in the halfpipe task and 'docker' in the cf manifest")
	ErrCFFromArtifact          = newError("this file must be saved as an artifact in a previous task")
	ErrCFPrePromoteArtifact    = newError("cannot have pre promote tasks with CF manifest restored from artifact")
	ErrCFCandidateRouteTooLong = newError("cf does not allow routes of more than 64 characters")

	ErrCFLabelTeamWillBeOverwritten = newError("deployment will overwrite metadata.labels.team that was set in the CF manifest").AsWarning()
	ErrCFLabelProductIsMissing      = newError("CF manifest is missing 'product' label. If 'product' is set on the CF space you can safely ignore this warning.").AsWarning()
	ErrCFLabelEnvironmentIsMissing  = newError("CF manifest is missing 'environment' label. If 'environment' is set on the CF space you can safely ignore this warning.").AsWarning()

	ErrUnsupportedRegistry = newError("image must be from halfpipe registry. Please see <https://ee.public.springernature.app/rel-eng/docker-registry/>")
	ErrDockerPushTag       = newError("the field 'tag' is no longer used and is safe to delete")

	ErrDockerPlatformUnknown = newError("only linux/amd64 and/or linux/arm64 are supported")
	ErrDockerComposeVersion  = newError("the docker-compose file version used is deprecated. All services must be under the 'services' key and 'Version' must be '2' or higher. Please see <https://docs.docker.com/compose/compose-file/compose-versioning/#versioning>")
	ErrDockerVarSecret       = newError("using a secret in docker build vars is not secure. See the 'secrets' option of the docker-push task")

	ErrMultipleTriggers = newError("cannot have multiple triggers of this type")

	ErrVelaVariableMissing = newError("vela manifest variable is not specified in halfpipe manifest")
	ErrVelaNamespace       = newError("vela namespace must start with 'katee-'")

	ErrUnsupportedManualTrigger   = newError("manual_trigger on individual tasks is not supported in GitHub Actions. It is supported at the workflow level in git trigger options")
	ErrUnsupportedRolling         = newError("cf rolling deploys are not supported in GitHub Actions")
	ErrDockerTriggerLoop          = newError("cannot push docker image that is also a trigger as it will create a loop")
	ErrUnsupportedGitPrivateKey   = newError("git private_key is not supported in GitHub Actions")
	ErrUnsupportedGitUri          = newError("git uri is not supported in GitHub Actions")
	ErrUnsupportedPipelineTrigger = newError("pipeline triggers are not supported in GitHub Actions")
)
View Source
var (
	ErrUnsupportedFeature          = newError("unsupported feature")
	ErrUnsupportedFeatureVersioned = newError("feature 'versioned' is no longer supported. The same functionality is included in the 'update-pipeline' feature")
	ErrUnsupportedDockerDecompose  = newError("feature 'docker-decompose' is no longer supported. docker-compose tasks will not be modified")
)
View Source
var ErrReadsFromSavedArtifacts = newError("reads from saved artifacts, but there are no previous tasks that saves any")
View Source
var ErrScriptMustExistInDockerImage = newError("make sure script is present in the docker image")
View Source
var ErrWindowsScriptMustBeExecutable = newError("make sure script is executable")

Functions

func CheckFile

func CheckFile(fs afero.Afero, path string, mustBeExecutable bool) error

func LintArtifacts

func LintArtifacts(currentTask manifest.Task, previousTasks []manifest.Task) (errs []error)

func LintCfManifest

func LintCfManifest(task manifest.DeployCF, readCfManifest cf.ManifestReader) (errs []error)

func LintConsumerIntegrationTestTask

func LintConsumerIntegrationTestTask(cit manifest.ConsumerIntegrationTest, providerHostRequired bool) (errs []error)

func LintCronTrigger

func LintCronTrigger(cron manifest.TimerTrigger) (errs []error)

func LintDeployCFTask

func LintDeployCFTask(task manifest.DeployCF, readCfManifest cf.ManifestReader, fs afero.Afero) (errs []error)

func LintDeployKateeTask

func LintDeployKateeTask(task manifest.DeployKatee, man manifest.Manifest, fs afero.Afero) (errs []error)

func LintDeployMLModulesTask

func LintDeployMLModulesTask(mlTask manifest.DeployMLModules) (errs []error)

func LintDeployMLZipTask

func LintDeployMLZipTask(mlTask manifest.DeployMLZip) (errs []error)

func LintDockerComposeTask

func LintDockerComposeTask(dc manifest.DockerCompose, fs afero.Afero) (errs []error)

func LintDockerPushTask

func LintDockerPushTask(docker manifest.DockerPush, fs afero.Afero) (errs []error)

func LintDockerTrigger

func LintDockerTrigger(docker manifest.DockerTrigger) (errs []error)

func LintGitTrigger

func LintGitTrigger(git manifest.GitTrigger, fs afero.Afero, workingDir string, branchResolver project.GitBranchResolver, repoURIResolver project.RepoURIResolver, platform manifest.Platform) (errs []error)

func LintParallelTask

func LintParallelTask(parallelTask manifest.Parallel) (errs []error)

func LintPipelineTrigger

func LintPipelineTrigger(man manifest.Manifest, pipeline manifest.PipelineTrigger) (errs []error)

func LintPrePromoteTask

func LintPrePromoteTask(task manifest.Task) (errs []error)

func LintRunTask

func LintRunTask(run manifest.Run, fs afero.Afero, os string) (errs []error)

func LintSequenceTask

func LintSequenceTask(seqTask manifest.Sequence, cameFromAParallel bool) (errs []error)

func NewFeatureToggleLinter

func NewFeatureToggleLinter(availableFeatures manifest.FeatureToggles) featureToggleLinter

func NewTasksLinter

func NewTasksLinter(fs afero.Afero, os string) taskLinter

func NewTopLevelLinter

func NewTopLevelLinter() topLevelLinter

func NewTriggersLinter

func NewTriggersLinter(fs afero.Afero, workingDir string, branchResolver project.GitBranchResolver, repoURIResolver project.RepoURIResolver) triggersLinter

func ReadFile

func ReadFile(fs afero.Afero, path string) (content string, err error)

Types

type ActionsLinter

type ActionsLinter struct{}

func (ActionsLinter) Lint

func (linter ActionsLinter) Lint(man manifest.Manifest) (result LintResult)

type Component

type Component struct {
	Name       string     `yaml:"name"`
	Type       string     `yaml:"type"`
	Properties Properties `yaml:"properties"`
}

type Components

type Components struct {
	Components []Component `yaml:"components"`
}

type Env

type Env struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

type Error

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

func (Error) AsWarning

func (e Error) AsWarning() Error

func (Error) Error

func (e Error) Error() string

func (Error) Is

func (e Error) Is(target error) bool

func (Error) IsWarning

func (e Error) IsWarning() bool

func (Error) Unwrap

func (e Error) Unwrap() error

func (Error) WithFile

func (e Error) WithFile(file string) Error

func (Error) WithValue

func (e Error) WithValue(value string) Error

type LintResult

type LintResult struct {
	Linter  string
	DocsURL string
	Issues  []error
}

func NewLintResult

func NewLintResult(linter string, docsURL string, issues []error) LintResult

func (*LintResult) Add

func (lr *LintResult) Add(errs ...error)

func (*LintResult) Error

func (lr *LintResult) Error() (out string)

func (*LintResult) HasErrors

func (lr *LintResult) HasErrors() bool

func (*LintResult) HasWarnings

func (lr *LintResult) HasWarnings() bool

type LintResults

type LintResults []LintResult

func (LintResults) Error

func (lrs LintResults) Error() (out string)

func (LintResults) HasErrors

func (lrs LintResults) HasErrors() bool

func (LintResults) HasWarnings

func (lrs LintResults) HasWarnings() bool

type Linter

type Linter interface {
	Lint(manifest manifest.Manifest) LintResult
}

func NewActionsLinter

func NewActionsLinter() Linter

func NewSecretsLinter

func NewSecretsLinter(secretValidator manifest.SecretValidator) Linter

type Properties

type Properties struct {
	Image string `yaml:"image"`
	Env   []Env  `yaml:"env"`
}

type VelaManifest

type VelaManifest struct {
	Kind string     `yaml:"kind"`
	Spec Components `yaml:"spec"`
}

Jump to

Keyboard shortcuts

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