Repository navigation
fix(ci): install the ANTLR CLI from the distro archive when available - #30267
Conversation
#30120 moved the ANTLR CLI download from www.antlr.org to Maven Central and added SHA256 verification, which fixed the GitHub Pages rate limit. Maven Central then rate-limited us from the same shared CI egress IP: nightly run 29776192824 (7h after #30120 merged) failed with 12x HTTP 429 from repo1.maven.org - 3 outer attempts x 4 curl tries. Both hosts throttle the cluster's shared NAT address. The fix is to stop fetching from a public host in CI at all: ANTLR_MAVEN_BASE now points at whatever Maven mirror the environment provides, so CI can use the in-cluster Pulp proxy that the Maven build already relies on for exactly this reason. The base is a variable rather than a hardcoded mirror URL because the Pulp service DNS name only resolves in-cluster - GitHub-hosted runners and local dev must keep using Central. A fallback base (identical by default, so deduped to a single URL) covers the case where the mirror is unreachable or has not cached the artifact. The pinned SHA256 is unchanged and still verified, so the mirror cannot serve different bytes than Central. Version stays 4.9.2 to match the pinned antlr4-python3-runtime; aligning it with the Java side's 4.13.2 is a separate change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Downloading the ANTLR CLI from a public artifact host at build time keeps breaking CI. antlr.org rate-limited us, #30120 moved the download to Maven Central, and Central then rate-limited us from the same shared CI egress IP - nightly run 29776192824 failed with 12x HTTP 429 seven hours after that fix merged, and it is still failing today. Ubuntu noble and later ship exactly ANTLR 4.9.2, which matches every pinned runtime in the repo: ingestion/setup.py antlr4-python3-runtime==4.9.2 openmetadata-ui .../package.json "antlr4": "4.9.2" So `apt-get install antlr4` produces a CLI that generates parsers those runtimes accept, with no version bump and no network fetch from a host that throttles us. install_antlr_cli now skips the download when a matching ANTLR is already on PATH, letting CI and container images install it from the distro. The version check is exact, so a distro that ships a different ANTLR (jammy has 4.7.2) still falls through to the pinned download rather than silently generating parsers against a mismatched runtime. The download path is unchanged apart from ANTLR_MAVEN_BASE, which lets environments without a system package (macOS, non-Debian images) point at an internal Maven mirror instead of Central. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Downloading the ANTLR CLI from a public artifact host at build time keeps breaking CI. antlr.org rate-limited us, #30120 moved the download to Maven Central, and Central then rate-limited us from the same shared CI egress IP - nightly run 29776192824 failed with 12x HTTP 429 seven hours after that fix merged, and runs are still failing. Every consumer already calls this target: 20 call sites in this repo (16 workflows plus the three shared composite actions), 7 in the nightly repo, and several collate Dockerfiles. Fixing it here fixes all of them without editing ~30 call sites across three repositories. install_antlr_cli now resolves in three steps, cheapest first: 1. Already on PATH at the pinned version -> nothing to do. 2. Distro package, when apt offers exactly 4.9.2. Ubuntu noble and later ship 4.9.2, matching the pinned antlr4-python3-runtime and the JS antlr4 runtimes, so no public host is involved at all. 3. Pinned, checksum-verified download, unchanged. The version match in step 2 is exact and checked before installing, so a distro carrying a different ANTLR (jammy has 4.7.2) falls through to the download rather than silently generating parsers the pinned runtimes reject. apt failures - no root, unreachable archive - also fall through. Step 3 keeps ANTLR_MAVEN_BASE so environments with no distro package can point at an internal Maven mirror instead of Central. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The previous `$(ANTLR_VERSION)*` glob matched any candidate starting with 4.9.2, so a hypothetical 4.9.20-1 would have been accepted as 4.9.2 and installed, generating parsers the pinned runtimes reject. Match the bare version or a version followed by a Debian revision delimiter instead. Accepts 4.9.2, 4.9.2-2, 4.9.2-3build1 (what noble ships), 4.9.2~rc1 and 4.9.2+dfsg-1; rejects 4.9.20-1 and 4.9.2preview. Reported by gitar-bot. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Good catch — fixed in b7954e2. The glob is now anchored on a version delimiter: case "$candidate" in \
$(ANTLR_VERSION)|$(ANTLR_VERSION)[-+~]*) \Verified against the version formats apt actually produces:
Also worth noting for reviewers: the apt path is verified end-to-end on |
❌ 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 |
apt installs to /usr/bin/antlr4, but /usr/local/bin comes earlier on PATH and is exactly where the previous install method wrote. On a machine carrying a stale binary there, apt-get install would succeed and the target would exit 0 while `antlr4` still resolved to the old version - generating parsers the pinned runtimes reject. Re-check the resolved binary after installing. If it is not the pinned version, report which path shadowed it and fall through to the download, which writes to ANTLR_INSTALL_DIR and takes precedence. Reported by @ayush in review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thanks @ayush — both code points were valid. Addressed: 1. Collate scope — you're right, the description overstated it. Corrected above. The accurate split:
The Docker ones reach this fix because collate CI runs 2. Verify the resolved binary after You were right that it was unprotected. apt installs to It now re-checks the resolved binary and falls through to the pinned download (which writes to Verified by putting a stale 4.7.2 ahead of apt's 4.9.2 on PATH — it detects the shadowing, names the offending path, and downloads. Happy paths re-checked for regressions. 3. Metadata check — noted, it wants a linked issue ( 4. Confirming a fresh AUT run reaches sample-data ingestion — agreed, that's the real signal. #260 is merged so the next nightly is the first end-to-end proof; nothing so far is more than local plus one |
🟡 Playwright Results — all passed (19 flaky)✅ 4533 passed · ❌ 0 failed · 🟡 19 flaky · ⏭️ 95 skipped
🟡 19 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 |
Two findings from review on the collate counterpart, both applying here: shasum is absent on ubuntu:24.04 - verified in a container - so the download fallback fails its checksum step on exactly the runners we target, reporting "download failed after 3 attempts" rather than naming the missing tool. This means the download path introduced in #30120 has never actually succeeded on Ubuntu CI; the 429 always hit first and masked it. Switching to sha256sum is not portable either: macOS ships /sbin/sha256sum from BSD, which has no --check (usage: sha256sum [-bctwz]). Selecting by name alone picks a tool that cannot do the job. Verified on both: macOS shasum -a 256 --check works sha256sum --check fails (BSD) ubuntu shasum missing sha256sum --check works Prefer shasum, fall back to sha256sum, fail clearly if neither exists. Separately the banner check was unanchored: `grep -q "Version 4.9.2"` accepts a build reporting 4.9.20, and the unescaped dots matched any character. Escape the dots and anchor on a non-digit or end of line so the exact-match guarantee the comment promises actually holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Both findings were valid — thanks. Fixed, though the first one needed a different fix than suggested. 1.
|
shasum -a 256 --check |
sha256sum --check |
|
|---|---|---|
| macOS | ✅ works | ❌ fails (BSD, no --check) |
| ubuntu:24.04 | ❌ missing | ✅ works |
Neither name is safe to select by existence alone. So: prefer shasum, fall back to sha256sum, and fail with a clear message if neither exists.
Verified on ubuntu:24.04 arm64:
selected: sha256sum --check
/chk.txt: OK
verify: PASS
negative: correctly rejected
2. Unanchored version match — fixed
Correct on both counts: unanchored, and the unescaped dots were regex wildcards. Now:
ANTLR_VERSION_RE := $(subst .,\.,$(ANTLR_VERSION))
... | grep -Eq 'Version $(ANTLR_VERSION_RE)([^0-9]|$$)'Applied to both the early no-op check and the post-apt re-verification. Verified a stub reporting Version 4.9.20 is now rejected and falls through to the pinned download, while exact 4.9.2 still short-circuits.
Ported here from the collate counterpart (open-metadata/openmetadata-collate#5176) since this file carries the identical logic.
Code Review ✅ Approved 1 resolved / 1 findingsUpdates the ANTLR CLI installation process to prioritize local and distro-provided versions before falling back to a checksum-verified download. This resolves potential rate-limiting issues and addresses the loose apt version matching. ✅ 1 resolved✅ Edge Case: apt candidate glob 4.9.2* could match unintended versions
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
Problem
make install_antlr_clidownloads the ANTLR 4.9.2 CLI from a public host at build time, and that download keeps getting rate-limited.#30120 moved it from
www.antlr.org(GitHub Pages) to Maven Central and added SHA256 verification. Central then rate-limited us from the same shared CI egress IP. Nightly run 29776192824 started ~7h after that merge and failed with 12 × HTTP 429 fromrepo1.maven.org. Runs are still failing today, and it also breaks collate PR checks.Relocating the download between public hosts doesn't help — the throttling follows it.
Why fix it here
Every consumer already calls this one target:
WORKDIR openmetadata/orcd ../OpenMetadata)git submodule update --init --remote, which tracks OpenMetadatamainMakefiletarget + its callerui-checkstyle.ymlFixing the target here covers the OpenMetadata call sites and the collate Docker builds, instead of editing ~25 call sites across two repositories.
Scope gap (collate)
Collate has its own root
Makefilewith a duplicateinstall_antlr_clithat is still the original pre-#30120 version — it downloads fromantlr.organd has nocurl --fail, so a 429 response body gets appended into the jar and fails later with an unrelated error. Its only caller is.github/workflows/ui-checkstyle.yml.Nothing in this PR touches that. It needs a separate collate PR, ideally deleting the duplicate so there is one implementation rather than two that drift. Thanks @ayush for catching that this PR's description previously overstated its collate coverage.
Change
install_antlr_clinow resolves in three steps, cheapest first:4.9.2. Ubuntu noble and later ship 4.9.2 — matching every pinned runtime in this repo — so no public host is involved.The version pins step 2 has to satisfy:
antlr4-python3-runtime==4.9.2ingestion/setup.py:147"antlr4": "4.9.2"openmetadata-ui/.../package.json:100The match is exact and checked with
apt-cache policybefore installing, so a distro carrying a different ANTLR (jammy ships 4.7.2) falls through to the pinned download rather than silently generating parsers those runtimes reject. apt failures — no root, unreachable archive — fall through too.Step 3 keeps
ANTLR_MAVEN_BASEso environments without a distro package (macOS, non-Debian images) can point at an internal Maven mirror instead of Central.Testing
OKOKOKOKThe apt branches were exercised with stubbed
apt-get/apt-cache(this was developed on macOS), so the branch logic is verified but real apt behaviour on a noble runner is not. Worth confirming on CI before merge.Pinned hash verified against the published artifact:
bb117b1476691dc2915a318efd36f8957c0ad93447fb1dac01107eb15fe137cd.Notes
antlr.versionof 4.13.2 would need the Python and JS runtimes bumped and parsers regenerated — separate change.🤖 Generated with Claude Code
Greptile Summary
This PR makes ANTLR CLI installation prefer local and distro-provided copies before downloading. The main changes are:
PATH.Confidence Score: 5/5
This looks safe to merge.
PATHbefore returning success.Important Files Changed
Reviews (3): Last reviewed commit: "fix(ci): portable checksum tool and anch..." | Re-trigger Greptile
Context used (3)