core

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBuilder = func() *Builder {
	var b Builder
	err := yaml.Unmarshal([]byte(config.DefaultBuilder), &b)
	if err != nil {
		panic(err)
	}
	err = b.Validate()
	if err != nil {
		panic(err)
	}
	return &b
}()
View Source
var MuteJob bool

Functions

func ConvertToGroups added in v0.1.0

func ConvertToGroups(repos []*Repository) []string

func GetJobPath added in v0.2.0

func GetJobPath(name string) (string, error)

func ListBuilderNames added in v0.2.0

func ListBuilderNames() ([]string, error)

func ListJobNames added in v0.2.0

func ListJobNames() ([]string, error)

func ListRemoteNames

func ListRemoteNames() ([]string, error)

func ListWorkflowNames added in v0.2.0

func ListWorkflowNames() ([]string, error)

func SplitGroup

func SplitGroup(name string) (string, string)

Types

type BuildFile added in v0.2.0

type BuildFile struct {
	Name    string `yaml:"name" validate:"required"`
	Content string `yaml:"content"`
	From    string `yaml:"from"`
}

type Builder added in v0.2.0

type Builder struct {
	Create []*Job       `yaml:"create" validate:"dive"`
	Files  []*BuildFile `yaml:"files" validate:"unique=Name,dive"`
	Init   []*Job       `yaml:"init" validate:"dive"`
	// contains filtered or unexported fields
}

func GetBuilder added in v0.2.0

func GetBuilder(name string) (*Builder, error)

func (*Builder) Execute added in v0.2.0

func (b *Builder) Execute() error

func (*Builder) Prepare added in v0.2.0

func (b *Builder) Prepare(remote *Remote, repo *Repository) error

func (*Builder) Validate added in v0.2.0

func (b *Builder) Validate() error

type Job added in v0.2.0

type Job struct {
	Name string `yaml:"name" validate:"required"`
	Run  string `yaml:"run"`

	RequireEnv []string `yaml:"require_env"`
}

func (*Job) Cmd added in v0.2.0

func (job *Job) Cmd(root string, env osutil.Env, out *bytes.Buffer) (*exec.Cmd, error)

func (*Job) Execute added in v0.2.0

func (job *Job) Execute(root string, env osutil.Env) error

func (*Job) Say added in v0.2.0

func (job *Job) Say(msg string, args ...any)

func (*Job) Skip added in v0.2.0

func (job *Job) Skip(env osutil.Env) (string, bool)

type JobError added in v0.2.0

type JobError struct {
	Name string
	Path string
	Err  error
	Out  string
}

func (*JobError) Error added in v0.2.0

func (err *JobError) Error() string

type Remote

type Remote struct {
	Name string `toml:"-"`

	Host string `toml:"host" validate:"required"`

	Protocol string `toml:"protocol" validate:"enum_protocol"`

	User  string `toml:"user" validate:"required"`
	Email string `toml:"email" validate:"email"`

	Provider string `toml:"provider" validate:"enum_provider"`
	Token    string `toml:"token"`
	API      string `toml:"api" validate:"omitempty,uri"`

	Groups []*RemoteGroup `toml:"groups" validate:"unique=Name,dive"`
}

func GetRemote

func GetRemote(name string) (*Remote, error)

func (*Remote) GetCloneURL

func (r *Remote) GetCloneURL(repo *Repository) (string, error)

func (*Remote) GetUserEmail

func (r *Remote) GetUserEmail(repo *Repository) (string, string)

type RemoteGroup

type RemoteGroup struct {
	Name string `toml:"name" validate:"required"`

	Protocol string `toml:"protocol" validate:"omitempty,enum_protocol"`

	User  string `toml:"user"`
	Email string `toml:"email" validate:"omitempty,email"`
}

type Repository

type Repository struct {
	Path string

	Name   string
	Remote string

	View uint64
	// contains filtered or unexported fields
}

func AttachRepository

func AttachRepository(remote *Remote, name, path string) (*Repository, error)

func DiscoverLocalRepositories added in v0.2.0

func DiscoverLocalRepositories(rootDir string) ([]*Repository, error)

func NewLocalRepository added in v0.2.0

func NewLocalRepository(rootDir, name string) (*Repository, error)

func WorkspaceRepository added in v0.2.0

func WorkspaceRepository(remote *Remote, name string) (*Repository, error)

func (*Repository) Base

func (repo *Repository) Base() string

func (*Repository) Dir added in v0.2.0

func (repo *Repository) Dir() string

func (*Repository) EnsureDir added in v0.2.0

func (repo *Repository) EnsureDir() (string, error)

func (*Repository) FullName

func (repo *Repository) FullName() string

func (*Repository) Group

func (repo *Repository) Group() string

func (*Repository) SetEnv added in v0.2.0

func (repo *Repository) SetEnv(remote *Remote, env osutil.Env) error

type RepositoryStorage

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

func NewRepositoryStorage

func NewRepositoryStorage() (*RepositoryStorage, error)

func (*RepositoryStorage) Add

func (s *RepositoryStorage) Add(repo *Repository) error

func (*RepositoryStorage) Close

func (s *RepositoryStorage) Close() error

func (*RepositoryStorage) Delete

func (s *RepositoryStorage) Delete(repo *Repository)

func (*RepositoryStorage) GetByName

func (s *RepositoryStorage) GetByName(remote, name string) *Repository

func (*RepositoryStorage) GetByPath

func (s *RepositoryStorage) GetByPath(path string) (*Repository, error)

func (*RepositoryStorage) List

func (s *RepositoryStorage) List(remote string) []*Repository

func (*RepositoryStorage) ReadOnly

func (s *RepositoryStorage) ReadOnly()

type Workflow added in v0.2.0

type Workflow struct {
	Select *WorkflowSelect `yaml:"select"`

	Jobs []*Job `yaml:"jobs" validate:"required,dive"`
}

func GetWorkflow added in v0.2.0

func GetWorkflow(name string) (*Workflow, error)

type WorkflowMatchItem added in v0.2.0

type WorkflowMatchItem struct {
	Path string
	Env  osutil.Env

	Repo *Repository
}

type WorkflowSelect added in v0.2.0

type WorkflowSelect struct {
	Repos []string `yaml:"repos"`
	Dirs  []string `yaml:"dirs"`
}

func (*WorkflowSelect) Match added in v0.2.0

Jump to

Keyboard shortcuts

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