models

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HOOKHANDLER_VALIDATION = "pre-build-validation"
	CHECKMARK              = "\u2713"
	FAILED                 = "\u2717"
)
View Source
var SkipMsgs = []string{"[skip ci]", "[ci skip]"}

Functions

func DontBuildEvent added in v0.8.0

func DontBuildEvent(vcsType pb.SubCredType, incorrectEType string) error

func ParseStagesByBuildId

func ParseStagesByBuildId(buildSum *pb.BuildSummary, stageResults []StageResult) *pb.Status

ParseStagesByBuildId will combine the buildsummary + stages to a single object called "Status"

Types

type BranchNotFound

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

func Branch404

func Branch404(branch, acctRepo string) *BranchNotFound

func (*BranchNotFound) Error

func (bnf *BranchNotFound) Error() string

type BuildContext

type BuildContext struct {
	Hash       string
	Context    context.Context
	CancelFunc func()
}

type BuildOutput

type BuildOutput struct {
	BuildId  int64  `json:"buildId,omitempty"`
	Output   []byte `json:"output,omitempty"`
	OutputId int64  `json:"outputId,omitempty"` // generated by postgres
}

func (*BuildOutput) Equals

func (o *BuildOutput) Equals(n *BuildOutput) bool

func (*BuildOutput) Validate

func (o *BuildOutput) Validate() error

type CommitNotFound

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

func Commit404

func Commit404(hash, acctRepo, branch string) *CommitNotFound

func (*CommitNotFound) Error

func (cnf *CommitNotFound) Error() string

type DontBuildThisEvent added in v0.8.0

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

func (*DontBuildThisEvent) Error added in v0.8.0

func (dbe *DontBuildThisEvent) Error() string

type ErrInvalid

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

errors for validation

func NewErrInvalid

func NewErrInvalid(message string) *ErrInvalid

func (*ErrInvalid) Error

func (e *ErrInvalid) Error() string

type Flagger

type Flagger interface {
	IntVar(p *int, name string, value int, usage string)
	BoolVar(p *bool, name string, value bool, usage string)
	StringVar(p *string, name string, value string, usage string)
}

type JsonStringArray

type JsonStringArray []string

JsonStringArray exists because list of messages belonging to stages is stored as json in db. To get it to unparse from DB correctly, we have to implement custom Value() + Scan(). Check postgres.go for usage

func (*JsonStringArray) Scan

func (f *JsonStringArray) Scan(src interface{}) error

func (JsonStringArray) Value

func (f JsonStringArray) Value() (driver.Value, error)

type JsonStringMap

type JsonStringMap map[string]string

func NewMap

func NewMap() JsonStringMap

func (JsonStringMap) Scan

func (f JsonStringMap) Scan(src interface{}) error

func (JsonStringMap) Value

func (f JsonStringMap) Value() (driver.Value, error)

type SSHFacts

type SSHFacts struct {
	User     string
	Host     string
	Port     int
	KeyFP    string
	Password string
	// KeepRepo; if true then the repositories will be left on machine and new commits will be checked out instead of re-cloned? idk. maybe not.
	KeepRepo bool
}

When a werker starts up as an SSH werker, it will also need to be initialized with these fields so it knows

what to connect to

func (*SSHFacts) IsValid

func (sf *SSHFacts) IsValid() bool

func (*SSHFacts) SetFlags

func (sf *SSHFacts) SetFlags(flg Flagger)

type StageResult

type StageResult struct {
	BuildId       int64 //foreign key on build_summary table
	StageResultId int64 //generated by postgres
	Stage         string
	Status        int
	Error         string
	Messages      []string
	StartTime     time.Time
	StageDuration float64
}

this is store inside of build_stage_details

func (*StageResult) Validate

func (r *StageResult) Validate() error

type Translator

