feat: add option to force-build package

This commit is contained in:
Jef Roosens 2022-12-13 19:59:18 +01:00
parent 8a2f720bdf
commit f6c5e7c246
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 29 additions and 12 deletions

View file

@ -6,7 +6,7 @@ import os
import build
// build locally builds the target with the given id.
fn build(conf Config, target_id int) ! {
fn build(conf Config, target_id int, force bool) ! {
c := client.new(conf.address, conf.api_key)
target := c.get_target(target_id)!
@ -16,7 +16,7 @@ fn build(conf Config, target_id int) ! {
image_id := build.create_build_image(conf.base_image)!
println('Running build...')
res := build.build_target(conf.address, conf.api_key, image_id, target)!
res := build.build_target(conf.address, conf.api_key, image_id, target, force)!
println('Removing build image...')

View file

@ -182,11 +182,18 @@ pub fn cmd() cli.Command {
required_args: 1
usage: 'id'
description: 'Build the target with the given id & publish it.'
flags: [
cli.Flag{
name: 'force'
description: 'Build the target without checking whether it needs to be renewed.'
flag: cli.FlagType.bool
},
]
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())!
build(conf, cmd.args[0].int(), cmd.flags.get_bool('force')!)!
}
},
]