Compare commits

..

1 Commits

Author SHA1 Message Date
Jef Roosens 0604de26c4
feat(agent): ensure images exist when starting build 2022-12-16 16:27:24 +01:00
2 changed files with 6 additions and 5 deletions

View File

@ -83,7 +83,7 @@ pub fn (mut d AgentDaemon) run() {
// Make sure a recent build base image is available for
// building the config
if !d.images.up_to_date(config.base_image) {
d.linfo("Building builder image from base image $config.base_image")
d.linfo('Building builder image from base image $config.base_image')
// TODO handle this better than to just skip the config
d.images.refresh_image(config.base_image) or {

View File

@ -33,11 +33,12 @@ pub fn (m &ImageManager) get(base_image string) string {
return m.images[base_image].last()
}
// outdated returns whether the last known builder image is exists and is up to
// date. If this function returns true, the last builder image may be used to
// perform a build.
// up_to_date returns whether the last known builder image is exists and is up
// to date. If this function returns true, the last builder image may be used
// to perform a build.
pub fn (mut m ImageManager) up_to_date(base_image string) bool {
if base_image !in m.timestamps || m.timestamps[base_image].add_seconds(m.max_image_age) <= time.now() {
if base_image !in m.timestamps
|| m.timestamps[base_image].add_seconds(m.max_image_age) <= time.now() {
return false
}