scm

package
v0.23.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWrongConfig is returned when a scm has missing attributes which are mandatory
	ErrWrongConfig = errors.New("wrong scm configuration")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Kind string
	Spec interface{} `jsonschema:"type=object"`
}

func (Config) JSONSchema added in v0.23.0

func (Config) JSONSchema() *jschema.Schema

JSONSchema implements the json schema interface to generate the "scm" jsonschema

func (*Config) Validate

func (c *Config) Validate() error

type MockScm

type MockScm struct {
	ScmHandler
	WorkingDir   string
	ChangedFiles []string
	Err          error
}

MockScm is a stub implementation of the `Scm` interface to be used in our unit test suites. It stores the expected WorkingDir

func (*MockScm) GetChangedFiles

func (m *MockScm) GetChangedFiles(workingDir string) ([]string, error)

func (*MockScm) GetDirectory

func (m *MockScm) GetDirectory() (directory string)

type Scm

type Scm struct {
	Config  *Config
	Handler ScmHandler
}

func New

func New(config *Config) (Scm, error)

func (*Scm) GenerateSCM

func (s *Scm) GenerateSCM() error

type ScmHandler

type ScmHandler interface {
	Add(files []string) error
	Clone() (string, error)
	Checkout() error
	GetDirectory() (directory string)
	Init(pipelineID string) error
	Push() error
	Commit(message string) error
	Clean() error
	PushTag(tag string) error
	GetChangedFiles(workingDir string) ([]string, error)
}

Scm is an interface that offers common functions for a source control manager like git or github

Jump to

Keyboard shortcuts

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