2022-05-19 07:54:33 +02:00
|
|
|
module models
|
|
|
|
|
2022-06-17 13:56:38 +02:00
|
|
|
pub const valid_kinds = ['git', 'url']
|
|
|
|
|
2022-06-14 22:25:40 +02:00
|
|
|
pub struct TargetArch {
|
2022-05-19 07:54:33 +02:00
|
|
|
pub:
|
2022-06-14 22:25:40 +02:00
|
|
|
id int [primary; sql: serial]
|
|
|
|
target_id int [nonull]
|
|
|
|
value string [nonull]
|
2022-05-19 07:54:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// str returns a string representation.
|
2022-06-14 22:25:40 +02:00
|
|
|
pub fn (gra &TargetArch) str() string {
|
2022-05-19 07:54:33 +02:00
|
|
|
return gra.value
|
|
|
|
}
|
|
|
|
|
2022-06-14 22:25:40 +02:00
|
|
|
pub struct Target {
|
2022-05-19 07:54:33 +02:00
|
|
|
pub mut:
|
2022-06-17 13:56:38 +02:00
|
|
|
id int [primary; sql: serial]
|
2022-06-17 13:45:21 +02:00
|
|
|
kind string [nonull]
|
|
|
|
// If kind is git: URL of the Git repository
|
|
|
|
// If kind is url: URL to PKGBUILD file
|
2022-05-19 07:54:33 +02:00
|
|
|
url string [nonull]
|
2022-06-17 13:45:21 +02:00
|
|
|
// 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
|
2022-05-19 07:54:33 +02:00
|
|
|
// Which repo the builder should publish packages to
|
|
|
|
repo string [nonull]
|
|
|
|
// Cron schedule describing how frequently to build the repo.
|
|
|
|
schedule string
|
2022-12-16 11:21:28 +01:00
|
|
|
// Subdirectory in the Git repository to cd into
|
|
|
|
path string
|
2022-05-19 07:54:33 +02:00
|
|
|
// On which architectures the package is allowed to be built. In reality,
|
2022-12-16 11:21:28 +01:00
|
|
|
// this controls which agents will build this package when scheduled.
|
2022-06-14 22:25:40 +02:00
|
|
|
arch []TargetArch [fkey: 'target_id']
|
2022-05-19 07:54:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// str returns a string representation.
|
2022-12-16 11:21:28 +01:00
|
|
|
pub fn (t &Target) str() string {
|
2022-05-19 07:54:33 +02:00
|
|
|
mut parts := [
|
2022-12-16 11:21:28 +01:00
|
|
|
'id: $t.id',
|
|
|
|
'kind: $t.kind',
|
|
|
|
'url: $t.url',
|
|
|
|
'branch: $t.branch',
|
|
|
|
'path: $t.path',
|
|
|
|
'repo: $t.repo',
|
|
|
|
'schedule: $t.schedule',
|
|
|
|
'arch: ${t.arch.map(it.value).join(', ')}',
|
2022-05-19 07:54:33 +02:00
|
|
|
]
|
|
|
|
str := parts.join('\n')
|
|
|
|
|
|
|
|
return str
|
|
|
|
}
|
|
|
|
|
|
|
|
[params]
|
2022-06-14 22:25:40 +02:00
|
|
|
pub struct TargetFilter {
|
2022-05-19 07:54:33 +02:00
|
|
|
pub mut:
|
|
|
|
limit u64 = 25
|
|
|
|
offset u64
|
|
|
|
repo string
|
|
|
|
}
|