Skip to content

fix(ci): install the ANTLR CLI from the distro archive when available - #30267

Merged
chirag-madlani merged 6 commits into
mainfrom
fix/antlr-pulp-mirror-base
Jul 21, 2026
Merged

chirag-madlani merged 6 commits into
mainfrom
fix/antlr-pulp-mirror-base

Conversation

@ShaileshParmar11

@ShaileshParmar11 ShaileshParmar11 commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Problem

make install_antlr_cli downloads 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 from repo1.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:

Repo Call sites Covered by this PR?
OpenMetadata 20 — 16 workflows + the 3 shared composite actions ✅ all
openmetadata-collate 3 Dockerfiles that run OpenMetadata's Makefile (WORKDIR openmetadata/ or cd ../OpenMetadata) ✅ via git submodule update --init --remote, which tracks OpenMetadata main
openmetadata-collate root Makefile target + its caller ui-checkstyle.yml ❌ not covered — separate collate PR needed
openmetadata-nightly 7 n/a — fixed directly in openmetadata-nightly#260 (merged)

Fixing 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 Makefile with a duplicate install_antlr_cli that is still the original pre-#30120 version — it downloads from antlr.org and has no curl --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_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 every pinned runtime in this repo — so no public host is involved.
  3. Pinned, checksum-verified download, unchanged.

The version pins step 2 has to satisfy:

Pin Location
antlr4-python3-runtime==4.9.2 ingestion/setup.py:147
"antlr4": "4.9.2" openmetadata-ui/.../package.json:100

The match is exact and checked with apt-cache policy before 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_BASE so environments without a distro package (macOS, non-Debian images) can point at an internal Maven mirror instead of Central.

Testing

Scenario Result
4.9.2 already on PATH skipped, nothing written
apt offers 4.9.2 (noble) installed via apt, no download
apt offers 4.7.2 (jammy) rejected, fell through to download, checksum OK
apt install fails (no root) fell through to download, checksum OK
no apt at all (macOS) download, checksum OK
4.7.2 binary on PATH did not skip, downloaded 4.9.2
stale 4.7.2 shadowing apt's 4.9.2 on PATH detected, reported the shadowing path, fell back to download
mirror unreachable fell back to Central, checksum OK
all sources 404 exit 2, no partial install

The 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

  • Version stays 4.9.2. Aligning with the Java side's antlr.version of 4.13.2 would need the Python and JS runtimes bumped and parsers regenerated — separate change.
  • open-metadata/openmetadata-nightly#260 fixes the nightly workflows directly so AUT is unblocked without waiting for this.
  • Credit to @matias for suggesting the distro package.

🤖 Generated with Claude Code

Greptile Summary

This PR makes ANTLR CLI installation prefer local and distro-provided copies before downloading. The main changes are:

  • Reuses an existing ANTLR 4.9.2 executable on PATH.
  • Installs the exact pinned version from apt when available.
  • Verifies the resolved executable after apt installation.
  • Retains checksum-verified downloads with configurable primary and fallback Maven sources.

Confidence Score: 5/5

This looks safe to merge.

  • The apt path now verifies the executable selected by PATH before returning success.
  • An incompatible shadowing executable causes the recipe to continue to the pinned download.
  • No blocking issue remains in the updated code.

Important Files Changed

Filename Overview
Makefile Adds exact-version PATH and apt resolution, post-install verification, and a configurable verified download fallback.

Reviews (3): Last reviewed commit: "fix(ci): portable checksum tool and anch..." | Re-trigger Greptile

Context used (3)

  • Context used - CLAUDE.md (source)
  • Context used - openmetadata-ui-core-components/CLAUDE.md (source)
  • Context used - AGENTS.md (source)

#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>
@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Jul 21, 2026
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>
@ShaileshParmar11 ShaileshParmar11 changed the title fix(ci): allow ANTLR CLI to be fetched from an internal Maven mirror fix(ci): prefer a system-installed ANTLR CLI over downloading the jar Jul 21, 2026
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>
@ShaileshParmar11 ShaileshParmar11 changed the title fix(ci): prefer a system-installed ANTLR CLI over downloading the jar fix(ci): install the ANTLR CLI from the distro archive when available Jul 21, 2026
Comment thread Makefile Resolved
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>
@ShaileshParmar11

Copy link
Copy Markdown
Contributor Author

Edge Case: apt candidate glob 4.9.2* could match unintended versions

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:

Candidate Result
4.9.2 accepted → apt
4.9.2-2 accepted → apt
4.9.2-3build1 (what noble ships) accepted → apt
4.9.2~rc1 accepted → apt
4.9.2+dfsg-1 accepted → apt
4.9.20-1 (the reported case) rejected → pinned download
4.9.2preview rejected → pinned download
4.7.2-5 (jammy) rejected → pinned download
4.10-1 rejected → pinned download

~ is included in the delimiter set since a 4.9.2~rc is still upstream 4.9.2. An epoch-prefixed candidate (1:4.9.2-2) would no longer match and would fall through to the pinned download — the safe direction.

Also worth noting for reviewers: the apt path is verified end-to-end on ubuntu:24.04 arm64, matching our runners.

apt-cache policy antlr4  ->  Candidate: 4.9.2-2
apt-get install -y antlr4 ->  OK
command -v antlr4         ->  /usr/bin/antlr4
antlr4                    ->  ANTLR Parser Generator  Version 4.9.2

@ShaileshParmar11
ShaileshParmar11 marked this pull request as ready for review July 21, 2026 06:49
Copilot AI review requested due to automatic review settings July 21, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

