config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReleasesExclusionSliceEquals

func NewReleasesExclusionSliceEquals(left []NewReleasesExclusion, right []NewReleasesExclusion) bool

func NormalizePackageName added in v0.5.0

func NormalizePackageName(pkgName string) string

func Schema

func Schema() *jsonschema.Schema

Types

type Config

type Config struct {
	DryRun      bool `yaml:"dryRun"`
	Packages    []Package
	GitHub      GitHub
	Jira        Jira
	NewReleases NewReleases
	HTTP        HTTP
	Log         Log
}

func (Config) Censored added in v0.5.0

func (c Config) Censored() Config

func (Config) TryFindPackage

func (c Config) TryFindPackage(pkgName string) (Package, bool)

type GitHub

type GitHub struct {
	URL     *string `jsonschema:"oneof_type=string;null" jsonschema_extras:"format=uri"`
	TempDir *string `yaml:"tempDir" jsonschema:"oneof_type=string;null" jsonschema_extras:"format=uri"`
	Auth    GitHubAuth
	PR      GitHubPR
}

func (GitHub) Censored added in v0.5.0

func (gh GitHub) Censored() GitHub

type GitHubAuth

type GitHubAuth struct {
	Type  GitHubAuthType
	Token *string `yaml:",omitempty" jsonschema:"oneof_type=string;null"`
	App   GitHubAuthApp
}

func (GitHubAuth) Censored added in v0.5.0

func (a GitHubAuth) Censored() GitHubAuth

type GitHubAuthApp

type GitHubAuthApp struct {
	ID             int64
	PrivateKeyPath *string           `yaml:"privateKeyPath,omitempty" jsonschema:"oneof_type=string;null,oneof_required=privateKeyPath"`
	PrivateKeyPEM  *RSAPrivateKeyPEM `yaml:"privateKeyPem,omitempty" jsonschema:"oneof_required=privateKeyPem"`
}

func (GitHubAuthApp) Censored added in v0.5.0

func (a GitHubAuthApp) Censored() GitHubAuthApp

type GitHubAuthType

type GitHubAuthType string
const (
	GitHubAuthTypePAT GitHubAuthType = "pat"
	GitHubAuthTypeApp GitHubAuthType = "app"
)

func (GitHubAuthType) JSONSchema

func (GitHubAuthType) JSONSchema() *jsonschema.Schema

func (*GitHubAuthType) Set

func (f *GitHubAuthType) Set(value string) error

func (GitHubAuthType) String

func (f GitHubAuthType) String() string

func (*GitHubAuthType) Type

func (f *GitHubAuthType) Type() string

func (*GitHubAuthType) UnmarshalText

func (f *GitHubAuthType) UnmarshalText(text []byte) error

type GitHubCommitter

type GitHubCommitter struct {
	Name  *string `jsonschema:"oneof_type=string;null"`
	Email *string `jsonschema:"oneof_type=string;null" jsonschema_extras:"format=idn-email"`
}

type GitHubPR

type GitHubPR struct {
	Title       *Template
	Description *Template
	Branch      *Template
	Commit      *Template
	Committer   GitHubCommitter
}

type HTTP

type HTTP struct {
	Port      uint16
	PublicURL *URL `yaml:"publicUrl"`
}

func (HTTP) Censored added in v0.5.0

func (h HTTP) Censored() HTTP

type Jira

type Jira struct {
	URL            string `jsonschema_extras:"format=uri"`
	SkipCertVerify bool   `yaml:"skipCertVerify"`
	Auth           JiraAuth
	Issue          JiraIssue
}

func (Jira) Censored added in v0.5.0

func (j Jira) Censored() Jira

type JiraAuth

type JiraAuth struct {
	Type  JiraAuthType
	Token string
	User  string
}

func (JiraAuth) Censored added in v0.5.0

func (a JiraAuth) Censored() JiraAuth

type JiraAuthType

type JiraAuthType string
const (
	JiraAuthTypePAT   JiraAuthType = "pat"
	JiraAuthTypeToken JiraAuthType = "token"
)

func (JiraAuthType) JSONSchema

func (JiraAuthType) JSONSchema() *jsonschema.Schema

func (*JiraAuthType) Set

func (f *JiraAuthType) Set(value string) error

func (JiraAuthType) String

func (f JiraAuthType) String() string

func (*JiraAuthType) Type

func (f *JiraAuthType) Type() string

func (*JiraAuthType) UnmarshalText

func (f *JiraAuthType) UnmarshalText(text []byte) error

type JiraIssue

type JiraIssue struct {
	Labels                 []string
	Status                 string
	Description            *Template
	Type                   string
	Project                string
	ProjectNameCustomField uint `yaml:"projectNameCustomField"`

	// PRDeferredCreation means Jelease will send a link to where user can
	// manually trigger the PR creation, instead of creating it automatically.
	PRDeferredCreation bool `yaml:"prDeferredCreation"`

	Comments JiraIssueComments
}

Jira Ticket type

type JiraIssueComments

type JiraIssueComments struct {
	UpdatedIssue       *Template `yaml:"updatedIssue"`
	NoConfig           *Template `yaml:"noConfig"`
	NoPatches          *Template `yaml:"noPatches"`
	PRCreated          *Template `yaml:"prCreated"`
	PRFailed           *Template `yaml:"prFailed"`
	PRDeferredCreation *Template `yaml:"prDeferredCreation"`
}

type Log

type Log struct {
	Format LogFormat
	Level  LogLevel
}

type LogFormat

type LogFormat string
const (
	LogFormatPretty LogFormat = "pretty"
	LogFormatJSON   LogFormat = "json"
)

func (LogFormat) JSONSchema

func (LogFormat) JSONSchema() *jsonschema.Schema

func (*LogFormat) Set

func (f *LogFormat) Set(value string) error

func (LogFormat) String

func (f LogFormat) String() string

func (*LogFormat) Type

func (f *LogFormat) Type() string

func (*LogFormat) UnmarshalText

func (f *LogFormat) UnmarshalText(text []byte) error

type LogLevel

type LogLevel zerolog.Level

func (LogLevel) JSONSchema

func (LogLevel) JSONSchema() *jsonschema.Schema

func (LogLevel) MarshalText

func (l LogLevel) MarshalText() ([]byte, error)

func (*LogLevel) Set

func (l *LogLevel) Set(value string) error

func (LogLevel) String

func (l LogLevel) String() string

func (*LogLevel) Type

func (l *LogLevel) Type() string

func (*LogLevel) UnmarshalText

func (l *LogLevel) UnmarshalText(text []byte) error

type NewReleases

type NewReleases struct {
	Auth     NewReleasesAuth
	Projects []NewReleasesProject
	Defaults NewReleasesDefaults
}

type NewReleasesAuth

type NewReleasesAuth struct {
	APIKey string
}

type NewReleasesDefaults

type NewReleasesDefaults struct {
	EmailNotification string `json:"emailNotification" yaml:"emailNotification" mapstructure:"emailNotification"`
}

type NewReleasesExclusion

type NewReleasesExclusion struct {
	Value   string `json:"value"`
	Inverse bool   `json:"inverse"`
}

func (NewReleasesExclusion) Equals

func (exclusion NewReleasesExclusion) Equals(other NewReleasesExclusion) bool

type NewReleasesProject

type NewReleasesProject struct {
	Name               string
	Provider           string
	EmailNotification  string                 `json:"emailNotification,omitempty" yaml:"emailNotification,omitempty" mapstructure:"emailNotification"`
	Exclusions         []NewReleasesExclusion `json:"excludeVersionRegexp,omitempty" yaml:"excludeVersionRegexp,omitempty" mapstructure:"excludeVersionRegexp"`
	ExcludePrereleases bool                   `json:"excludePrereleases,omitempty" yaml:"excludePrereleases,omitempty" mapstructure:"excludePrereleases"`
	ExcludeUpdated     bool                   `json:"excludeUpdated,omitempty" yaml:"excludeUpdated,omitempty" mapstructure:"excludeUpdated"`
}

Similar to newreleases.io/newreleases/NewReleasesProject but omits some fields that we don't want to store or compare

func (NewReleasesProject) Equals

func (project NewReleasesProject) Equals(other NewReleasesProject) bool

Thanks to Go, I now know how a compiler feels

type Package

type Package struct {
	Name        string
	Description *Template
	Repos       []PackageRepo
}

func (Package) NormalizedName added in v0.5.0

func (p Package) NormalizedName() string

type PackageRepo

type PackageRepo struct {
	URL     string `jsonschema_extras:"format=uri-reference"`
	Patches []PackageRepoPatch
}

type PackageRepoPatch

type PackageRepoPatch struct {
	Regex         *PatchRegex         `yaml:",omitempty" json:",omitempty" jsonschema:"oneof_required=regex"`
	YAML          *PatchYAML          `yaml:",omitempty" json:",omitempty" jsonschema:"oneof_required=yaml"`
	HelmDepUpdate *PatchHelmDepUpdate `yaml:"helmDepUpdate,omitempty" json:",omitempty" jsonschema:"oneof_required=helmDepUpdate"`
}

type PatchHelmDepUpdate added in v0.6.0

type PatchHelmDepUpdate struct {
	Chart *Template `jsonschema:"required,default=.,example=charts/jelease"`
}

type PatchRegex

type PatchRegex struct {
	File    string        `jsonschema:"required"`
	Match   *RegexPattern `jsonschema:"required"`
	Replace *Template     `jsonschema:"required"`
}

type PatchYAML added in v0.6.0

