config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: 0BSD Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitMessageSpec

type CommitMessageSpec struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

type EndpointRef

type EndpointRef struct {
	Name string `json:"name,omitempty"`
}

type EndpointSpec

type EndpointSpec struct {
	Name            string       `json:"name,omitempty"`
	Type            EndpointType `json:"type,omitempty"`
	Path            string       `json:"path,omitempty"`
	RequiredHeaders []Header     `json:"requiredHeaders,omitempty"`
}

type EndpointType

type EndpointType string
const (
	EndpointTypeGeneric      EndpointType = "generic"
	EndpointTypeACR          EndpointType = "acr"
	EndpointTypeDockerhub    EndpointType = "dockerhub"
	EndpointTypeDistribution EndpointType = "distribution"
)

type FileTypeSpec

type FileTypeSpec struct {
	Kind    string `json:"kind,omitempty"`
	Pattern string `json:"pattern,omitempty"`
}

type GitProvider

type GitProvider string
const (
	ProviderGithub GitProvider = "github"
	ProviderAzure  GitProvider = "azure"
)

func InferGitProvider

func InferGitProvider(giturl string) GitProvider

infer the provider from the given url. If the provider cannot be inferred, an empty string is returned

TODO: handle edge cases. i.e. azure repo url contains github.com for some reason

type Header struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type ImagePullSecretRef

type ImagePullSecretRef struct {
	Name string `json:"name,omitempty"`
}

type NormalizedConfig

type NormalizedConfig struct {
	// List of endpoints to listen on
	Endpoints []EndpointSpec `json:"endpoints,omitempty"`
	// list of repositories to use
	Repositories []RepositorySpec `json:"repositories,omitempty"`
	// subscriptions link repositories to one or more endpoints
	Subscriptions []SubscriptionSpec `json:"subscriptions,omitempty"`
	// the registry auth is only used when using the k8s chain
	// it allows to configure where/how imagePullSecrets are obtained
	// this is only needed for registries that require an extra api call
	// such as dockerhub, which does not send the digest
	RegistryAuth RegistryAuthSpec `json:"registryAuth,omitempty"`
	// the commit message is used when kobold makes commits
	// both title and description are parsed as template string and executed
	// with an array of changes as context
	CommitMessage CommitMessageSpec `json:"commitMessage,omitempty"`
	// list of custom path resolvers to find image refs
	// this allows the user to lookup images in arbitrary paths
	Resolvers []ResolverSpec `json:"resolvers,omitempty"`
}

in memory representation of the config used to setup kobold this is used so that the user facing config can have different formats. I.e. v1 and v2 or a flat kubernetes configmap

func ReadPath

func ReadPath(path string) (*NormalizedConfig, error)

read the config at the given path and expand its env var references the config will be coded into an intermediate struct based on the version and afterwards normalized

func (*NormalizedConfig) Defaults added in v0.2.2

func (c *NormalizedConfig) Defaults()

type RegistryAuthSpec

type RegistryAuthSpec struct {
	ServiceAccount   string               `json:"serviceAccount,omitempty"`
	Namespace        string               `json:"namespace,omitempty"`
	ImagePullSecrets []ImagePullSecretRef `json:"imagePullSecrets,omitempty"`
}

type RepositoryRef

type RepositoryRef struct {
	Name string `json:"name,omitempty"`
}

type RepositorySpec

type RepositorySpec struct {
	Name     string      `json:"name,omitempty"`
	URL      string      `json:"url,omitempty"`
	Provider GitProvider `json:"provider,omitempty"`
	Username string      `json:"username,omitempty"`
	Password string      `json:"password,omitempty"`
}

type ResolverSpec

type ResolverSpec struct {
	Name  string   `json:"name,omitempty"`
	Paths []string `json:"paths,omitempty"`
}

type Strategy

type Strategy string
const (
	StrategyCommit      Strategy = "commit"
	StrategyPullRequest Strategy = "pull-request"
)

type SubscriptionSpec

type SubscriptionSpec struct {
	Name             string         `json:"name,omitempty"`
	EndpointRefs     []EndpointRef  `json:"endpointRefs,omitempty"`
	RepositoryRef    RepositoryRef  `json:"repositoryRef,omitempty"`
	Branch           string         `json:"branch,omitempty"`
	Strategy         Strategy       `json:"strategy,omitempty"`
	Scopes           []string       `json:"scopes,omitempty"`
	FileAssociations []FileTypeSpec `json:"fileAssociations,omitempty"`
}

type UserConfigV1

type UserConfigV1 NormalizedConfig

func (UserConfigV1) Normalize

func (c UserConfigV1) Normalize() *NormalizedConfig

Jump to

Keyboard shortcuts

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