core

package
v0.0.0-...-6974023 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAlpineImage         = "3.19"
	DefaultGoVersion           = "1.22.2"
	DefaultPostgresVersion     = "16"
	DefaultLinkerdAwaitVersion = "0.2.7"
	DefaultGitHubComRunnerType = "ubuntu-latest"
)
View Source
const (
	CheckoutAction = "actions/checkout@v4"
	SetupGoAction  = "actions/setup-go@v5"

	DockerLoginAction     = "docker/login-action@v3"
	DockerMetadataAction  = "docker/metadata-action@v5"
	DockerBuildxAction    = "docker/setup-buildx-action@v3"
	DockerQemuAction      = "docker/setup-qemu-action@v3"
	DockerBuildPushAction = "docker/build-push-action@v5"

	CodeqlInitAction      = "github/codeql-action/init@v3"
	CodeqlAnalyzeAction   = "github/codeql-action/analyze@v3"
	CodeqlAutobuildAction = "github/codeql-action/autobuild@v3"

	GolangciLintAction = "golangci/golangci-lint-action@v5"
	GoreleaserAction   = "goreleaser/goreleaser-action@v5"
	GovulncheckAction  = "golang/govulncheck-action@v1"
	MisspellAction     = "reviewdog/action-misspell@v1"
)
View Source
const ModFilename = "go.mod"

Variables

View Source
var AutogeneratedHeader = strings.TrimSpace(`
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead.                                            #
################################################################################
`)
View Source
var DefaultGitHubEnterpriseRunnerType = [...]string{"self-hosted"}

Functions

This section is empty.

Types

type BinaryConfiguration

type BinaryConfiguration struct {
	Name        string `yaml:"name"`
	FromPackage string `yaml:"fromPackage"`
	InstallTo   string `yaml:"installTo"`
}

BinaryConfiguration appears in type Configuration.

type CIWorkflowConfig

type CIWorkflowConfig struct {
	Enabled     bool     `yaml:"enabled"`
	IgnorePaths []string `yaml:"ignorePaths"`
	RunnerType  []string `yaml:"runOn"`
	Coveralls   bool     `yaml:"coveralls"`
	Postgres    bool     `yaml:"postgres"`
}

CIWorkflowConfig appears in type Configuration.

type Configuration

type Configuration struct {
	Verbatim       string                       `yaml:"verbatim"`
	VariableValues map[string]string            `yaml:"variables"`
	Binaries       []BinaryConfiguration        `yaml:"binaries"`
	Test           TestConfiguration            `yaml:"testPackages"`
	Coverage       CoverageConfiguration        `yaml:"coverageTest"`
	Golang         GolangConfiguration          `yaml:"golang"`
	GolangciLint   GolangciLintConfiguration    `yaml:"golangciLint"`
	GoReleaser     GoReleaserConfiguration      `yaml:"goReleaser"`
	SpellCheck     SpellCheckConfiguration      `yaml:"spellCheck"`
	GitHubWorkflow *GithubWorkflowConfiguration `yaml:"githubWorkflow"`
	Makefile       MakefileConfig               `yaml:"makefile"`
	Renovate       RenovateConfig               `yaml:"renovate"`
	Dockerfile     DockerfileConfig             `yaml:"dockerfile"`
	Metadata       Metadata                     `yaml:"metadata"`
}

Configuration is the data structure that we read from the input file.

func (*Configuration) Validate

func (c *Configuration) Validate()

func (Configuration) Variable

func (c Configuration) Variable(name, defaultValue string) string

Variable returns the value of this variable if it's overridden in the config, or the default value otherwise.

type CoverageConfiguration

type CoverageConfiguration struct {
	Only   string `yaml:"only"`
	Except string `yaml:"except"`
}

CoverageConfiguration appears in type Configuration.

type DockerfileConfig

type DockerfileConfig struct {
	Enabled          bool     `yaml:"enabled"`
	Entrypoint       []string `yaml:"entrypoint"`
	ExtraDirectives  []string `yaml:"extraDirectives"`
	ExtraIgnores     []string `yaml:"extraIgnores"`
	ExtraPackages    []string `yaml:"extraPackages"`
	RunAsRoot        bool     `yaml:"runAsRoot"`
	WithLinkerdAwait bool     `yaml:"withLinkerdAwait"`
}

DockerfileConfig appears in type Configuration.

type GithubWorkflowConfiguration

type GithubWorkflowConfiguration struct {
	// These global-level settings are applicable for all workflows. They are
	// superseded by their workflow-level counterpart(s).
	Global struct {
		DefaultBranch string `yaml:"defaultBranch"`
		GoVersion     string `yaml:"goVersion"`
	} `yaml:"global"`

	CI                  CIWorkflowConfig             `yaml:"ci"`
	IsSelfHostedRunner  bool                         `yaml:"omit"`
	License             LicenseWorkflowConfig        `yaml:"license"`
	PushContainerToGhcr PushContainerToGhcrConfig    `yaml:"pushContainerToGhcr"`
	Release             ReleaseWorkflowConfig        `yaml:"release"`
	SecurityChecks      SecurityChecksWorkflowConfig `yaml:"securityChecks"`
}

