catch more errors in building to harden tryCatch calls
This commit is contained in:
parent
32719ff957
commit
e83b43ad1e
2 changed files with 15 additions and 11 deletions
|
|
@ -29,6 +29,8 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
# create directory structure
|
# create directory structure
|
||||||
dir_out_bin <- set_bin_path(r_minor_version, build_for_minor, local_build_root, codename)
|
dir_out_bin <- set_bin_path(r_minor_version, build_for_minor, local_build_root, codename)
|
||||||
|
|
||||||
|
local_bin_path <- set_bin_path(r_minor_version, build_for_minor, local_build_root = local_build_root, codename)
|
||||||
|
|
||||||
if (debug) {
|
if (debug) {
|
||||||
cli::cli_alert_warning("DEBUG: dir_out_bin {dir_out_bin}.")
|
cli::cli_alert_warning("DEBUG: dir_out_bin {dir_out_bin}.")
|
||||||
}
|
}
|
||||||
|
|
@ -92,17 +94,19 @@ build_binary_package <- function(package_name, tag = NULL, codename = NULL,
|
||||||
{
|
{
|
||||||
p()
|
p()
|
||||||
dump <- build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform, debug = debug)
|
dump <- build_single_tag(x, y, dir_out_bin, local_clone_dir, platform = platform, debug = debug)
|
||||||
store_build_metadata(x, y, platform, error_occurred = FALSE, force = force)
|
|
||||||
cli::cli_alert_success("Successfully built package {.pkg {x}} with tag {.field {y}}.")
|
|
||||||
|
|
||||||
con <- DBI::dbConnect(RPostgres::Postgres(),
|
# if for some reason an underlying error didnt' get caught in the tryCatch calls, we check again here for the existence of the binary file on disk and mark the build as failed if it is not found
|
||||||
dbname = "build_metadata", host = "postgres-arm-binaries-r.devxy.io",
|
tarball_name <- sprintf("%s_%s.tar.gz", x, y)
|
||||||
port = 15432, user = "arm_binaries", password = Sys.getenv("PGPASS")
|
if (file.exists(sprintf("%s/%s", local_bin_path, tarball_name))) {
|
||||||
)
|
store_build_metadata(x, y, platform, error_occurred = FALSE, force = force)
|
||||||
dbDisconnect(con)
|
cli::cli_alert_success("Successfully built package {.pkg {x}} with tag {.field {y}}.")
|
||||||
|
} else {
|
||||||
|
cli::cli_alert_warning("Error in building package {.pkg {x}} with tag {.field {y}}: Uncommon/unspecific error during build.")
|
||||||
|
store_build_metadata(x, y, platform, error_occurred = TRUE, force = TRUE, error = "Uncommon/unspecific error during build")
|
||||||
|
}
|
||||||
},
|
},
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
cli::cli_alert_warning("Error in starting build command for package {.pkg {package_name}} with tag {.field {tag}}: {e}")
|
cli::cli_alert_warning("Error in building package {.pkg {package_name}} with tag {.field {tag}}: {e}")
|
||||||
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
|
local_clone_dir_single <- sprintf("%s/%s_%s", local_clone_dir, x, y)
|
||||||
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
unlink(local_clone_dir_single, force = TRUE, recursive = TRUE)
|
||||||
# only stderr contains the important information why the build failed
|
# only stderr contains the important information why the build failed
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ upload_single_binary_to_s3 <- function(
|
||||||
sprintf("%s/%s", local_bin_path, tarball_name),
|
sprintf("%s/%s", local_bin_path, tarball_name),
|
||||||
sprintf("%s/%s", remote_bin_path, tarball_name)
|
sprintf("%s/%s", remote_bin_path, tarball_name)
|
||||||
)
|
)
|
||||||
cli::cli_alert_success("Successfully uploaded package {.pkg {x}} with tag {.field {y}}.")
|
cli::cli_alert_success("Successfully uploaded package {.pkg {package_name}} with tag {.field {tag}}.")
|
||||||
cli::cli_alert("{.fun upload_single_binary_to_s3}: Deleting binary for {.pkg {package_name}} {.field {tag}} at path {.path {sprintf('%s/%s', local_bin_path, tarball_name)}}.")
|
cli::cli_alert("{.fun upload_single_binary_to_s3}: Deleting binary for {.pkg {package_name}} {.field {tag}} at path {.path {sprintf('%s/%s', local_bin_path, tarball_name)}}.")
|
||||||
file.remove(sprintf("%s/%s", local_bin_path, tarball_name))
|
file.remove(sprintf("%s/%s", local_bin_path, tarball_name))
|
||||||
} else if (exists && force) {
|
} else if (exists && force) {
|
||||||
|
|
@ -56,7 +56,7 @@ upload_single_binary_to_s3 <- function(
|
||||||
sprintf("%s/%s", remote_bin_path, tarball_name),
|
sprintf("%s/%s", remote_bin_path, tarball_name),
|
||||||
overwrite = TRUE
|
overwrite = TRUE
|
||||||
)
|
)
|
||||||
cli::cli_alert_success("Successfully uploaded package {.pkg {x}} with tag {.field {y}}.")
|
cli::cli_alert_success("Successfully uploaded package {.pkg {package_name}} with tag {.field {tag}}.")
|
||||||
cli::cli_alert("{.fun upload_single_binary_to_s3}: Deleting binary for {.pkg {package_name}} {.field {tag}} at path {.path {sprintf('%s/%s', local_bin_path, tarball_name)}}.")
|
cli::cli_alert("{.fun upload_single_binary_to_s3}: Deleting binary for {.pkg {package_name}} {.field {tag}} at path {.path {sprintf('%s/%s', local_bin_path, tarball_name)}}.")
|
||||||
file.remove(sprintf("%s/%s", local_bin_path, tarball_name))
|
file.remove(sprintf("%s/%s", local_bin_path, tarball_name))
|
||||||
} else if (exists && !force) {
|
} else if (exists && !force) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue