models

package
v0.0.0-...-3c15615 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRVBLabels

func GetRVBLabels(sl []string) []string

func HasRVBLabels

func HasRVBLabels(sl []string) bool

Types

type Builder

type Builder struct {
	ID      int64  `bun:",pk,autoincrement" json:"id"`
	Name    string `bun:",unique"`
	Sponsor string
	Token   string `bun:",type:text" json:"token"`
	Meta    map[string]string
	Labels  []string

	Type        BuilderType
	Status      BuilderStatus
	FailedCount int
	TaskID      int64 `bun:"task_id"`

	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"created_at"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"updated_at"`
}

func (*Builder) AfterCreateTable

func (*Builder) AfterCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

type BuilderStatus

type BuilderStatus string
const (
	BuilderIdle        BuilderStatus = "idle"
	BuilderLocked      BuilderStatus = "locked"
	BuilderPreparing   BuilderStatus = "preparing"
	BuilderWorking     BuilderStatus = "working"
	BuilderDied        BuilderStatus = "died"
	BuilderQuarantined BuilderStatus = "quarantined"
)

type BuilderType

type BuilderType string
const (
	BuilderSSH    BuilderType = "ssh"
	BuilderPodman BuilderType = "podman"
)

type GithubInstall

type GithubInstall struct {
}

type GithubWorkflowJob

type GithubWorkflowJob struct {
	ID      int64                   `bun:"id,pk" json:"id"`
	RunID   int64                   `bun:",notnull" json:"run_id"`
	HeadSHA string                  `bun:",notnull" json:"head_sha"`
	Name    string                  `json:"name"`
	Status  GithubWorkflowJobStatus `json:"status"`

	// Runner related
	Labels       []string `json:"labels"`
	RunnerID     int64    `json:"runner_id"`
	RunnerName   string   `json:"runner_name"`
	WorkflowName string   `json:"workflow_name"`

	// Repo
	Owner    string `json:"owner"`
	RepoID   int64  `bun:",notnull" json:"repo_id"`
	RepoName string `json:"repo_name"`

	// Install
	InstallationID int64 `json:"installation_id"`

	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"created_at"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"updated_at"`
}

func (*GithubWorkflowJob) AfterCreateTable

func (*GithubWorkflowJob) AfterCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

func (*GithubWorkflowJob) BeforeAppendModel

func (g *GithubWorkflowJob) BeforeAppendModel(ctx context.Context, query bun.Query) error

func (*GithubWorkflowJob) IsStatusChangable

func (g *GithubWorkflowJob) IsStatusChangable(ns GithubWorkflowJobStatus) bool

type GithubWorkflowJobStatus

type GithubWorkflowJobStatus string
const (
	WorkflowJobQueued     GithubWorkflowJobStatus = "queued"
	WorkflowJobInProgress GithubWorkflowJobStatus = "in_progress"
	WorkflowJobCompleted  GithubWorkflowJobStatus = "completed"
	WorkflowWaiting       GithubWorkflowJobStatus = "waiting"
	WorkflowRequested     GithubWorkflowJobStatus = "requested"
	WorkflowPending       GithubWorkflowJobStatus = "pending"

	WorkflowJobScheduled = "scheduled" // rvb status
	WorkflowJobTimeout   = "timeout"   // rvb status
	WorkflowJobFailed    = "failed"    // rvb status
)

type Task

type Task struct {
	ID        int64              `bun:",pk,autoincrement" json:"id"`
	Builder   *Builder           `bun:"rel:belongs-to,join:builder_id=id" json:"-"`
	BuilderID int64              `bun:"builder_id" json:"builder_id"`
	Job       *GithubWorkflowJob `bun:"rel:belongs-to,join:job_id=id" json:"-"`
	JobID     int64              `bun:"job_id,unique" json:"job_id"`

	Name         string
	Labels       []string
	SystemLabels []string
	URL          string `bun:",type:text"`
	Ephemeral    bool
	Status       TaskStatus

	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"created_at"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"updated_at"`
	QueuedAt  time.Time `bun:"queued_at,nullzero,notnull,default:current_timestamp"`
	DeadLine  time.Time `bun:"deadline,nullzero,notnull" json:"deadline"`
}

func (*Task) AfterCreateTable

func (*Task) AfterCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

func (*Task) BeforeAppendModel

func (g *Task) BeforeAppendModel(ctx context.Context, query bun.Query) error

type TaskStatus

type TaskStatus string
const (
	TaskPending          TaskStatus = "pending"
	TaskBuilderAssigned  TaskStatus = "builder_assigned"
	TaskBuilderPreparing TaskStatus = "builder_preparing"
	TaskBuilderReady     TaskStatus = "builder_ready"
	TaskInProgress       TaskStatus = "in_progress"
	TaskCompleted        TaskStatus = "completed"
	TaskTimeout          TaskStatus = "timeout"
	TaskFailed           TaskStatus = "failed"
)

type Token

type Token struct {
	ID    int64 `bun:"id,pk,autoincrement"`
	Type  TokenType
	Key   string
	Value string `bun:",text"`

	CreatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"created_at"`
	UpdatedAt time.Time `bun:",nullzero,notnull,default:current_timestamp" json:"updated_at"`
	ExpiredAt time.Time `bun:",nullzero,notnull" json:"expired_at"`
}

func (*Token) AfterCreateTable

func (*Token) AfterCreateTable(ctx context.Context, query *bun.CreateTableQuery) error

func (*Token) BeforeAppendModel

func (g *Token) BeforeAppendModel(ctx context.Context, query bun.Query) error

type TokenType

type TokenType string
const (
	InstallAccessToken      TokenType = "install_access"
	ActionRegistrationToken TokenType = "action_registration"
)

Jump to

Keyboard shortcuts

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