fix: audit workflows
Some checks failed
ci/crow/manual/weekly-audit-missing-alpine-322-arm64 Pipeline failed
Some checks failed
ci/crow/manual/weekly-audit-missing-alpine-322-arm64 Pipeline failed
This commit is contained in:
parent
dfad39ebf1
commit
7c9a82187d
2 changed files with 32 additions and 9 deletions
|
|
@ -20,6 +20,8 @@ steps:
|
||||||
from_secret: REPO_RO_TOKEN
|
from_secret: REPO_RO_TOKEN
|
||||||
GITHUB_PAT:
|
GITHUB_PAT:
|
||||||
from_secret: GITHUB_PAT
|
from_secret: GITHUB_PAT
|
||||||
|
FORGEJO_TOKEN:
|
||||||
|
from_secret: FORGEJO_TOKEN
|
||||||
PLATFORM: alpine-322
|
PLATFORM: alpine-322
|
||||||
ARCH: arm64
|
ARCH: arm64
|
||||||
R_LIBS_USER: /mnt/cache/R-pkgs
|
R_LIBS_USER: /mnt/cache/R-pkgs
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,8 @@ if (file.exists(excluded_path)) {
|
||||||
# 5. Query PostgreSQL for known build failures
|
# 5. Query PostgreSQL for known build failures
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
cat("Connecting to PostgreSQL...\n")
|
cat("Connecting to PostgreSQL...\n")
|
||||||
con <- DBI::dbConnect(
|
pg_connect <- function() {
|
||||||
|
DBI::dbConnect(
|
||||||
RPostgres::Postgres(),
|
RPostgres::Postgres(),
|
||||||
dbname = "build_metadata",
|
dbname = "build_metadata",
|
||||||
host = "r-binaries.devxy.io",
|
host = "r-binaries.devxy.io",
|
||||||
|
|
@ -127,6 +128,26 @@ con <- DBI::dbConnect(
|
||||||
password = Sys.getenv("PGPASS"),
|
password = Sys.getenv("PGPASS"),
|
||||||
sslmode = "require"
|
sslmode = "require"
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
con <- NULL
|
||||||
|
for (attempt in seq_len(3)) {
|
||||||
|
con <- tryCatch(pg_connect(), error = function(e) NULL)
|
||||||
|
if (!is.null(con) && DBI::dbIsValid(con)) {
|
||||||
|
tryCatch({
|
||||||
|
DBI::dbGetQuery(con, "SELECT 1")
|
||||||
|
break
|
||||||
|
}, error = function(e) {
|
||||||
|
try(DBI::dbDisconnect(con), silent = TRUE)
|
||||||
|
con <<- NULL
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (attempt < 3) {
|
||||||
|
cat(sprintf("PostgreSQL connection attempt %d failed, retrying...\n", attempt))
|
||||||
|
Sys.sleep(2 * attempt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is.null(con) || !DBI::dbIsValid(con)) stop("Failed to connect to PostgreSQL after 3 attempts")
|
||||||
on.exit(DBI::dbDisconnect(con), add = TRUE)
|
on.exit(DBI::dbDisconnect(con), add = TRUE)
|
||||||
|
|
||||||
errored_pkgs <- DBI::dbGetQuery(
|
errored_pkgs <- DBI::dbGetQuery(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue