Skip to content

fix(configure-resources): handle Windows (Git Bash) host detection#8

Merged
mpasternak merged 1 commit into
mainfrom
fix/configure-resources-windows-ci
Jun 2, 2026
Merged

fix(configure-resources): handle Windows (Git Bash) host detection#8
mpasternak merged 1 commit into
mainfrom
fix/configure-resources-windows-ci

Conversation

@mpasternak

Copy link
Copy Markdown
Member

Problem

The CI job Testy Makefile (Windows) has failed on every push to main since the resource-limits redesign (#5), which added a test that runs scripts/configure-resources.sh on windows-latest. main has been red since 2026-06-01 (visible on the #5 and #7 merge runs alike — 65 passed, 1 failed).

Root cause: the script's host detection only matched Linux / Darwin from uname -s. On Git Bash uname -s is MINGW64_NT-..., which falls through to the *) branch → exit 1:

TEST: configure-resources — staly cap + uslugi zmienne
  FAIL: configure-resources zwrocil blad
  RESULTS: 65 passed, 1 failed, 2 skipped

Unrelated to the media-root change in #7 — that PR just inherited the pre-existing red.

Fix

Add a MINGW*|MSYS*|CYGWIN* branch to the uname -s case:

  • RAM from /proc/meminfo (emulated by the MSYS runtime on Git Bash), CPU from nproc.
  • Graceful fallbacks so it never exits non-zero: CPU → NUMBER_OF_PROCESSORS1; RAM unreadable → TOTAL_RAM_GB=0, and the existing 4 GB budget floor takes over.
  • Fixed caps (redis, netdata, …) are host-independent, so .env still gets correct values even in the worst case.

BPP deploys on Linux; Windows is a dev-only environment, so finishing and writing .env is all that's required there.

Verification

  • Worst case simulated locally (uname stubbed to MINGW64, no /proc/meminfo, NUMBER_OF_PROCESSORS=4): script exits 0 and produces every value the CI test asserts — REDIS_MEM_LIMIT=1024m, …=192m/128m/320m/64m, REDIS_MAXMEMORY=819mb, presence of APPSERVER/DBSERVER/WORKER_GENERAL_MEM_LIMIT + DBSERVER_CPU_LIMIT, and absence of FLOWER_CPU_LIMIT.
  • macOS native path unchanged (64 GB / 16 CPU detected, fixed caps correct).
  • bash -n clean; pre-commit incl. shellcheck green.

🤖 Generated with Claude Code

CI job "Testy Makefile (Windows)" failed on every push to main since the
resource-limits redesign (PR #5) added a test that runs
scripts/configure-resources.sh on windows-latest. The script's host
detection only matched `Linux`/`Darwin` from `uname -s`; on Git Bash
`uname -s` is `MINGW64_NT-...`, hitting the `*)` branch -> `exit 1`, so
the test reported "configure-resources zwrocil blad" (65 passed, 1 failed).

Add a `MINGW*|MSYS*|CYGWIN*` branch: read RAM from /proc/meminfo (emulated
by the MSYS runtime) and CPU from nproc, with graceful fallbacks
(NUMBER_OF_PROCESSORS, then 1) so it never exits non-zero. If RAM can't be
read, TOTAL_RAM_GB=0 and the existing budget floor (4 GB) takes over -
fixed caps are host-independent so the .env still gets correct values.
BPP deploys on Linux; Windows is a dev-only environment, so finishing and
writing .env is all that's needed there.

Verified: worst case (uname stubbed to MINGW64, no /proc/meminfo) exits 0
and produces all values the CI test asserts; macOS native path unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mpasternak mpasternak merged commit a4db7c5 into main Jun 2, 2026
5 checks passed
@mpasternak mpasternak deleted the fix/configure-resources-windows-ci branch June 2, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant