Skip to content

models #

Constants #

pub const valid_kinds = ['git', 'url']

fn params_from #

pub fn params_from[T](o &T) map[string]string

params_from[T] converts a given T struct into a map of strings.

fn from_params #

pub fn from_params[T](params map[string]string) ?T

from_params[T] creates a new instance of T from the given map by parsing all of its fields from the map.

fn patch_from_params #

pub fn patch_from_params[T](mut o T, params map[string]string) ?

patch_from_params[T] updates the given T object with the params defined in the map.

struct BuildLog #

pub struct BuildLog {
pub mut:
	id         int       [primary; sql: serial]
	target_id  int       [nonull]
	start_time time.Time [nonull]
	end_time   time.Time [nonull]
	arch       string    [nonull]
	exit_code  int       [nonull]
}

fn (BuildLog) str #

pub fn (bl &BuildLog) str() string

str returns a string representation.

fn (BuildLog) path #

pub fn (bl &BuildLog) path() string

path returns the path to the log file, relative to the logs directory

struct BuildConfig #

pub struct BuildConfig {
pub:
	target_id  int
	kind       string
	url        string
	branch     string
	path       string
	repo       string
	base_image string
	force      bool
	timeout    int
}

fn (BuildConfig) str #

pub fn (c BuildConfig) str() string

str return a single-line string representation of a build log

struct BuildLogFilter #

[params]
pub struct BuildLogFilter {
pub mut:
	limit      u64 = 25
	offset     u64
	target     int
	before     time.Time
	after      time.Time
	arch       string
	exit_codes []string
}

struct Target #

pub struct Target {
pub mut:
	id   int    [primary; sql: serial]
	kind string [nonull]
// If kind is git: URL of the Git repository
// If kind is url: URL to PKGBUILD file
	url string [nonull]
// Branch of the Git repository to use; only applicable when kind is git.
// If not provided, the repository is cloned with the default branch.
	branch string
// Which repo the builder should publish packages to
	repo string [nonull]
// Cron schedule describing how frequently to build the repo.
	schedule string
// Subdirectory in the Git repository to cd into
	path string
// On which architectures the package is allowed to be built. In reality,
// this controls which agents will build this package when scheduled.
	arch []TargetArch [fkey: 'target_id']
}

fn (Target) str #

pub fn (t &Target) str() string

str returns a string representation.

fn (Target) as_build_config #

pub fn (t &Target) as_build_config(base_image string, force bool, timeout int) BuildConfig

as_build_config converts a Target into a BuildConfig, given some extra needed information.

struct TargetArch #

pub struct TargetArch {
pub:
	id        int    [primary; sql: serial]
	target_id int    [nonull]
	value     string [nonull]
}

fn (TargetArch) str #

pub fn (gra &TargetArch) str() string

str returns a string representation.

struct TargetFilter #

[params]
pub struct TargetFilter {
pub mut:
	limit  u64 = 25
	offset u64
	repo   string
	query  string
	arch   string
}