schema

package
v0.18.26 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AuthConfigTypeUserToken = "user_token"
	AuthConfigTypeApp       = "app"
)

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Type string `json:"type" yaml:"type"`

	// type: user_token
	Token string `json:"token" yaml:"token"`

	// type: app
	ClientId             string `json:"clientId" yaml:"clientId"`
	PrivateKeyString     string `json:"privateKeyString" yaml:"privateKeyString"`
	PrivateKeyFile       string `json:"privateKeyFile" yaml:"privateKeyFile"`
	InstallationId       string `json:"installationId" yaml:"installationId"`
	AppInstallationToken string `json:"doNotUse_appInstallationToken"`
}

AuthConfig defines how to authenticate with a platform.

func (*AuthConfig) GenerateJwt added in v0.1.0

func (ac *AuthConfig) GenerateJwt() (string, error)

type ChoreSpec

type ChoreSpec struct {
	Name             string      `json:"name" yaml:"name"`
	ConventionalType string      `json:"conventionalType" yaml:"conventionalType"`
	Description      string      `json:"description" yaml:"description"`
	Steps            []ChoreStep `json:"steps" yaml:"steps"`

	SkipCloneStep    bool `json:"skipCloneStep" yaml:"skipCloneStep"`
	SkipFinaliseStep bool `json:"skipFinaliseStep" yaml:"skipFinaliseStep"`

	// SourceConfig contains the original user-specified config that was resolved into this chore.
	SourceConfig RepoChoreConfig `json:"internal_sourceConfig" yaml:"internal_sourceConfig"`
}

func (*ChoreSpec) CommitMessage added in v0.8.0

func (choreSpec *ChoreSpec) CommitMessage() string

func (*ChoreSpec) PrBody

func (choreSpec *ChoreSpec) PrBody() string

func (*ChoreSpec) PrTitle

func (choreSpec *ChoreSpec) PrTitle() string

type ChoreStep

type ChoreStep struct {
	Image       string            `json:"image" yaml:"image"`
	Command     string            `json:"command" yaml:"command"`
	Environment map[string]string `json:"environment" yaml:"environment"`
	Internal    bool              `json:"-"`
}

type ExecutionStep

type ExecutionStep struct {
	Image   string `json:"image" yaml:"image"`
	Command string `json:"command" yaml:"command"`

	Label       string
	Environment map[string]string
}

ExecutionStep decouples the definition of a ChoreStep from the actual execution.

type Executor

type Executor interface {
	Init(conf TediumConfig) error
	ExecuteChore(job Job) error
}

type ExecutorConfig

type ExecutorConfig struct {
	Podman     *PodmanExecutorConfig     `json:"podman" yaml:"podman"`
	Kubernetes *KubernetesExecutorConfig `json:"kubernetes" yaml:"kubernetes"`
}

ExecutorConfig defines the executor used to perform chores.

type Job

type Job struct {
	Config          TediumConfig
	Repo            Repo
	Chore           ChoreSpec
	ExecutionSteps  []ExecutionStep
	PlatformConfig  PlatformConfig
	WorkBranchName  string
	FinalBranchName string
}

Job represents an item of work to be done: a specific chore on a specific repo. It should be self-contained; i.e. carry all the info needed to perform a job.

func JobFromEnvironment

func JobFromEnvironment() (Job, error)

func (*Job) ToEnvironment

func (job *Job) ToEnvironment() (map[string]string, error)

ToEnvironment() bundles the Job into a single environment variable that can be unpacked later by the init and finalise stages of an execution.

type JsonPatch

type JsonPatch []JsonPatchOperation

type JsonPatchOperation

type JsonPatchOperation struct {
	Operation string `json:"op" yaml:"op"`
	Path      string `json:"path" yaml:"path"`
	Value     string `json:"value" yaml:"value"`
}

type KubernetesExecutorConfig

type KubernetesExecutorConfig struct {
	// KubeconfigPath locates the configuration used to communicate with Kubernetes. If not supplied, the executable will assume it is running inside Kubernetes and will attempt to use the in-cluster config.
	KubeconfigPath string `json:"kubeconfigPath" yaml:"kubeconfigPath"`

	// Namespace defines where chores are executed. It defaults to "default".
	Namespace string `json:"namespace" yaml:"namespace"`
}

type PlatformConfig

