feat: queue one-time builds from CLI
Some checks failed
ci/woodpecker/pr/docs Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/man Pipeline was successful
ci/woodpecker/pr/docker Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
Some checks failed
ci/woodpecker/pr/docs Pipeline was successful
ci/woodpecker/pr/lint Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/man Pipeline was successful
ci/woodpecker/pr/docker Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
This commit is contained in:
parent
6a208dbe6c
commit
2cc3e8404e
4 changed files with 69 additions and 18 deletions
|
|
@ -188,12 +188,38 @@ pub fn cmd() cli.Command {
|
|||
description: 'Build the target without checking whether it needs to be renewed.'
|
||||
flag: cli.FlagType.bool
|
||||
},
|
||||
cli.Flag{
|
||||
name: 'remote'
|
||||
description: 'Schedule the build on the server instead of running it locally.'
|
||||
flag: cli.FlagType.bool
|
||||
},
|
||||
cli.Flag{
|
||||
name: 'arch'
|
||||
description: 'Architecture to schedule build for. Required when using -remote.'
|
||||
flag: cli.FlagType.string
|
||||
},
|
||||
]
|
||||
execute: fn (cmd cli.Command) ! {
|
||||
config_file := cmd.flags.get_string('config-file')!
|
||||
conf := vconf.load<Config>(prefix: 'VIETER_', default_path: config_file)!
|
||||
|
||||
build(conf, cmd.args[0].int(), cmd.flags.get_bool('force')!)!
|
||||
remote := cmd.flags.get_bool('remote')!
|
||||
force := cmd.flags.get_bool('force')!
|
||||
target_id := cmd.args[0].int()
|
||||
|
||||
if remote {
|
||||
arch := cmd.flags.get_string('arch')!
|
||||
|
||||
if arch == '' {
|
||||
return error('When scheduling the build remotely, you have to specify an architecture.')
|
||||
}
|
||||
|
||||
c := client.new(conf.address, conf.api_key)
|
||||
res := c.queue_job(target_id, arch, force)!
|
||||
println(res.message)
|
||||
} else {
|
||||
build(conf, target_id, force)!
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
|
|
|
|||
Reference in a new issue