fix(ci): read the ANTLR archive with whichever tool the host provides - #30695
fix(ci): read the ANTLR archive with whichever tool the host provides#30695sonika-shah wants to merge 2 commits into
Conversation
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
✅ Playwright Results — workflow succeededValidated commit ✅ 538 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 48m 30s ⏱️ Max setup 2m 44s · max shard execution 14m 38s · max shard-job elapsed before upload 17m 38s · reporting 4s 🌐 202.93 requests/attempt · 2.85 app boots/UI scenario · 19.02% common-shard skew Optimization targets still in progress:
🟡 1 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
install_antlr_cli validated the downloaded ANTLR jar with `jar tf` on top of the pinned SHA-256. `jar` is a JDK tool, so on images that carry only a JRE the check fails with `jar: not found`, the surrounding && chain reports the download as bad, and the recipe retries three times before exiting 1 -- even though the download and checksum both succeeded. Read the archive with `jar` when present, else `unzip -t`, else fall through to the checksum alone. A reader that is present and rejects the archive still fails the build; only the case where no reader exists is skipped, and such a host has no java either, so it could not run the installed CLI regardless. This keeps the check active everywhere it runs today. The Collate local ingestion webserver base image is the motivating case: it ships default-jre-headless (java, no jar) but installs unzip for the Oracle instant client, so it now verifies via unzip instead of failing.
a1e7abc to
26f9075
Compare
Code Review ✅ ApprovedMakes the ANTLR CLI installation recipe skip the OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
Problem
make install_antlr_clifails on any image that carries a JRE but not a JDK. The download and checksum both succeed; the build then dies on the archive check that follows them:jaris a JDK tool. When it is missing,jar tffails, the enclosing&&chain reports the download as bad, and the recipe retries three times before giving up — on a payload that verified clean the first time.The motivating casualty is the Collate local ingestion webserver image. Its base installs
default-jre-headless(ingestion/Dockerfile:31), which providesjavabut nojar, and its Dockerfile runs this recipe during the build.Branches carrying
jar tf(main,2.0,2.0.0-rc1) are affected; the1.13.x/1.12.xline predates it and is unaffected.Change
Read the archive with whichever tool the host provides, rather than insisting on
jar:&& { if command -v jar > /dev/null 2>&1; then jar tf "$jar_file" > /dev/null; \ elif command -v unzip > /dev/null 2>&1; then unzip -tqq "$jar_file" > /dev/null; \ else :; fi; }jar tf— unchanged from todayunzip(slim runtime images)unzip -t— check stays activeA reader that is present and rejects the archive still fails the build, and there is no second attempt with the other tool — a rejection is a rejection.
The skip branch is not a coverage gap being accepted. A host with neither reader has no
javaeither (verified:debian:bookworm-slimhas none ofjar,unzip,java), and the recipe's output is a#!/usr/bin/java -jarwrapper — so such a host cannot run the CLI regardless of what this check does.Nothing else in the recipe needs a JDK: it uses
printf/cat/chmod/mv.Verification
Run in the real affected image (
collate-customers-ingestion:om-2.0.0-rc1-cl-2.0.0-rc1), which reportsjar: ABSENT,unzip: /usr/bin/unzip,java: openjdk 17.0.20, and distroantlr4candidate4.7.2-5— so it exercises the pinned-download path.Baseline (
main) — reproduces the CI failure exactly, including exit code:With this change:
jar,unzippresent)EXIT=0;antlr4→ANTLR Parser Generator Version 4.9.2UNZIP-BRANCH-RAN (args: -tqq /tmp/tmp.Wyjo8GsG0w)— delegating wrapper confirms the realunzipran and passedunzippresent but rejectsEXIT=2— build fails, as it mustjarpresent and passesEXIT=0;JAR-BRANCH-RAN—jartakes precedence overunzipjarpresent and rejectsEXIT=2— no fallback tounzip, even thoughunzipwas present and would have passedEXIT=0— checksum aloneRe-running is idempotent (
ANTLR 4.9.2 already available at /usr/local/bin/antlr4; nothing to do.), and the installed CLI generates the real grammars:FqnLexer.js/FqnParser.jsare what the webserver UI imports.Cherry-pick
Needs
2.0and2.0.0-rc1— both carry the line and both feed local webserver builds.Greptile Summary
Updates the ANTLR CLI installation recipe to validate downloaded archives with
jarwhen available, fall back tounzip, and rely on the pinned checksum when neither archive reader exists.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (3): Last reviewed commit: "Merge branch 'main' into fix/antlr-cli-o..." | Re-trigger Greptile