type Translator interface {
	//TranslatePush should take a reader body, unmarshal it to vcs-specific model, then translate it to the global Push object
	TranslatePush(reader io.Reader) (*pb.Push, error)

	//TranslatePush should take a reader body, unmarshal it to vcs-specific model, then translate it to the global PullRequest object
	TranslatePR(reader io.Reader) (*pb.PullRequest, error)
}

type Transport

type Transport struct {
	Hash     string
	InfoChan chan []byte
	DbId     int64
}

Transport struct is for the Transport channel that will interact with the streaming side of the service to stream results back to the admin. It sends just enough to be unique, the hash that triggered the build and the InfoChan which the builder will write to.

type VCSHandler

type VCSHandler interface {
	GetVcsType() pb.SubCredType
	//Walk will iterate over all repositories for specified vcs account, and create webhooks at specified webhook url
	//if one does not yet exist
	Walk() error

	//GetFile retrieves file based on file path, full repo name, and commit hash
	GetFile(filePath string, fullRepoName string, commitHash string) (bytez []byte, err error)

	//CreateWebhook will create a webhook using the webhook creation endpoint associated with codebase
	CreateWebhook(webhookURL string) error

	//GetCallbackURL retrieves the current callback URL
	GetCallbackURL() string

	//SetCallbackURL sets the callback URL for webhooks
	SetCallbackURL(callbackURL string)

	//SetBaseURL set the base URL for this handler
	SetBaseURL(baseURL string)

	//GetBaseURL returns the base URL for this handler
	GetBaseURL() string

	//Get Repository links by account name + repo name
	GetRepoLinks(acctRepo string) (*pb.Links, error)

	//GetAllBranchesLastCommitData returns a list of all active branches, their last hash, and the last commit datetime
	GetAllBranchesLastCommitData(acctRepo string) ([]*pb.BranchHistory, error)

	//GetCommit will return commit information of a specific hash
	GetCommit(acctRepo, hash string) (*pb.Commit, error)

	//GetBranchLastCommitData should return the last hash and commit datetime of a specific branch
	GetBranchLastCommitData(acctRepo, branch string) (*pb.BranchHistory, error)

	//GetCommitLog will return a list of Commits, starting with the most recent and ending at the lastHash value.
	// If the lastHash commit value is never found, will return an error.
	GetCommitLog(acctRepo string, branch string, lastHash string) ([]*pb.Commit, error)

	// GetChangedFiles will get the list of files that have changed between commits. If earliestHash is not passed,
	//  then the diff list will be off of just the changed files in the latestHash. If earliesthash is passed, then it will
	//  return the changeset similar to git diff --name-only <latestHash>..<earliestHash>
	GetChangedFiles(acctRepo, latesthash, earliestHash string) ([]string, error)

	// PostPRComment will add a comment to a pr belonging to acct/repo acctRepo and id prId with a comment that is along the lines of
	// Ocelot build has <status>.
	PostPRComment(acctRepo, prId, hash string, failed bool, buildId int64) error

	GetClient() ocenet.HttpClient
}

type WerkType

type WerkType int
const (
	Kubernetes WerkType = iota
	Docker
	SSH
	Exec
)

func (WerkType) String

func (w WerkType) String() string

type WerkerFacts

type WerkerFacts struct {
	Uuid        uuid.UUID
	WerkerType  WerkType
	LoopbackIp  string
	RegisterIP  string
	ServicePort string
	GrpcPort    string
	// set dev mode
	Dev bool
	// this is only for SSH type werkers
	Ssh                    *SSHFacts
	DiskUtilityHealthCheck *du.HealthChecker
	HealthCheckInterval    int
}

WerkerFacts is a struct for the configurations in werker that affect actual builds. Think of it like gather facts w/ ansible.

func NewFacts

func NewFacts() *WerkerFacts

Directories

Path Synopsis
Package mock_models is a generated GoMock package.
Package mock_models is a generated GoMock package.
pb

Jump to

Keyboard shortcuts

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