move build failure logic to new place

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

View file

@ -45,12 +45,6 @@ store_build_metadata <- function(
dbWriteTable(con, "single_builds", metadata, append = TRUE)
}
# here we check if build_duration is empty and take this as an indicator that the build failed. I.e. we set error_occurred = TRUE
val <- dbGetQuery(con, sprintf("SELECT build_duration FROM single_builds WHERE package_name = '%s' and tag = '%s'", package_name, tag))
if (is.na(val)) {
dbExecute(con, sprintf("UPDATE single_builds SET error_occurred = TRUE WHERE package_name = '%s' and tag = '%s'", package_name, tag))
}
# Close the SQLite connection
dbDisconnect(con)

View file

@ -90,6 +90,17 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
p()
store_build_metadata(x, y, platform, error_occurred = FALSE, force = force)
dump <- build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform, debug = debug)
con <- DBI::dbConnect(RPostgres::Postgres(),
dbname = "build_metadata", host = "postgres-arm-binaries-r.devxy.io",
port = 15432, user = "arm_binaries", password = Sys.getenv("PGPASS")
)
# here we check if build_duration is empty and take this as an indicator that the build failed. I.e. we set error_occurred = TRUE
val <- dbGetQuery(con, sprintf("SELECT build_duration FROM single_builds WHERE package_name = '%s' and tag = '%s'", x, y))
if (is.na(val)) {
dbExecute(con, sprintf("UPDATE single_builds SET error_occurred = TRUE WHERE package_name = '%s' and tag = '%s'", x, y))
}
dbDisconnect(con)
},
error = function(e) {
message(sprintf("Error in processing package %s with tag %s: %s", x, y, e))