From bc2f6f1517ab99b70cb4a9154e2eaded7997dae6 Mon Sep 17 00:00:00 2001 From: pat-s Date: Thu, 18 Jun 2026 13:31:48 +0200 Subject: [PATCH] fix(ci): derive build-all platform/arch in-container, not from CI env Crow cannot interpolate the workflow-level OS/OS_VERSION form variables inside an environment: block (only matrix variables work there), so exporting them broke pipeline parsing with "unable to parse variable name". Instead, derive platform + arch inside build-all.R from the running container, mirroring bincraft's own codename -> platform mapping and machine -> arch detection. This keeps the already-built dedup pre-filter effective without depending on CI-injected env vars, and degrades to a length-1 NA (querying nothing) for an unmapped codename rather than crashing. --- .crow/build-all-versions.yaml | 7 ------- local/build-all.R | 27 +++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.crow/build-all-versions.yaml b/.crow/build-all-versions.yaml index 77f5b77..41987ad 100644 --- a/.crow/build-all-versions.yaml +++ b/.crow/build-all-versions.yaml @@ -90,13 +90,6 @@ steps: from_secret: GITHUB_PAT # normal env vars GIT_USER: pat-s - # Export the platform selectors as runtime env vars. They are otherwise - # only available for ${...} interpolation (image/volume), so build-all.R's - # `Sys.getenv("OS")/("OS_VERSION")/("ARCH")` would be empty and its - # already-built dedup query would match platform "-" and skip nothing. - OS: ${OS} - OS_VERSION: ${OS_VERSION} - ARCH: ${ARCH} # set the location of the 'pkgcache' cache dir which persists the R package dependencies needed to install the packages themselves R_PKG_CACHE_DIR: ${R_PKG_CACHE_DIR} R_LIBS_USER: /mnt/cache/R-pkgs diff --git a/local/build-all.R b/local/build-all.R index f8e8efd..6c3725c 100644 --- a/local/build-all.R +++ b/local/build-all.R @@ -68,8 +68,31 @@ chunk <- chunk[!chunk$Package %in% exclude, ] # pkgs_to_build.rds is a static snapshot from the install-deps step, so on a # restart it still lists everything an interrupted run already produced. The # metadata DB reflects that progress, so we re-derive the remaining set here. -platform <- paste(Sys.getenv("OS"), gsub("[.]", "", Sys.getenv("OS_VERSION")), sep = "-") -arch <- Sys.getenv("ARCH") +# Derive platform + arch from the running container, mirroring the codename -> +# platform mapping bincraft uses internally. The OS/OS_VERSION selectors are +# workflow-level CI variables that are not injected into the container +# environment, so Sys.getenv() would return "" and this pre-filter would query +# platform "-" and skip nothing. +codename <- bincraft::set_codename(NULL) +platform <- switch( + codename, + jammy = "ubuntu-2204", + noble = "ubuntu-2404", + resolute = "ubuntu-2604", + rhel10 = "redhat-10", + rhel9 = "redhat-9", + rhel8 = "redhat-8", + alpine320 = "alpine-320", + alpine321 = "alpine-321", + alpine322 = "alpine-322", + alpine323 = "alpine-323", + alpine324 = "alpine-324", + alpine325 = "alpine-325", + alpine326 = "alpine-326", + NA_character_ +) +local_machine <- Sys.info()[["machine"]] +arch <- if (grepl("arm64|aarch64", local_machine)) "arm64" else "amd64" con <- DBI::dbConnect( RPostgres::Postgres(), dbname = "build_metadata",