build-cran-binaries/.crow/process-updates-redhat-10-arm64.yaml
pat-s 63b4a51b31
refactor(ci): skip bincraft reinstall when image already has it
bincraft is baked into the build-env images, but every workflow run
unconditionally called pak::pak("git::.../bincraft.git") to defend
against bakes where the install silently failed.
That cost ~30-60s per job (pak resolves Remotes, may recompile),
which adds up across all process-updates, update-package-index,
weekly-rebuild and archive-missed-packages workflows.

Guard the call with requireNamespace(): healthy images skip the
install entirely; broken images still self-heal.
2026-05-28 13:39:51 +02:00

60 lines
3.8 KiB
YAML

when:
- event: [cron]
cron: process-cran-updates-redhat-10-arm64
- event: manual
evaluate: 'process_cran_updates == "all"'
- event: manual
evaluate: 'process_cran_updates == "redhat-10-arm64"'
skip_clone: true
labels:
agent: gaia
steps:
- name: 'Processing Updates'
image: reg.devxy.io/rpkgs/build-env-redhat:10
pull: true
environment:
RED_HAT_DEV_PW:
from_secret: RED_HAT_DEV_PW
B2_S3_ACCESS_KEY:
from_secret: B2_S3_ACCESS_KEY
B2_S3_SECRET_KEY:
from_secret: B2_S3_SECRET_KEY
PGPASS:
from_secret: PGPASS
REPO_RO_TOKEN:
from_secret: REPO_RO_TOKEN
GITHUB_PAT:
from_secret: GITHUB_PAT
# normal env vars
GIT_USER: pat-s
NTFY_SERVER:
from_secret: NTFY_SERVER
NTFY_TOPIC:
from_secret: NTFY_TOPIC
NTFY_AUTH: TRUE
NTFY_PASSWORD:
from_secret: ntfy_token
# set the location of the 'pkgcache' cache dir which persists the R package dependencies needed to install the packages themselves
R_PKG_CACHE_DIR: /mnt/cache/pkgcache
R_LIBS_USER: /mnt/cache/R-pkgs
R_VERSION: 4.5.3
CCACHE_DIR: /mnt/cache/ccache
PLATFORM: redhat-10
ARCH: arm64
NCPUS: 2
INTERVAL: lubridate::interval(lubridate::today() - 6, lubridate::today() - 3)
# volumes:
# - arm64-binaries-r-dep-cache-redhat-10:/mnt/cache
commands:
- git clone -q https://pat-s:$$REPO_RO_TOKEN@git.devxy.io/devxy/build-cran-binaries.git .
- rm -rf /mnt/cache/R-pkgs/00LOCK-r-pkg-binaries /mnt/cache/R-pkgs/00LOCK-bincraft /mnt/cache/R-pkgs/00LOCK-pak /mnt/cache/pkgcache/R/pkgcache /mnt/cache/pkgcache/R/pkgcache /mnt/cache/R-pkgs/pkgcache /mnt/cache/R-pkgs/00LOCK-pak/mnt/cache/R-pkgs/00LOCK-RPostgres /mnt/cache/R-pkgs/bincraft
- /opt/R/$R_VERSION/bin/R -q -e 'if (!requireNamespace("bincraft", quietly = TRUE)) pak::pak("git::https://codefloe.com/rpkgs/bincraft.git")'
- /opt/R/$R_VERSION/bin/R -q -e 'packageVersion("bincraft")'
- mkdir -p /mnt/cache/pkgcache /mnt/cache/R-pkgs /mnt/cache/ccache /mnt/cache/packages
# options(future.globals.onReference = NULL): for some reason s3fs::file_delete() throws 'Error: Detected a non-exportable reference ('externalptr') in one of the globals ('FUN' of class 'function') used in the future expression' otherwise
- XVFB=$(command -v xwfb-run 2>/dev/null || command -v xvfb-run); XVFB_ARGS=""; if command -v xwfb-run >/dev/null 2>&1; then dnf install -y -q weston 2>/dev/null; XVFB_ARGS="-c weston"; fi
- $XVFB $XVFB_ARGS -- /opt/R/$R_VERSION/bin/R -q -e "options(crayon.enabled = TRUE, Ncpus = 4, future.globals.onReference = 'error', repos = structure(c(getOption('repos'),INLA='https://inla.r-inla-download.org/R/stable'))); progressr::handlers('cli'); progressr::handlers(global = TRUE); options(future.globals.onReference = NULL); bincraft::process_cran_updates(interval = $INTERVAL, platform = 'redhat-10', process_updated = TRUE, process_new = TRUE, process_removed = TRUE, s3_endpoint = 'https://s3.eu-central-003.backblazeb2.com', s3_region = 'eu-central-003', s3_bucket = 'devxy-rpkgs-binaries', s3_access_key_id = Sys.getenv('B2_S3_ACCESS_KEY'), s3_secret_access_key = Sys.getenv('B2_S3_SECRET_KEY'), metadata_db_host = 'r-binaries.devxy.io', metadata_db_name = 'build_metadata', metadata_db_table = 'single_builds', metadata_db_user = 'rpkgs', metadata_db_password = Sys.getenv('PGPASS'), metadata_db_sslmode = 'require', metadata_db_port = 15432, archive = TRUE, upload = TRUE, store_build_metadata = TRUE)"
- /opt/R/$R_VERSION/bin/R -q -e 'library(bincraft); upload_package_index(codename = "rhel10", s3_endpoint = "https://s3.eu-central-003.backblazeb2.com", s3_region = "eu-central-003", s3_bucket = "devxy-rpkgs-binaries", s3_access_key_id = Sys.getenv("B2_S3_ACCESS_KEY"), s3_secret_access_key = Sys.getenv("B2_S3_SECRET_KEY"))'