model

package
v0.0.0-...-ede0ace Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNoMorePersisted

func IsNoMorePersisted(err error) bool

func IsOutDated

func IsOutDated(err error) bool

func NewNoMorePersisted

func NewNoMorePersisted(msg string) error

func NewOutDated

func NewOutDated(msg string) error

return an error when trying to update some entity with outdated data

Types

type DockerRegistry

type DockerRegistry struct {
	Id                   string `json:"id"`
	Name                 string `json:"name"`
	Url                  string `json:"url"`
	User                 string `json:"user"`
	Password             string `json:"password"`
	LastModificationTime string `json:"lastModificationTime"`
}

func (DockerRegistry) CheckCredentials

func (r DockerRegistry) CheckCredentials(ctx context.Context) container.ContainerError

func (*DockerRegistry) GenerateId

func (r *DockerRegistry) GenerateId() error

func (*DockerRegistry) NewLastModificationTime

func (r *DockerRegistry) NewLastModificationTime()

update the LastModificationTimeField

func (*DockerRegistry) ToPublicModel

func (r *DockerRegistry) ToPublicModel()

type DockerRegistryUpdate

type DockerRegistryUpdate struct {
	DockerRegistry
	ChangedFields []string `json:"changedFields"`
}

func (*DockerRegistryUpdate) MergeForUpdate

func (r *DockerRegistryUpdate) MergeForUpdate(currentRegistry *DockerRegistry) *DockerRegistry

type Event

type Event struct {
	Type        EventType `json:"type"`
	ExecutionId string    `json:"execution-id"`
	Value       string    `json:"value"`
}

Event contains updated information on a current execution. it could be job start, new logs, step start, step failed, step succeed, job succeed, job failed, ...

type EventType

type EventType string
const (
	JobStart     EventType = "job-start"
	StepStart    EventType = "step-start"
	StepFailed   EventType = "step-failed"
	StepCanceled EventType = "step-canceled"
	StepSucceed  EventType = "step-succeed"
	JobFailed    EventType = "job-failed"
	JobCanceled  EventType = "job-canceled"
	JobSucceed   EventType = "job-succeed"
	NewLog       EventType = "new-log"
)

type ExecutionStatus

type ExecutionStatus string

status for StepExecution

const (
	Pending  ExecutionStatus = "pending"
	Running  ExecutionStatus = "running"
	Success  ExecutionStatus = "success"
	Failure  ExecutionStatus = "failure"
	Canceled ExecutionStatus = "canceled"
)

type GitConfig

type GitConfig struct {
	HttpAuth *HttpAuthConfig `json:"httpAuth"`
	SshAuth  *SshAuthConfig  `json:"sshAuth"`
}

func (GitConfig) IsValid

func (g GitConfig) IsValid() bool

todo test me

func (*GitConfig) ToPublicModel

func (g *GitConfig) ToPublicModel()

type HttpAuthConfig

type HttpAuthConfig struct {
	Url      string `json:"url"`
	User     string `json:"user"`
	Password string `json:"password"`
}

func (HttpAuthConfig) IsValid

func (a HttpAuthConfig) IsValid() bool

func (*HttpAuthConfig) ToPublicModel

func (a *HttpAuthConfig) ToPublicModel()

type Image

type Image struct {
	Name       string // Name of the image
	RegistryId string // external key to a registry configuration
	Registry   *DockerRegistry
}

Container image. Contains its name and a registry ID, if needed (case of image not public on defaut registry)

func (*Image) ComputeName

func (i *Image) ComputeName() string

ComputeName will return the Name of the image regarding of its registry. If there is none, the raw name is used, ${REGISTRY_URL}/${IMAGE_NAME} instead

type Job

type Job struct {
	Id              []byte         `json:"id"`              // id of the job
	Name            string         `json:"name"`            // simple label used for display
	GitConf         GitConfig      `json:"gitConfig"`       // repository configuration
	Steps           []Step         `json:"steps"`           // job steps execution
	Executions      []JobExecution `json:"executions"`      // list of past executions that are still available
	RemoveWorkspace bool           `json:"removeWorkspace"` // if true, the workspace is removed after every execution of the job
}

configuration of a dahu job

func (*Job) GenerateId

func (j *Job) GenerateId() error

func (*Job) IsValid

func (j *Job) IsValid() bool

func (*Job) String

func (j *Job) String() string

func (*Job) ToPublicModel

func (j *Job) ToPublicModel()

type JobExecution

type JobExecution struct {
	Id         string // the id of this execution Job. Used to update on particular execution
	BranchName string
	VolumeName string           // the name of the volume where the workspace is stored
	Steps      []*StepExecution // execution of step related to that job execution
	Date       time.Time        // the instant when the job execution has start
	Duration   time.Duration    // global duration of the job execution
}

contains everything related to one particular execution of a Job

func (*JobExecution) GenerateId

func (j *JobExecution) GenerateId() error

type Login

type Login struct {
	Id       string `json:"id"`
	Password string `json:"password"`
}

type used for authentication on /login

type Port

type Port struct {
	Num       int
	Prototype string
}

Port exposed by a container. typically used by a StepDependency like a DataBase

type PublicModel

type PublicModel interface {
	ToPublicModel()
}

type Service

type Service struct {
	Name         string  // name under wich the service will be available during the step
	Image        Image   // container image
	ExposedPorts []*Port // exposed ports
}

Service that may needed for some step (for example integration tests). A name, the image and exposed port have to be defined

type SshAuthConfig

type SshAuthConfig struct {
	Url         string `json:"url"`
	Key         string `json:"key"`
	KeyPassword string `json:"keyPassword"`
}

func (SshAuthConfig) IsValid

func (a SshAuthConfig) IsValid() bool

func (*SshAuthConfig) ToPublicModel

func (a *SshAuthConfig) ToPublicModel()

type Step

type Step struct {
	Name          string // display name of the step
	Image         Image  // the image that contains the needed dependencies for this step (node, golang, java, etc...)
	Envs          map[string]string
	Command       []string   // the command of the step
	MountingPoint string     // the place where the volume should be mounted. TODO think of a default value ?
	Services      []*Service // services that are needed for this step. For example a Database for an integration tests step.
}

step of a Job. It is defined by an image and a command to run. Optionnally, some dependencies may be defined.

func (Step) ComputeEnvs

func (s Step) ComputeEnvs() map[string]string

return Envs of the step and additional env entries bases on available services

type StepExecution

type StepExecution struct {
	Name     string
	Status   ExecutionStatus // status of the step execution
	Duration time.Duration   // global duration of the step execution
	Logs     string          // logs attached to the step
}

contains everything related to one execution of a step of a particular job execution

func (StepExecution) IsSuccess

func (e StepExecution) IsSuccess() bool

type Token

type Token struct {
	Value string `json:"value"`
}

this is the answer to a successfull login call

type User

type User struct {
	Login    string `json:"login"`
	Password []byte // unexported and excluded from json marshaling
}

User of Dahu system. A user can be a human, or not. It represents only an identity.

func (*User) ComparePassword

func (u *User) ComparePassword(password []byte) error

func (*User) SetPassword

func (u *User) SetPassword(password []byte) error

hash and affect a new password

func (*User) String

func (u *User) String() string

Jump to

Keyboard shortcuts

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