Documentation ¶
Index ¶
- Constants
- Variables
- func DirExists(path string) bool
- func GetDefaultConfig() string
- func GetResInfoPath(base string) string
- type ArgParser
- type BuildJob
- func (buildJob *BuildJob) GetLogs(since int64, w io.Writer, tail string) error
- func (buildJob *BuildJob) Init() error
- func (buildJob *BuildJob) Pause() error
- func (buildJob *BuildJob) Resume() error
- func (buildJob *BuildJob) Run(dataDir string, argParser *ArgParser) (*BuildResult, *time.Duration)
- func (buildJob *BuildJob) Save(db *gorm.DB) error
- func (buildJob *BuildJob) Stop()
- type BuildResult
- type Config
- type CountResponse
- type DataManagerArgs
- type IDsResponse
- type Job
- func (job *Job) Cancel()
- func (job *Job) GetInfo() string
- func (job *Job) GetLogs(requestTime time.Time, since int64, w io.Writer, checkAmbigious bool) error
- func (job *Job) GetState() libremotebuild.JobState
- func (job *Job) Init(db *gorm.DB, config *Config) error
- func (job *Job) Run() error
- func (job *Job) Save() (err error)
- func (job *Job) SetState(newState libremotebuild.JobState)
- func (job Job) ToJobInfo() libremotebuild.JobInfo
- type LoginResponse
- type LoginSession
- type Namespaceinfo
- type ResInfo
- type ResponseStatus
- type StringResponse
- type StringSliceResponse
- type UploadJob
- type UploadJobResult
- type User
- type UserAttributeDataResponse
Constants ¶
const ( // NotFoundError error from server NotFoundError string = "Not found" // ActionNotAllowed error from server ActionNotAllowed string = "Action not allowed" // WrongLength error from server WrongLength string = "Wrong length" // ServerError error from server ServerError string = "Server Error" // WrongInputFormatError wrong user input WrongInputFormatError string = "Wrong inputFormat!" // InvalidTokenError token is not valid InvalidTokenError string = "Token not valid" // InvalidCallbackURL token is not valid InvalidCallbackURL string = "Callback url is invalid" // BatchSizeTooLarge batch is too large BatchSizeTooLarge string = "BatchSize soo large!" // WrongIntegerFormat integer is probably no integer WrongIntegerFormat string = "Number is string" // MultipleSourceNameErr err name already exists MultipleSourceNameErr string = "You can't have multiple sources with the same name" // UserIsInvalidErr err if user is invalid UserIsInvalidErr string = "user is invalid" )
const ( // HeaderStatus headername for status in response HeaderStatus string = "X-Response-Status" // HeaderStatusMessage headername for status in response HeaderStatusMessage string = "X-Response-Message" // HeaderContentType contenttype of response HeaderContentType string = "Content-Type" // HeaderContentLength request content length HeaderContentLength string = "ContentLength" )
const ResInfoFileName = "resInfo"
ResInfoFileName name for resInfo file
const SessionTokenLength = 64
SessionTokenLength length of session token
Variables ¶
var ( // ErrNoManagerDataAvailable if no datamanager data is available but required ErrNoManagerDataAvailable = errors.New("No DManager data available") // ErrNoVaildUploadMetodPassed if no uploadmethod/data was passed ErrNoVaildUploadMetodPassed = errors.New("No vaild upolad method passed") )
var ( // ErrAURNoRepoFound if no repo name was given ErrAURNoRepoFound = errors.New("No AUR repo-name found") )
var ErrFileEmpty = errors.New("file is empty")
ErrFileEmpty if file is empty
var ErrInvalidFormat = errors.New("Invalid resInfo format")
ErrInvalidFormat error if resinfo format is invalid
var ErrJobNotRunning = errors.New("Job not running")
ErrJobNotRunning if job is not running
var ErrNoLogsFound = errors.New("No logs found")
ErrNoLogsFound if no logs were found
var ErrorJobCancelled = errors.New("job cancelled")
ErrorJobCancelled error if user exists
var ErrorNonZeroExit = errors.New("Non zero exit code from container")
ErrorNonZeroExit error if user exists
var ErrorUserAlreadyExists = errors.New("user already exists")
ErrorUserAlreadyExists error if user exists
Functions ¶
func GetDefaultConfig ¶
func GetDefaultConfig() string
GetDefaultConfig gets the default config path
func GetResInfoPath ¶
GetResInfoPath return path for resinfo file
Types ¶
type ArgParser ¶
type ArgParser struct { JobType libremotebuild.JobType // contains filtered or unexported fields }
ArgParser parse job args
func NewArgParser ¶
func NewArgParser(args map[string]string, JobType libremotebuild.JobType) *ArgParser
NewArgParser create new argparser
func (*ArgParser) GetDManagerData ¶
func (argParser *ArgParser) GetDManagerData() *DataManagerArgs
GetDManagerData return Dmanager Data
func (*ArgParser) GetDManagerNamespace ¶
GetDManagerNamespace return the namespace according to the dmanager args
func (*ArgParser) HasDataManagerArgs ¶
HasDataManagerArgs return true if DManager data is available
func (*ArgParser) HasNamespace ¶
HasNamespace return true if namespace is set
func (*ArgParser) ParseEnvars ¶
ParseEnvars parse args to envars based on the JobType
type BuildJob ¶
type BuildJob struct { *docker.Client `gorm:"-"` gorm.Model State libremotebuild.JobState // Build state Type libremotebuild.JobType // Type of job Image string // Dockerimage to run UseCcache bool // use ccahe to improve build speed ContainerID string `gorm:"-"` Config *Config `gorm:"-"` // contains filtered or unexported fields }
BuildJob a job which builds a package
func NewBuildJob ¶
func NewBuildJob(db *gorm.DB, config *Config, buildJob BuildJob, image string, useCcache bool) (*BuildJob, error)
NewBuildJob create new BuildJob
type BuildResult ¶
type BuildResult struct { Error error // contains filtered or unexported fields }
BuildResult result of a bulid
type Config ¶
type Config struct { Server configServer Webserver webserverConf }
Config config for the server
func InitConfig ¶
InitConfig inits the config Returns true if system should exit
func (Config) GetImage ¶
func (config Config) GetImage(buildType libremotebuild.JobType) (string, bool)
GetImage get DockerImage for buildType
func (Config) IsCcacheDirValid ¶
IsCcacheDirValid return true if cache is valid
type CountResponse ¶
type CountResponse struct {
Count uint32 `json:"count"`
}
CountResponse response containing a count of changed items
type DataManagerArgs ¶
DataManagerArgs data for datamanager
type IDsResponse ¶
type IDsResponse struct {
IDs []uint `json:"ids"`
}
IDsResponse response containing a list of ids
type Job ¶
type Job struct { gorm.Model // Buildjob BuildJobID uint `sql:"index"` BuildJob *BuildJob `gorm:"association_autoupdate:false;association_autocreate:false"` // UploadJob UploadJobID uint `sql:"index"` UploadJob *UploadJob `gorm:"association_autoupdate:false;association_autocreate:false"` DataDir string // Shared dir containing build files Result string // Message of an exited job LastLogs string // Latest logs Argdata string `grom:"type:jsonb"` Info string Duration int64 Args map[string]string `gorm:"-"` // Envars for Dockerimage *gorm.DB `gorm:"-"` Cancelled bool `gorm:"-"` LastSince int64 `gorm:"-"` // contains filtered or unexported fields }
Job a job created by a user
func NewJob ¶
func NewJob(db *gorm.DB, config *Config, image string, buildJob BuildJob, uploadJob UploadJob, args map[string]string, useCcache bool) (*Job, error)
NewJob create a new job
func (*Job) GetState ¶
func (job *Job) GetState() libremotebuild.JobState
GetState get state of a job
func (*Job) SetState ¶
func (job *Job) SetState(newState libremotebuild.JobState)
SetState set the state of a job
func (Job) ToJobInfo ¶
func (job Job) ToJobInfo() libremotebuild.JobInfo
ToJobInfo return JobInfo by job
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token"`
}
LoginResponse response for login
type LoginSession ¶
type LoginSession struct { gorm.Model User *User `gorm:"association_autoupdate:false;association_autocreate:false"` UserID uint Token string Requests int64 MachineID string }
LoginSession session for loggedin user
func NewSession ¶
func NewSession(user *User, machineID string) *LoginSession
NewSession create new login session
type Namespaceinfo ¶
Namespaceinfo info for namespace
type ResInfo ¶
ResInfo containing Information about the result of an built package
func ParseResInfo ¶
ParseResInfo parses result info from file
type ResponseStatus ¶
type ResponseStatus uint8
ResponseStatus the status of response
const ( //ResponseError if there was an error ResponseError ResponseStatus = 0 //ResponseSuccess if the response is successful ResponseSuccess ResponseStatus = 1 )
type StringResponse ¶
type StringResponse struct {
String string `json:"content"`
}
StringResponse response containing only one string
type StringSliceResponse ¶
type StringSliceResponse struct {
Slice []string `json:"slice"`
}
StringSliceResponse response containing only one string slice
type UploadJob ¶
type UploadJob struct { gorm.Model State libremotebuild.JobState // Upload state Type libremotebuild.UploadType // contains filtered or unexported fields }
UploadJob a job which uploads a built package
func NewUploadJob ¶
NewUploadJob create new upload job
func (*UploadJob) Run ¶
func (uploadJob *UploadJob) Run(buildResult BuildResult, argParser *ArgParser) *UploadJobResult
Run an upload job
type UploadJobResult ¶
type UploadJobResult struct {
Error error
}
UploadJobResult result of uploading a binary
type User ¶
User user in db
func GetUserFromSession ¶
GetUserFromSession return user from session
type UserAttributeDataResponse ¶
type UserAttributeDataResponse struct {
Namespace []Namespaceinfo `json:"nsData"`
}
UserAttributeDataResponse response for userattribute data