type PlatformConfig struct {
	Type   string      `json:"type" yaml:"type"`
	Domain string      `json:"domain" yaml:"domain"`
	Auth   *AuthConfig `json:"auth" yaml:"auth"`

	// SkipDiscovery specifies that this platform should not be used to discover target repos (i.e. it is only used for reading config).
	SkipDiscovery bool `json:"skipDiscovery" yaml:"skipDiscovery"`

	// RepoFiltersRaw specifies a list of Go regexes; if specified, only repos that match at least one filter will be processed.
	RepoFiltersRaw []string `json:"repoFilters" yaml:"repoFilters"`
	RepoFilters    []*regexp.Regexp
}

PlatformConfig defines a Git platform from which repos can be discovered, such as Gitea or GitHub.

func (*PlatformConfig) AcceptsRepo

func (pc *PlatformConfig) AcceptsRepo(fullName string) bool

type PlatformProfile added in v0.1.0

type PlatformProfile struct {
	Email string
}

type PodmanExecutorConfig

type PodmanExecutorConfig struct {
	// SocketPath identifies the socket used to communicate with Podman. If not supplied, several default values will be tried.
	SocketPath string `json:"socketPath" yaml:"socketPath"`
}

type Repo

type Repo struct {
	// present for all repos
	Domain    string
	OwnerName string
	Name      string

	// present for target repos only
	CloneUrl      string
	Auth          RepoAuth
	DefaultBranch string
	Archived      bool
}

Repo represents a real Git repo, which may be either a remote repo from which chores or config are read, or a target repo cloned to disk.

func RepoFromUrl added in v0.3.0

func RepoFromUrl(repoUrl string) (Repo, error)

func (*Repo) FullName

func (r *Repo) FullName() string

type RepoAuth added in v0.3.0

type RepoAuth struct {
	Username string
	Password string
}

func (*RepoAuth) ToTransportAuth added in v0.3.0

func (ra *RepoAuth) ToTransportAuth() transport.AuthMethod

type RepoChoreConfig

type RepoChoreConfig struct {
	Url       string `json:"url" yaml:"url"`
	Directory string `json:"directory" yaml:"directory"`

	// Branch specifies the bracnh to read the chore definition from. If blank the default branch will be used.
	Branch string `json:"branch" yaml:"branch"`

	// Environment specifies additional environment variables to be passed to all stages of chore execution. Variables must not start with "TEDIUM_.
	Environment map[string]string `json:"environment" yaml:"environment"`

	// ExposePlatformToken specifies that the target repo's platform auth token should be exposed to chore steps via the TEDIUM_PLATFORM_TOKEN environment variable. Use with caution.
	ExposePlatformToken bool `json:"exposePlatformToken" yaml:"exposePlatformToken"`
}

RepoChoreConfig defines one chore to apply to a repo.

type RepoConfig

type RepoConfig struct {
	Extends []string          `json:"extends,omitempty" yaml:"extends,omitempty"`
	Chores  []RepoChoreConfig `json:"chores,omitempty" yaml:"chores,omitempty"`
}

RepoConfig is read from a target repo. The main purpose is to define which chores are to be applied.

type ResolvedRepoConfig

type ResolvedRepoConfig struct {
	Chores []ChoreSpec
}

ResolvedRepoConfig is the result of taking a target repo, following all "extends" links, and resolving all chore references into their actual spec.

type TediumConfig

type TediumConfig struct {
	// Executor defines the actual executor that will be used to perform chores.
	Executor ExecutorConfig `json:"executor" yaml:"executor"`

	// Platforms defines the set of repository hosting platforms that repos will be discovered from.
	Platforms []PlatformConfig `json:"platforms" yaml:"platforms"`

	// Images defines the container images used for Tedium-owned stages of execution
	Images struct {
		Tedium string `json:"tedium" yaml:"tedium"`
		Pause  string `json:"pause" yaml:"pause"`
	} `json:"images" yaml:"images"`

	// AutoEnrollment defines the Tedium config to apply to repos that don't already have one.
	AutoEnrollment struct {
		Enabled bool       `json:"enabled" yaml:"enabled"`
		Config  RepoConfig `json:"config" yaml:"config"`
	} `json:"autoEnrollment" yaml:"autoEnrollment"`

	// ChoreConcurrency defines how many chores Tedium should attempt to run concurrently. It is an upper bound and may not be reached. Defaults to 1.
	ChoreConcurrency int `json:"choreConcurrency" yaml:"choreConcurrency"`
}

TediumConfig is passed to the Tedium executable to control its behaviour.

func LoadTediumConfig

func LoadTediumConfig(configFilePath string) (TediumConfig, error)

func (*TediumConfig) CompileRepoFilters

func (conf *TediumConfig) CompileRepoFilters() error

Jump to

Keyboard shortcuts

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