GithubWorkflowConfiguration appears in type Configuration.

type GoReleaserConfiguration

type GoReleaserConfiguration struct {
	CreateConfig bool      `yaml:"createConfig"`
	BinaryName   string    `yaml:"binaryName"`
	Files        *[]string `yaml:"files"`
	Format       string    `yaml:"format"`
	NameTemplate string    `yaml:"nameTemplate"`
}

type GolangConfiguration

type GolangConfiguration struct {
	EnableVendoring bool              `yaml:"enableVendoring"`
	LdFlags         map[string]string `yaml:"ldflags"`
	SetGoModVersion bool              `yaml:"setGoModVersion"`
}

GolangConfiguration appears in type Configuration.

type GolangciLintConfiguration

type GolangciLintConfiguration struct {
	CreateConfig     bool     `yaml:"createConfig"`
	ErrcheckExcludes []string `yaml:"errcheckExcludes"`
	SkipDirs         []string `yaml:"skipDirs"`
}

GolangciLintConfiguration appears in type Configuration.

type LicenseWorkflowConfig

type LicenseWorkflowConfig struct {
	Enabled        *bool    `yaml:"enabled"`
	IgnorePatterns []string `yaml:"ignorePatterns"`
}

LicenseWorkflowConfig appears in type Configuration.

type MakefileConfig

type MakefileConfig struct {
	Enabled *bool `yaml:"enabled"` // this is a pointer to bool to treat an absence as true for backwards compatibility
}

type Metadata

type Metadata struct {
	URL string `yaml:"url"`
}

type PackageRule

type PackageRule struct {
	ExcludePackagePatterns []string `yaml:"excludePackagePatterns" json:"excludePackagePatterns,omitempty"`
	MatchPackageNames      []string `yaml:"matchPackageNames" json:"matchPackageNames,omitempty"`
	MatchPackagePatterns   []string `yaml:"matchPackagePatterns" json:"matchPackagePatterns,omitempty"`
	MatchPackagePrefixes   []string `yaml:"matchPackagePrefixes" json:"matchPackagePrefixes,omitempty"`
	MatchUpdateTypes       []string `yaml:"matchUpdateTypes" json:"matchUpdateTypes,omitempty"`
	MatchDepTypes          []string `yaml:"matchDepTypes" json:"matchDepTypes,omitempty"`
	MatchFiles             []string `yaml:"matchFiles" json:"matchFiles,omitempty"`
	AllowedVersions        string   `yaml:"allowedVersions" json:"allowedVersions,omitempty"`
	AutoMerge              bool     `yaml:"automerge" json:"automerge,omitempty"`
	EnableRenovate         *bool    `yaml:"enabled" json:"enabled,omitempty"`
	GroupName              string   `yaml:"groupName" json:"groupName,omitempty"`
}

type PushContainerToGhcrConfig

type PushContainerToGhcrConfig struct {
	Enabled bool `yaml:"enabled"`
}

type ReleaseWorkflowConfig

type ReleaseWorkflowConfig struct {
	Enabled bool `yaml:"enabled"`
}

type RenovateConfig

type RenovateConfig struct {
	Enabled      bool          `yaml:"enabled"`
	Assignees    []string      `yaml:"assignees"`
	GoVersion    string        `yaml:"goVersion"`
	PackageRules []PackageRule `yaml:"packageRules"`
}

RenovateConfig appears in type Configuration.

type ScanResult

type ScanResult struct {
	ModulePath           string           // from "module" directive in go.mod, e.g. "github.com/foo/bar"
	GoVersion            string           // from "go" directive in go.mod, e.g. "1.21"
	GoDirectDependencies []module.Version // from "require" directive(s) in go.mod without the "// indirect" comment
	HasBinInfo           bool             // whether we can produce linker instructions for "github.com/sapcc/go-api-declarations/bininfo"
	UseGinkgo            bool             // wether to use ginkgo test runner instead of go test
	UsesPostgres         bool             // whether postgres is used
	KubernetesController bool             // whether the repository contains a Kubernetes controller
	KubernetesVersion    string           // version of kubernetes to use, derived from k8s.io/api
}

ScanResult contains data obtained through a scan of the configuration files in the repository. At the moment, only `go.mod` is scanned.

func Scan

func Scan() ScanResult

func (ScanResult) MustModulePath

func (sr ScanResult) MustModulePath() string

MustModulePath reads the ModulePath field, but fails if it is empty.

type SecurityChecksWorkflowConfig

type SecurityChecksWorkflowConfig struct {
	Enabled *bool `yaml:"enabled"`
}

SecurityChecksWorkflowConfig appears in type Configuration.

type SpellCheckConfiguration

type SpellCheckConfiguration struct {
	IgnoreWords []string `yaml:"ignoreWords"`
}

SpellCheckConfiguration appears in type Configuration.

type TestConfiguration

type TestConfiguration struct {
	Only   string `yaml:"only"`
	Except string `yaml:"except"`
}

TestConfiguration appears in type Configuration.

Jump to

Keyboard shortcuts

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