force update metadata in case of build failure

This commit is contained in:
Patrick Schratz 2024-07-24 23:33:25 +02:00
commit d1e4c48104
Signed by: pat-s
GPG key ID: 3C6318841EF78925
2 changed files with 2 additions and 2 deletions

View file

@ -107,7 +107,7 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
# NB: this does not always work, which is why we are using the lack of build_duration as a secondary factor in store_metadata()
store_build_metadata(x, y, platform, error_occurred = TRUE, force = force)
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE)
}
)
}, package_name, tag, future.seed = TRUE)

View file

@ -18,7 +18,7 @@ store_build_metadata <- function(
} else if (nrow(existing_entries) >= 1 && force) {
cli::cli_alert_info("{.fun store_build_metadata}: Force overwriting build metadata for {.pkg {package_name}} {.field {tag}} because {.code force = TRUE} was set.")
dbExecute(con, sprintf("UPDATE single_builds SET build_timestamp = '%s' WHERE package_name = '%s' and tag = '%s'", format(Sys.time(), "%Y-%m-%d %H:%M:%S"), package_name, tag))
dbExecute(con, sprintf("UPDATE single_builds SET build_timestamp = '%s', error_occurred = %s WHERE package_name = '%s' and tag = '%s'", format(Sys.time(), "%Y-%m-%d %H:%M:%S"), error_occurred, package_name, tag))
} else if (nrow(existing_entries) == 0) {
cli::cli_alert("{.fun store_build_metadata}: Storing build metadata for {.pkg {package_name}} {.field {tag}}.")
# Create a data frame with the metadata