type PatchYAML struct {
	File       string           `jsonschema:"required"`
	YAMLPath   *YAMLPathPattern `yaml:"yamlPath" jsonschema:"required"`
	Replace    *Template        `jsonschema:"required"`
	MaxMatches int              `yaml:"maxMatches,omitempty" jsonschema:"minimum=0"`
	Indent     int              `yaml:",omitempty" jsonschema:"minimum=0"`
}

type RSAPrivateKeyPEM

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

func (RSAPrivateKeyPEM) JSONSchema

func (RSAPrivateKeyPEM) JSONSchema() *jsonschema.Schema

func (*RSAPrivateKeyPEM) MarshalText

func (k *RSAPrivateKeyPEM) MarshalText() ([]byte, error)

func (*RSAPrivateKeyPEM) PrivateKey

func (k *RSAPrivateKeyPEM) PrivateKey() *rsa.PrivateKey

func (*RSAPrivateKeyPEM) Set

func (k *RSAPrivateKeyPEM) Set(value string) error

func (*RSAPrivateKeyPEM) String

func (k *RSAPrivateKeyPEM) String() string

func (RSAPrivateKeyPEM) Type

func (RSAPrivateKeyPEM) Type() string

func (*RSAPrivateKeyPEM) UnmarshalText

func (k *RSAPrivateKeyPEM) UnmarshalText(text []byte) error

type RegexPattern

type RegexPattern regexp.Regexp

func (RegexPattern) JSONSchema

func (RegexPattern) JSONSchema() *jsonschema.Schema

func (*RegexPattern) MarshalText

func (r *RegexPattern) MarshalText() ([]byte, error)

func (*RegexPattern) Regexp

func (r *RegexPattern) Regexp() *regexp.Regexp

func (*RegexPattern) Set

func (r *RegexPattern) Set(value string) error

func (*RegexPattern) String

func (r *RegexPattern) String() string

func (*RegexPattern) Type

func (r *RegexPattern) Type() string

func (*RegexPattern) UnmarshalText

func (r *RegexPattern) UnmarshalText(text []byte) error

type Template

type Template template.Template

Template is a parsed Go text/template string, that has additional encoders implemented so it can be used in config files and CLI flags.

func MustTemplate added in v0.7.0

func MustTemplate(s string) *Template

func NewTemplate added in v0.7.0

func NewTemplate(s string) (*Template, error)

func (Template) JSONSchema

func (Template) JSONSchema() *jsonschema.Schema

func (*Template) MarshalText

func (t *Template) MarshalText() ([]byte, error)

func (*Template) Render

func (t *Template) Render(data any) (string, error)

func (*Template) Set

func (t *Template) Set(value string) error

func (*Template) String

func (t *Template) String() string

func (*Template) Template

func (t *Template) Template() *template.Template

func (Template) Type

func (Template) Type() string

func (*Template) UnmarshalText

func (t *Template) UnmarshalText(text []byte) error

type TemplateContext added in v0.6.0

type TemplateContext struct {
	Package            string
	PackageDescription string
	Version            string
	JiraIssue          string
}

TemplateContext is the common data passed into templates when executing them.

func NewTemplateContextForPackage added in v0.7.0

func NewTemplateContextForPackage(pkg Package) (TemplateContext, error)

type URL added in v0.5.0

type URL url.URL

func (URL) JSONSchema added in v0.5.0

func (URL) JSONSchema() *jsonschema.Schema

func (*URL) MarshalText added in v0.5.0

func (u *URL) MarshalText() ([]byte, error)

func (*URL) Set added in v0.5.0

func (u *URL) Set(value string) error

func (*URL) String added in v0.5.0

func (u *URL) String() string

func (URL) Type added in v0.5.0

func (URL) Type() string

func (*URL) URL added in v0.5.0

func (u *URL) URL() *url.URL

func (*URL) UnmarshalText added in v0.5.0

func (u *URL) UnmarshalText(text []byte) error

type YAMLPathPattern added in v0.6.0

type YAMLPathPattern struct {
	YAMLPath *yamlpath.Path
	Source   string
}

func (YAMLPathPattern) JSONSchema added in v0.6.0

func (YAMLPathPattern) JSONSchema() *jsonschema.Schema

func (*YAMLPathPattern) MarshalText added in v0.6.0

func (r *YAMLPathPattern) MarshalText() ([]byte, error)

func (*YAMLPathPattern) Set added in v0.6.0

func (r *YAMLPathPattern) Set(value string) error

func (*YAMLPathPattern) String added in v0.6.0

func (r *YAMLPathPattern) String() string

func (*YAMLPathPattern) Type added in v0.6.0

func (r *YAMLPathPattern) Type() string

func (*YAMLPathPattern) UnmarshalText added in v0.6.0

func (r *YAMLPathPattern) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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