Comment thread Makefile Resolved
tutte
tutte previously approved these changes Jul 21, 2026
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>
Copilot AI review requested due to automatic review settings July 21, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ShaileshParmar11

Copy link
Copy Markdown
Contributor Author

Thanks @ayush — both code points were valid. Addressed:

1. Collate scope — you're right, the description overstated it. Corrected above. The accurate split:

collate call site Covered here?
collate-local-webserver/docker/Dockerfile-dev:90 (WORKDIR openmetadata/) ✅ runs OpenMetadata's Makefile
ingestion-extension/operators/docker/Dockerfile-dev:109 (WORKDIR openmetadata/) ✅ same
collate-local-webserver/docker/Dockerfile:45 (cd ../OpenMetadata &&) ✅ same
collate root Makefile + ui-checkstyle.yml ❌ needs a separate collate PR

The Docker ones reach this fix because collate CI runs git submodule update --init --remote and .gitmodules on collate main tracks branch = main — so they pick up OpenMetadata main's tip without a submodule bump. The ui-checkstyle path calls collate's own duplicate target, which this PR cannot touch.

2. Verify the resolved binary after apt-get install — real bug, fixed in edb6d75.

You were right that it was unprotected. apt installs to /usr/bin/antlr4, but /usr/local/bin comes earlier on PATH and is exactly where the previous install method wrote. A machine carrying a stale binary there would have had apt-get install succeed, the target exit 0, and antlr4 still resolve to the old version — silently generating parsers the pinned runtimes reject.

It now re-checks the resolved binary and falls through to the pinned download (which writes to ANTLR_INSTALL_DIR and takes precedence):

Distro package installed, but antlr4 on PATH resolves to /.../shadow-early/antlr4
which is not 4.9.2; falling back to pinned download.

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 (REQUIRE_LINKED_ISSUE) or the skip-pr-checks bypass label. Deferring to the team on which is appropriate here.

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 ubuntu:24.04 arm64 container.

@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (19 flaky)

✅ 4533 passed · ❌ 0 failed · 🟡 19 flaky · ⏭️ 95 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 437 0 3 16
✅ Shard 2 11 0 0 0
🟡 Shard 3 826 0 2 8
🟡 Shard 4 817 0 1 18
🟡 Shard 5 825 0 6 5
🟡 Shard 6 833 0 2 46
🟡 Shard 7 784 0 5 2
🟡 19 flaky test(s) (passed on retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: chart (shard 1, 1 retry)
  • Pages/SearchSettings.spec.ts › Latest preview config wins when a superseded request resolves late (shard 1, 1 retry)
  • Flow/SearchRBAC.spec.ts › a table-scoped user sees tables but never dashboards (shard 1, 2 retries)
  • Features/ContextCenterArticles.spec.ts › Article listing search filters, clears, and shows empty state (shard 3, 1 retry)
  • Features/ContextCenterMemories.spec.ts › adding a linked asset in edit mode shows entity badge on the row (shard 3, 1 retry)
  • Features/SearchExport.spec.ts › Export queues a background job and downloads from the jobs tray (shard 4, 1 retry)
  • Flow/AddRoleAndAssignToUser.spec.ts › Verify assigned role to new user (shard 5, 1 retry)
  • Flow/ApiServiceRest.spec.ts › add update and delete api service type REST (shard 5, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Number (shard 5, 1 retry)
  • Pages/CustomProperties.spec.ts › Set & Update all CP types on metric (shard 5, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate DisplayName Rule Is_Set (shard 5, 1 retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard 6, 1 retry)
  • Pages/ExploreBrowse.spec.ts › service type drill-down disables unrelated roots and query-panel Clear resets it (shard 6, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › verify create lineage for entity - Dashboard (shard 7, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for pipelineService in platform lineage (shard 7, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab is NOT visible for apiService in platform lineage (shard 7, 1 retry)
  • Pages/UserDetails.spec.ts › Create team with domain and verify visibility of inherited domain in user profile after team removal (shard 7, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

ayush-shah
ayush-shah previously approved these changes Jul 21, 2026
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>
Copilot AI review requested due to automatic review settings July 21, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ShaileshParmar11

Copy link
Copy Markdown
Contributor Author

Both findings were valid — thanks. Fixed, though the first one needed a different fix than suggested.

1. shasum vs sha256sum — real bug, but sha256sum alone isn't portable either

The core claim is correct and I verified it in a container: shasum is absent on ubuntu:24.04. So the download fallback would fail its checksum step on exactly the runners we target, and report download failed after 3 attempts instead of naming the missing tool.

Worth noting the implication: the download path introduced in OpenMetadata#30120 has never actually succeeded on Ubuntu CI. The 429 always hit first and masked it.

But switching to sha256sum would break macOS, which is the documented download path. macOS ships /sbin/sha256sum from BSD, which has no --check:

$ /sbin/sha256sum -c
usage: sha256sum [-bctwz] [files ...]

Measured on both platforms:

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.

@gitar-bot

gitar-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Updates 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

📄 Makefile:102-103
The case "$candidate" in $(ANTLR_VERSION)*) pattern matches any candidate beginning with 4.9.2, so a hypothetical distro version like 4.9.20 or 4.9.2-preview would be accepted as an exact 4.9.2 match. This is very unlikely for ANTLR in practice and the fallback is safe, but if strict matching is intended, anchor on a delimiter (e.g. match 4.9.2 or 4.9.2[-+~ ]*) rather than a bare prefix.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

This branch was previously deployed

1 inactive deployment
test — 259ad452 Deployed Jul 21, 2026 by ShaileshParmar11 via playwright-ci-postgresql (4, 7) #57551
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants